You can use
wkHtmlToPdf for this. It's an installable command line tool - it's largish (~10mb as it it wraps the Chromium engine), but with works pretty good.
I use it in
Markdown Monster to convert Markdown generated HTML to PDF output. I basically run the output to a local file then use wkHtmlToPdf to convert the content to PDF but I believe you can also directly provide a URL.
It works well even with script applied formatting, but it has problems with very large files. I've tried using it in
Help Builder to create massive documentation files and it falls down at about 500 pages or so. So if you're doing huge content then it might not work. In Help Builder I continue to use Word for the PDF export which is a painful and error prone process, but it works even with very large multi-thousand page documents (sometimes needed for Class documentation).
+++ Rick ---
>On an end-user 'email message' form I have an IE object which contains mail-merged composed message text in html format.
>
>Because recipients are apparently changing the content of the received message, I am trying to programmatically print the message contents of the IE control directly to a PDF file and then (redundantly) attach that generated PDF as an attachment to the email message (which would then be sent back and forth between the parties via an electronic signature service).
>
>Currently I can print the contents which invokes the printer selection dialogue box. But i was hoping to pass a PDF printer name (and a file name) to the "execCommand" command. But no luck so far. I cant avoid the dialogue box, and I cannot set the output file type. But it will save to an .html file in the end.
>
>At this point, the user would get a printer dialogue box, then they would have to select a PDF printer driver, then specify an output filename, then complete the PDF generation, then test for file existence, ...
>
>Has anyone automated this IE-content-to-pdf process?
>Or is there an ActiveX control that supports this?
>
>There is an existing and somewhat comparable feature available where an MSWord session is spun up with a doc file in the background, then text merged, and then "Save(d) To PDF" without user intervention. But I would like to avoid using/requiring MSWord. And to hopefully cut the process from a 4 or 5 step process to 1 or 2.
>
>Thanks.
>
>
>lcprinter = GETPRINTER()
>*---
>*--- Thisform.Chtmleditor1.oIE.Document.execCommand("Print",.t.,0)
>Thisform.Chtmleditor1.oIE.Document.execCommand("Print",.f.,lcPrinter)
>