I am trying to print Form using PrintForm in VB.Net
This Form has few labels and a chart control. I have used this very simple code
Dim pf As New PrintForm
pf.Form = Me
pf.PrintAction = PrintAction.PrintToFile
pf.PrintFileName = "../../generated_pdf.pdf"
pf.Print()
It generated "generated_pdf.pdf" file. When I am trying to open this file it gives me an error
Couldn’t open PDF
Something’s keeping this PDF from opening.
Any ideas on how to resolve this error and successfully generate a working pdf that can be opened and viewed with it's right contents?
The form that should be converted to pdf looks like this
PrintForm does not know how to handle PDF files, which is why its not working.
It only knows how to do .eps, .ps & .ai.
If you want PDF, you'll need something that knows how to turn one of the above formats into a PDF.
Ghostscript & Ghostscript.Net do this nicely and are free & open source. There are others, but I've actually used these and know they work.