Use a System.Drawing.Printing.PrintDocument to generate a PDF in memory

Posted by MarkB29 on Stack Overflow See other posts from Stack Overflow or by MarkB29
Published on 2010-01-04T20:29:46Z Indexed on 2010/04/22 15:03 UTC
Read the original article Hit count: 627

Filed under:
|
|

Does anyone know if the following is possible and if so what the best way of doing it is for free?

I am generating a PrintDocument in a project I am currently working on and displaying a print dialog box so a user can choose which printer they want to use etc. The is currently a windows form application and if a user wants to print to a PDF they can select to print to CutePDF or something similar.

However I am now putting a ASP.Net web frontend on the application and want to use the same code to generate the PrintDocument but want to print it to a PDF on the fly and serve it up via the Response stream in the format of a PDF download.

So my question is....How can I use the current PrintDocument and generate a PDF in memory from it??

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET