I have to use a 3rd party SDK that generates reports in a System.Drawing.Printing.PrintDocument
format. Since my project is not a Windows Form project(it is a Web project),I need to convert this System.Drawing.Printing.PrintDocument
to a PDF. I have downloaded iTextSharp and SharpPDF but they seem to create a new PDF. I have also gone through the tutorial(s) here: http://sharppdf.sourceforge.net/Tutorials.html. My requirement is to convert the document that I already have into a PDF. Is there something that I'm missing in using these libraries? Can someone please provide a sample code to achieve this?
Convert System.Drawing.Printing.PrintDocument to PDF c#
19.4k views Asked by user1550951 At
2
There are 2 answers
4
On
How about installing a virtual PDF printer and "print" the document? For example - http://www.dopdf.com/, or http://www.cutepdf.com/products/cutepdf/writer.asp?
A code sample of how to print a PrintDocument, can be found here http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx
Another possible course would be take the Graphics from the PrintDocument (http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.printpage(v=vs.80).aspx and look at what is proposed here - http://www.websupergoo.com/helppdfnet/source/4-examples/20-systemdrawing.htm
you can create document by print to file in .net
exapmle : convert printDocument to XPS file , try code:
in future time we will get convert printDucument to pdf file .
thank you