PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Jun 19, 2020 9:16 am 
Offline

Joined: Fri Jun 19, 2020 9:04 am
Posts: 2
Hi,

My designer sent me a couple of PDFs which i should then dynamicaly combine to one pdf (Some pages have Orientation=landscape). On each page i put some additional texts.

When i add lanscape page (rotate=90) to document
var page = Document.AddPage(referencedPage);

rotate=90 stays
Orientation changed to Portrait

The problem is that when i draw string on the landscape page, the added strings are drawn verticaly.

Thank you
David


Attachments:
Printout.zip [224.64 KiB]
Downloaded 323 times
Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 22, 2020 12:11 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 339
There is a known problem with rotation.

Maybe this post can help you:
viewtopic.php?p=11548#p11548

Workaround:
Code:
page.Orientation = PageOrientation.Portrait;

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Tue Jun 23, 2020 8:21 am 
Offline

Joined: Fri Jun 19, 2020 9:04 am
Posts: 2
No, this did not solve the issue


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 03, 2020 9:06 pm 
Offline

Joined: Wed Jun 10, 2020 7:15 pm
Posts: 7
you have to rotate the xgraphics object.

Code:
gfx.RotateAtTransform(90, new XPoint(page.Width / 2, page.Height / 2));


the problem is then you are rotating around the wrong point since you are now in landscape. So you need to measure the difference between the center point of the document when in landscape and portrait

Code:
var offset = Math.Abs((page.Height - page.Width))/2;


then shift the document to adjust for the center points

Code:
gfx.TranslateTransform(offset, -offset);


This was from landscape to portrait so you may need to adjust the TranslateTransform. it could be
Code:
gfx.TranslateTransform(-offset, offset);


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 148 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