PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 6:48 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Feb 21, 2017 12:07 am 
Offline

Joined: Mon Feb 20, 2017 11:48 pm
Posts: 1
Hi,

I'm trying to import a landscape page, but after the import it appears that the orientation is no longer preserved.

The code is basically as follows:

Code:
PdfDocument target = new PdfDocument();
PdfDocument source = PdfReader.Open('source.pdf', PdfDocumentOpenMode.Import);
foreach (PdfPage srcPage in source.Pages) {
  PdfPage added = target.AddPage(srcPage); // the orientation appears not preserved.
}
target.Save('target.pdf');


So, if the source page has the following width, height & orientation:

Code:
width = 3024, height = 2016, orientation = Landscape


Once added it becomes

Code:
width = 2016, height = 3024, orientation = Portrait


How can I fix this issue? Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2017 9:05 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!

The recommended fix is described here:
viewtopic.php?p=9591#p9591

Comment some lines in "internal PdfPage(PdfDictionary dict)" and recompile PDFsharp.

Or try the fix from the post above - just a change in your code, no change in PDFsharp required.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 136 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group