Open FreeVB opened 1 week ago
Why is there an error when inserting a picture?
Inserts the specified page in this document. If the page is from an external document, it is imported to this document. In this case the returned page is not the same object as the specified one.
PdfDocument document = PdfReader.Open(sourcePdfPath, PdfDocumentOpenMode.Modify); PdfPage newPage = document.AddPage(); XImage image = XImage.FromFile(imagePath); XGraphics gfx = XGraphics.FromPdfPage(newPage); gfx.DrawImage(image, 0, 0, newPage.Width, newPage.Height); if (pageIndex < document.PageCount - 1) { document.InsertPage(pageIndex + 1, newPage); } else { document.AddPage(newPage); }
Why is there an error when inserting a picture?
Inserts the specified page in this document. If the page is from an external document, it is imported to this document. In this case the returned page is not the same object as the specified one.