Cannot set the Orientation on Page

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v1)  /  Cannot set the Orientation on Page

DynamicPDF PrintManager for .NET (v1) Forum

 Aug 02 2013 5:11 AM
Hi,

I face and issue with version 1.0.1.20321.

If you set the PrintJobPagePrintOptions.PrintOptions.Inherit to false and then, if you try to set the Orientation on the PrintJobPagePrintOptions instance, it causes an exception saying that you can't not set or read the Orientation property if Inherit is true !!!

Try this and you'll get the error:

foreach (var pdfFile in files)
{
        var inputPdf = new InputPdf(pdfFile.Binary);
        inputPdfs.Add(inputPdf);
        printJob.Pages.Add(inputPdf);
        var pagejob = printJob.Pages.Last();
        pagejob.PrintOptions.Inherit = false;
        pagejob.PrintOptions.Orientation = printJob.PrintOptions.Orientation;
        switch (pdfFile.PageFormats)
        {
                case PageFormats.A4:
                                pagejob.PrintOptions.PaperSize = printJob.Printer.PaperSizes.A4;
                                break;
                case PageFormats.A3:
                                pagejob.PrintOptions.PaperSize = printJob.Printer.PaperSizes.A3;
                                break;
                default:
                                pagejob.PrintOptions.PaperSize = printJob.PrintOptions.PaperSize;
                                break;
        }
}

Remarks: setting the PaperSize property does not suffer such issue.

Is there a fix addressed in a newer version ? If no, can you investigate please ?

Thank you for your time and your support,

Geofrey
Posted by a ceTe Software moderator
Hello Geofrey,

The syntax which you are using to set the Orientation to the PrintJobPage object is wrong. Please try using the below code and this should work for you.

pagejob.PrintOptions.Orientation.Type = OrientationType.Landscape;

You can also refer the documentation on PrintJobPage here.

Thanks,
ceTe Software Support Team.
Ok thanks, It works.
Thank you also for your quick reply.

One question remains if you look the following code:

page.PrintOptions.Inherit = false;
page.PrintOptions.PaperSize = printJob.PrintOptions.PaperSize;
page.PrintOptions.Orientation = printJob.PrintOptions.Orientation;

The second instruction works but the last instruction not.

Why must we replace the last instruction by 2 statements ?:
page.PrintOptions.Orientation = printJob.PrintOptions.Orientation.Type;
page.PrintOptions.Orientation = printJob.PrintOptions.Orientation.Rotated;

It is counterintuitive... No ?


Concerning my last reply
Of course, I was meaning:

page.PrintOptions.Orientation.Type = printJob.PrintOptions.Orientation.Type;
page.PrintOptions.Orientation.Rotated = printJob.PrintOptions.Orientation.Rotated;
Posted by a ceTe Software moderator
Hello,

We will forward this information to our developers to look into it further and we will post the updates on the forum once we hear something from them.

Thanks,
ceTe Software Support Team.
Posted by a ceTe Software moderator
Hello,

The exception "The Orientation property cannot be set or read when Inherit is set to True." has been fixed in the latest version of PrintManager. Please email our support team at support@cete.com to obtain the new build.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 11:05 AM.