Print Landscape Pdf-Document

Hi,

i try to print a pdf-Document with landscape orientation. The content is correct, but the paper is not landscape so the content is cut off at the end. I’m using the PDFCreator as printer.
My Code:

        m_Document.PageInfo.IsLandscape = True
        Dim startpageNumber = 0
        Dim endPageNumber = 0
        Dim printername = "PDFCreator"
        For Each page As Page in m_Document.Pages
          page.PageInfo.IsLandscape = True
        Next

        Using pdfViewer = New PdfViewer()

          pdfViewer.BindPdf(m_Document)
          If startPageNumber < 1 Then startPageNumber = 0
          If endPageNumber < 1 Then endPageNumber = pdfViewer.PageCount

          Dim printerSettings = New PrinterSettings
          With printerSettings
            .PrintRange = PrintRange.SomePages
            .FromPage = startPageNumber
            .ToPage = endPageNumber
            .PrinterName = printerName
            .DefaultPageSettings.Landscape = True
          End With

          pdfViewer.AutoResize = True
          pdfViewer.AutoRotate = True
          pdfViewer.PrintDocumentWithSettings(printerSettings)

The AutoRotate-Property has no effect.

Kind regards
Manuel Memenga

grid (2) - Kopie.pdf (76.6 KB)

@manuel.memenga

Thanks for contacting support.

We have tested the scenario in our environment while using Aspose.Pdf for .NET 17.10 and a default soft printer “Microsoft Print to PDF” and were unable to notice the issue, which you have mentioned. Please check following code snippet. which we have used to test the scenario. For your reference, printed PDF has also been attached below the code snippet.

Using viewer As New Facades.PdfViewer()
	Dim outputFile As String = dataDir + "grid (2) - Kopie_printed.pdf"

	viewer.BindPdf(dataDir + "grid (2) - Kopie.pdf")
	viewer.PrintPageDialog = False
	viewer.PrintAsGrayscale = True

	Dim ps As New System.Drawing.Printing.PrinterSettings()
	Dim pgs As New System.Drawing.Printing.PageSettings()

	ps.PrinterName = "Microsoft Print to PDF"
	ps.PrintFileName = outputFile
	ps.PrintToFile = True
	pgs.Landscape = True
	ps.DefaultPageSettings.PaperSize = pgs.PaperSize
	ps.DefaultPageSettings.Landscape = True
	viewer.PrintDocumentWithSettings(pgs, ps)
End Using

grid (2) - Kopie_printed.pdf (417.7 KB)

Would you please add some more details regarding the printer, which you have mentioned. We will check the details in this regard, and provide our feedback accordingly.

Thanks for the quick reply.

We are using the PDFCreator by PDFForge (http://www.pdfforge.org/pdfcreator).
I get the same document with your code-snippet.

Kind regards.
Manuel Memenga

2017-10-13_14h20_37.png (56.8 KB)

@manuel.memenga

Thanks for sharing requested information.

I have used PDFCreator to print the PDF document while using following code snippet and managed to obtain correct output. For your reference, I have attached resultant PDF as well.

Using viewer As New Facades.PdfViewer()
	viewer.BindPdf(dataDir + "grid (2) - Kopie.pdf")
	viewer.PrintPageDialog = True
	viewer.PrintAsGrayscale = False

	Dim ps As New System.Drawing.Printing.PrinterSettings()
	Dim pgs As New System.Drawing.Printing.PageSettings()

	ps.PrinterName = "PDFCreator"
	ps.PrintToFile = True
	pgs.PaperSize = New System.Drawing.Printing.PaperSize("A4", 827, 1169)
	pgs.Landscape = True
	pgs.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)
	ps.DefaultPageSettings.PaperSize = pgs.PaperSize
	viewer.PrintDocumentWithSettings(pgs, ps)
End Using 

grid (2) - Kopie.pdf (2.6 MB)

In case of any further assistance, please feel free to let us know.