Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

convert html file to pdf with vb.net

126 views
Skip to first unread message

kikde

unread,
May 15, 2007, 5:22:01 AM5/15/07
to
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

Jonathan Boivin

unread,
May 15, 2007, 7:21:32 AM5/15/07
to
You could install the free printer CutePDF which will allow you to "print"
the HTML file into a PDF file.

--

Thanks,
Jonathan Boivin
---
jonatha...@cints.net | http://www.cints.net
"kikde" <ki...@discussions.microsoft.com> a écrit dans le message de news:
9D2EB8AA-9E78-4AEA...@microsoft.com...

(O)enone

unread,
May 15, 2007, 11:50:34 AM5/15/07
to
kikde wrote:
> 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


kikde

unread,
May 16, 2007, 1:39:00 AM5/16/07
to
Thank you very much for this detailled answer.
I will try to develop a stabil solution...

"(O)enone" wrote:

> kikde wrote:
> > 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,

0 new messages