convert html file to pdf with vb.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,
i want to convert exisiting html files to pdf files with vb.net. the covert
process should run in the background, the user should not see anything from
it.

is there a freeware component which has implemented this functionality, or
is there a way to develop it with .net?

Thank's for any productive comments...
Regarsds Jens
 
You could install the free printer CutePDF which will allow you to "print"
the HTML file into a PDF file.
 
kikde said:
i want to convert exisiting html files to pdf files with vb.net. the
covert process should run in the background, the user should not see
anything from it.

is there a freeware component which has implemented this
functionality, or is there a way to develop it with .net?

We spent some time addressing this problem a while back.

The first problem is that you need something to render the HTML. You really
have two options here: use an existing browser engine (such as Internet
Explorer) or use a custom HTML renderer implementation. If the solution you
use applies the latter option, you're always going to be limited in the
functionality which it is able to offer -- goodness knows it's taken long
enough to IE and Firefox to reach a point where they are acceptably
standards-compliant.

We found a number of packages that could potentially do the job, some free
and some very expensive. The solution we settled on is as follows:

1. Install PDFCreator (http://sourceforge.net/projects/pdfcreator/). This
installs a virtual printer driver, which stores all documents sent to it as
..pdf files on disk. Yes, this is pretty ugly and fragmented as a solution,
but this is the tidiest of the virtual printer packages we managed to find;
all the GhostScript and RedMon libraries are installed automatically and
hidden away inside the PDFCreator implementation so you don't need to
install or configure them separately.

2. Configure it to use the AutoPrint functionality, telling it where you
want it to put the output files.

3. In your application, host a WebBrowser control on one of your forms.

When you want to print some HTML, put it into the WebBrowser and tell it to
print to the virtual printer.

With this approach we've managed to put together a reliable and stable
HTML-to-PDF service, but it's still far from being as neat and tidy as I
like my solutions to be. If anyone knows of a cleaner way to achieve this
I'd love to hear about it.

(O)enone
 
Back
Top