How to open saw no problem with this: PdfReader.Open(tiffPath, PdfDocumentOpenMode.Modify). It is not clear how to show in your application Pdf document is opened using the method: PdfReader.Open. I think there are two options for how to use them but I do not know. Variant № 1. Use PdfSharp.Forms.pagePreview. Here you can in the process: public void Render(XGraphics gfx) For example: If you specify: gfx.DrawString("The object used for drawing is the XGraphics object.", font, XBrushes.Black, x, y) - everything works well. If you specify: PdfDocument inputDocument = PdfReader.Open(tiffPath, PdfDocumentOpenMode.Modify); XGraphics gfx = XGraphics.FromPdfPage(inputDocument.Pages[0]); - It does not work why the element pagePreview is empty. You like this: PdfDocument inputDocument = PdfReader.Open(tiffPath, PdfDocumentOpenMode.Modify); XGraphics gfx2 = XGraphics.FromPdfPage(inputDocument.Pages[0]); - Just then copy gfx2 of gfx. Variant № 2. Use MigraDoc.Rendering.Forms.DocumentPreview. For example: Document document = SampleDocuments.CreateSample1(); string ddl = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(document); this.DocumentPreview.Ddl = ddl. WriteToString requires type DocumentObject. And you can type PdfDocumen convert type DocumentObject?
|