PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Sample TwoPagesOnOne - rotating pages and preserving aspect
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4458
Page 1 of 1

Author:  sq5gvm [ Sat Jul 15, 2023 9:59 am ]
Post subject:  Sample TwoPagesOnOne - rotating pages and preserving aspect

thank you for great library and samples.
I tried using TwoPagesOnOne example in my project and found two issues.
We receive PDF with multiple pages that can have different orientation each and to spice things up can have different paper size (different aspect ratio).
Example pages in order: A4 portrait, A4 landscape, A6 portrait, A5 landscape, A4 landscape, 100x170mm portrait (all in one source document).

Original sample does not generate good output from source pages that are landscape (pages are stretched and squished to portrait aspect ratio).
Additionally (connected to the first issue) pages are scaled without keeping aspect ratio of original page.

I've modified example to support such cases - if you'd like to use it, add it to samples, simply give some advice or constructive criticism feel free to do so.
Sample is posted as github gist https://gist.github.com/sq5gvm/574e918706778a37d2783a3c55dd632d

It's probably not perfect quality code and could be optimised (I'm not an c# developer by trade) but it "works for me" without problems (processed over 2k input pages).

Have a nice day
Miroslaw

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