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

Error copying a document that rotates 90.
http://forum.pdfsharp.de/viewtopic.php?f=3&t=3926
Page 1 of 1

Author:  lee [ Thu Mar 07, 2019 3:05 am ]
Post subject:  Error copying a document that rotates 90.

I want to reorder the document pages.
The content of one file has been offset.
My File:
http://www.mediafire.com/file/jrcrrsb82 ... 4.pdf/file

My codes:
Code:
            string filename = "sample5_4.pdf";
            PdfDocument outputDocument = new PdfDocument();
           
            XGraphics gfx;
            XRect box;
           
            XPdfForm form = XPdfForm.FromFile(filename);
            for (form.PageIndex = 0; form.PageIndex < form.PageCount; form.PageIndex+=2)
            {
                // Add a new page to the output document
                PdfPage page = outputDocument.AddPage();
                page.Orientation = PageOrientation.Portrait;
                page.Width = form.Page.Width;
                page.Height = form.Page.Height;
               
                gfx = XGraphics.FromPdfPage(page);

                box = new XRect(0, 0, page.Width, page.Height);
                gfx.DrawImage(form, box);
            }
           
            filename = "sample5_4_result.pdf";
            outputDocument.Save(filename);
            Process.Start(filename);

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