PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Mar 07, 2019 3:05 am 
Offline

Joined: Thu Mar 07, 2019 1:24 am
Posts: 7
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);


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

All times are UTC


Who is online

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