LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving html reports as pdf files

Solved!
Go to solution

Hello!

 

I would like to know what is the simplest way to save html reports as pdf files using PDFCreator version 2.1

Or any other way to do it..

 

thank you very much,

0 Kudos
Message 1 of 14
(15,858 Views)
PDF Creator is a PDF printer, so all you have to do is print the report to it.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 14
(15,853 Views)
Solution
Accepted by topic author jess1006

Here is some code from the NI Developer Community

 

Creating a PDF Document in LabVIEW

 

These set of LabVIEW VIs allow you to print a PDF by calling the open source PDFCreator application through ActiveX. As an added feature, unlike most PDF creator applications in this example there is no Save As dialog box that appears it is all done programmatically. The top level VI in the example is Print PDF Using PDFCreator ActiveX inside the attached LLB.

 

https://decibel.ni.com/content/docs/DOC-4552

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 14
(15,828 Views)

This version is now dated and PDF Creator has changed the API.

What's crucial, and not well documented, is that the print must be fired off before calling the WaitForJob else the NextJob will never get a valid reference. And the error will propogate and not call the ReleaseCom only to hang LabVIEW.

The code can also be written using ActiveX.

 

There's some fun code attached using the WebBrowser .NET control to fire a print for the html file. I found the Report Generator VIs are based on IE and didn't render the PDF very neatly.

 

LabVIEW: 2017 & 2012 in the zip file
PDF Creator: 2.3.0.103 (for 3.x the API changed slightly again)

     The .NET constructor is linked to the PDFCreator.exe.

     P.S. Check the PDF installation directory for sample scripts. Lots of info there too.

Lavag: Convert File Extension (Path).vi

Enjoy.

Message 4 of 14
(14,927 Views)

Your instructions got me 80-90% of the way there, thanks. But I could not link to PDFCreator.exe.

I found the following worked for me with ver3.2.0.

Maybe this will help the next person.
PDFConstructor setting.PNG

barry


0 Kudos
Message 5 of 14
(14,772 Views)

Agreed with the very first response, as long PDFCreator is a simple pdf printer, to send the file to print is everything you need to do in order to get the conversion done 🙂 But as far as I remember this very software has its shortcomings when it comes to LabVIEW, so some reports might well be exported with no proper scaling and fonts. And the very point of that is yo need to fix these things manually if they occurred. It's easy if you have editing tools like Acrobat Pro, but if not so, there's a cheaper one https://w9.pdffiller.com quite similar to that as we speak about the features, as well as has a free trial period long enough

0 Kudos
Message 6 of 14
(14,453 Views)

Hi

 

I am using PDFCreator to save my html report in pdf format, but every-time when LabVIEW save the HTML page as pdf the document contains the temporary file path in the footer.

how to avoid this and the link you have mentioned is expired i guess.

 

please give your suggestion,

 

Thanks in advance.

0 Kudos
Message 7 of 14
(7,346 Views)

Hi

I am using PDFCreator to save my html report in pdf format, but every-time when LabVIEW save the HTML page as pdf the document contains the temporary file path in the footer.

how to avoid this and the link you have mentioned is expired i guess.

please give your suggestion,

Thanks in advance.

0 Kudos
Message 8 of 14
(7,344 Views)

Hi,

since the link to the example doesn't work anymore, does somebody have any suggestions about how to use ActiveX to programmatically set the file path when printing to PDF, please?

Kind regards,

Alessia

0 Kudos
Message 9 of 14
(7,261 Views)

 Try the attached files, sorry it's been a while.

You must have the paid version of PDFCreator installed for this to work. It does not cost much.

This works with 3.2.0 version. Not tested on other versions.

 

Barry

barry


Download All
0 Kudos
Message 10 of 14
(7,253 Views)