PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Converting HTML to PDF  (Read 895 times)

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Converting HTML to PDF
« on: April 25, 2022, 03:59:58 PM »
Hi All,
I have a need to convert an HTML Page to a PDF programatically. I've done it manually and it converts real nice.  I was curious about that pxplus chromium object....do you think that could do it?

I should elaborate...when you have a web page open thru chrome...you can print it to pdf and it comes out really nice...i was wondering if i opened a web page thru that chromium object if i could that...i did try it and i could not seem to access any of the methods/properties...that is when i posted to list...

jeff
« Last Edit: April 25, 2022, 04:55:34 PM by Jeffrey Ferreira »

Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: Converting HTML to PDF
« Reply #1 on: April 26, 2022, 09:31:14 AM »
Hi Jeff,

You can use *Browser to manually print to a PDF but there is nor current built in functionality to print to a PDF programmatically.

If you load the HTML into a *Browser control you can then right click on the rendered web page and then select print, then select print to PDF.

Instead of right click you can also use the code:

myBrowser'window'print()

where myBrowser is the *Browser handle.

This code will programmatically trigger the print dialog. The user will still have to select the print to PDF printer.

We can look at possibly adding this feature to *Browser for a future release.
Principal Software Engineer for PVX Plus Technologies LTD.

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Converting HTML to PDF
« Reply #2 on: April 26, 2022, 09:34:46 AM »
Thank you Devon. I appreciate all this information. The only reason was I was looking to use HTML is because I had it formatted they way I wanted ...I'll look for another way to get my html into a pdf.

Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: Converting HTML to PDF
« Reply #3 on: April 26, 2022, 09:44:38 AM »
You can use a INVOKE and a simple free tool like this: https://wkhtmltopdf.org/.
Principal Software Engineer for PVX Plus Technologies LTD.

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Converting HTML to PDF
« Reply #4 on: April 26, 2022, 09:45:58 AM »
i did see that. I might try it. thank you

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 175
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Converting HTML to PDF
« Reply #5 on: April 26, 2022, 09:50:48 AM »
Devon, i tried that (wkhtmltopdf) and it worked perfect.. thank you