Question Omar Ali Ateen · Feb 2, 2023

HTML TO PDF

Hi  

Is there any build in solution to convert HTML to PDF?  if yes please how

Thank you

Product version: IRIS 2022.1

Comments

Lorenzo Scalese · Feb 2, 2023

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.

0
Enrico Parisi · Feb 2, 2023

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

0
Michael Davidovich · Feb 2, 2023

The built in solution is Zen reports or has that changed?  Otherwise, as people mention, lots of other options.

0
Enrico Parisi  Feb 2, 2023 to Michael Davidovich

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.

0
Mark Charlton · Mar 13, 2023

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"
strExePath=..getChrome()  // This function just handles the fact some machines put chrome in program files, others in program files (x86)
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)
##class(%File).Exists(strPDFPath)
"1*"_strPDFPath 
ELSE 
"0*Error Occurred" }

0