HTML TO PDF
Hi
Is there any build in solution to convert HTML to PDF? if yes please how
Thank you
Comments
Please check the below link:
https://community.intersystems.com/post/how-create-pdf-file-html
Thanks
Thanks!!!!!!!! @Muhammad Waseem
Hi,
I never tested myself, but in Python, there is pdfkit library.
Maybe the support of Python with IRIS could be useful for your case.
There are plenty of options, as discussed in the thread linked above.
Personally, a little more than 10 years ago I've used a (commercial) .NET library called hiqpdf and wrote a very tiny .NET wrapper. Works great and since then it's still running fine.
Enrico
The built in solution is Zen reports or has that changed? Otherwise, as people mention, lots of other options.
The solution depends on the problem, my understanding is that the problem is to convert any arbitrary HTML to PDF, then I don't think Zen report can do it.
Try LibreOffice.
I use wkhtmltopdf.exe
💡 This question is considered a Key Question. More details here.
I have been working on this recently and tried the links in this and other questions, but in the end settled for using Chrome. It was easier, quicker and less moving parts as Chrome was already on the servers.
/// "C:\Program Files\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --print-to-pdf="E:\Data\Spooler\2022-07\DN560241_14a.pdf" "E:\Data\Spooler\2022-07\DN560241_14.htm"
S strExePath=..getChrome() // This function just handles the fact some machines put chrome in program files, others in program files (x86)
S s1=$ZF(-100,"/LOGCMD /NOQUOTE /STDOUT+=e:\logs\H2POUT.log /STDERR+=e:\logs\H2Perr.log",strExePath,"--headless --disable-gpu --print-to-pdf-no-header --print-to-pdf="""_strPDFPath_""" """_strHTMLPath_"""")// For some weird reason this flags as an error when it completes, no idea why, but its not valid.
//w "S1: "_s1,!!
//I $$$ISERR(s1) Q $SYSTEM.Status.GetErrorText(s1)
I ##class(%File).Exists(strPDFPath)
{ Q "1*"_strPDFPath }
ELSE
{ Q "0*Error Occurred" }