I have written a piece of code which uses the PdfSharp library. The instance of PdfSharp.Pdf.PdfDocument created saves to disk as expected. The right content is displayed, but onto the wrong page settings.
The default page settings for PdfSharp are:
- PdfSharp.PageSizes.A4
- PdfSharp.PageOrientation.Portrait
My problem is that these settings seem to override the required settings.
I create the instance of PdfDocument class and adds a new instance of PdfPage class to its Pages collection property. Then, I setup the page like this:
- PdfDocument.Pages[0].Size = PdfSharp.PageSizes.Letter
- PdfDocument.Pages[0].Orientation = PdfSharp.PageOrientation.Landscape
- I draw the strings (this works fine)
- I save the document to disk (this works fine)
- Process.Start(myPdfFilename) - then Acrobat Reader opens with my document.
- The page settings are A4 - Portrait...
I'm quite confused. I know of an option within Acrobat Reader that allows the user to change the page orientation without changing the text direction. No matter whether I check this option or not, still the wrong settings keep going.
Anyone has an idea? Thanks!