how can i move pages within a pdf document, for example page number 4 to page index 1?
I've tried to use the Insert- and Remove-Methods, but when moving a page to a lower page index, this does not work, as the moved page is removed then:
Code: Select all
int iPageToMove = 4;
int iPageDest = 1;
Vintasoft.Imaging.Pdf.PdfDocument pdfDocument;
pdfDocument = new Vintasoft.Imaging.Pdf.PdfDocument(@"d:\test.pdf");
pdfDocument.Pages.Insert(iPageDest, pdfDocument.Pages[iPageToMove]);
if (iPageToMove > iPageDest)
pdfDocument.Pages.Remove(pdfDocument.Pages[iPageToMove + 1]);
else
pdfDocument.Pages.Remove(pdfDocument.Pages[iPageToMove]);
pdfDocument.SaveChanges(@"d:\testnew.pdf");
pdfDocument.Dispose();
Thank you for your help!
Best regards,
Daniel