PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Avoid the assertion when setting landscape mode in MigraDoc?
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2150
Page 1 of 1

Author:  DaveH [ Wed Sep 26, 2012 11:01 pm ]
Post subject:  Avoid the assertion when setting landscape mode in MigraDoc?

MigraDoc raises an assertion when setting landscape more via DefaultPageSetup. What is the correct way to define a page as landscape?

Thanks,
Dave

Author:  Thomas Hoevel [ Thu Sep 27, 2012 8:23 am ]
Post subject:  Re: Avoid the assertion when setting landscape mode in Migra

Which assertion?

Maybe an assertion telling you not to modify the default page settings, but to use a copy of the default page settings instead?

Author:  DaveH [ Thu Sep 27, 2012 4:00 pm ]
Post subject:  Re: Avoid the assertion when setting landscape mode in Migra

Yes, that one. How do I get a copy to modify?
Thanks.

Author:  Thomas Hoevel [ Thu Sep 27, 2012 4:16 pm ]
Post subject:  Re: Avoid the assertion when setting landscape mode in Migra

Code:
PageSetup pageSetup = PageSetup.DefaultPageSetup.Clone();
Make the required changes and assign it to the PageSetup property of your section.

Author:  DaveH [ Fri Sep 28, 2012 9:56 pm ]
Post subject:  Re: Avoid the assertion when setting landscape mode in Migra

Got it. Thanks.

Just FYI, y copy of MigraDoc complained there was no DefaultPageSetup within PageSetup, so I did:
PageSetup pageSetup = document.DefaultPageSetup.Clone();
pageSetup.Orientation = Orientation.Landscape;
section.PageSetup = pageSetup;

Thanks again for your help.
Dave

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/