PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Print a dynamically created PDF
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1454
Page 1 of 1

Author:  mibal [ Thu Dec 02, 2010 12:49 pm ]
Post subject:  Print a dynamically created PDF

Hi

I'm currently working an ASP.NET project which has the following requirement.

Take an already existing PDF file, dynamically add a name and address to a label space left on the PDF, then send the PDF for printing.

With this running on a web server I want to if possible resist saving the version of the PDF with the address as it won't be required anymore after printing. Using adobe reader for printing is not an option, as this will be a multi user, print queue style system so don't want to have multiple copies of adobe reader opening and closing on the web server (and the admin guys will probably not allow it anyway).

I previously worked with PDFSharp before the merging with MigraDoc and so know that can do the PDF editing using PDFSharp, and reading about MigraDoc I see that it can do previewing and printing so my current attempted approach is:

* Load the templace PDF into a PDFSharp document
* Dynamically add the address text to the PDF
* Create a MigraDoc document from the PDFSharp document (if possible in memory)
* Print the MigraDoc document using MirgraDoc Printing.

I have completed the first 2 steps fine, and can get MigraDoc to render the PDFSharp document and save it by using the PdfDocumentRenderer.

But I can not get MigraDoc to print it, I have been trying to use a MigraDocPrintDocument... as shown in the Migra printing example.

I have hit a brickwall at this point, I thought I was nearly there having MigraDoc render and save the PDF, but can not get it to print. So is it possible to transfer a PDF Sharp document to a true MigraDoc document for printing or can I print from a PDFDocumentRenderer? and if either of these are possible how?

I know I could add the address text to a PDF using MirgraDoc adding it (I think) as a section/paragraph item, but can't work out how I would load the original PDF into a MigraDoc document?? I've only seen about loading a PDF from one of its DLL files?

Thanks for any help
Michael

Author:  Thomas Hoevel [ Thu Dec 02, 2010 3:15 pm ]
Post subject:  Re: Print a dynamically created PDF

Hi!

MigraDoc can print, but AFAIK it cannot print PDF "images" used in the document.

You can use PDF pages with MigraDoc to create new files, but you'll need a different tool for printing.

Or convert your PDF pages to real images (bi-level, e. g. 300 dpi).
The fixed text will come from the image, then MigraDoc will draw the variable text over the image.

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