Landscape pages printing orientation

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v2)  /  Landscape pages printing orientation

DynamicPDF PrintManager for .NET (v2) Forum

 Sep 02 2015 6:35 AM
Dear Sirs,

I has an issue with printing pdf file with mixed orientation. When I print file using Adobe Acrobat Reader all landscape pages are rotated counter-clockwise; however they are rotated clockwise when printing via DynamicPDF PrintManager. Are there some special properties for PrintJob that could handle it?

Best regards,
Fedor
Posted by a ceTe Software moderator
Hello,

You can achieve your requirement by rotating the landscape pages in the PDF. You will need to loop through the print job pages in the PrintJob, check for the landscape pages by comparing the width and height of the PDF page and set the orientation type and rotation accordingly. Here is the code sample:

            Printer printer = new Printer("PrinterName");
            InputPdf pdf = new InputPdf(@"Input PDF file path");
            PrintJob printJob = new PrintJob(printer,pdf);
            for(int i=0;i<printJob.Pages.Count;i++)
            {
                PrintJobPage page = printJob.Pages[i];
                if (page.InputPdfPage.Width > page.InputPdfPage.Height)
                {
                    page.PrintOptions.Inherit = false;
                    page.PrintOptions.Orientation.Type = OrientationType.Landscape;
                    page.PrintOptions.Orientation.Rotated = true;
                }
                
            }
           printJob.Print();

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 1:01 AM.