PDFsharp & MigraDoc Foundation http://forum.pdfsharp.com/ |
|
Issue when drawing strings on landscape page http://forum.pdfsharp.com/viewtopic.php?f=2&t=4146 |
Page 1 of 1 |
Author: | Albatros [ Fri Jun 19, 2020 9:16 am ] | ||
Post subject: | Issue when drawing strings on landscape page | ||
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
|
Author: | () => true [ Mon Jun 22, 2020 12:11 pm ] |
Post subject: | Re: Issue when drawing strings on landscape page |
There is a known problem with rotation. Maybe this post can help you: viewtopic.php?p=11548#p11548 Workaround: Code: page.Orientation = PageOrientation.Portrait;
|
Author: | Albatros [ Tue Jun 23, 2020 8:21 am ] |
Post subject: | Re: Issue when drawing strings on landscape page |
No, this did not solve the issue |
Author: | wiliek [ Thu Sep 03, 2020 9:06 pm ] |
Post subject: | Re: Issue when drawing strings on landscape page |
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);
|
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |