LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Occasional Nugget 05/13/2014

Having the ability to generate PDF files from LabVIEW is a rather common requestI recently discovered a very simple way to generate PDFs from LabVIEW with a quick modification to some existing NI software. First, you must have the following products installed:

 

  • LabVIEW 2009 or later
  • LabVIEW Report Generation Toolkit for Microsoft Office 2009 or later
  • Microsoft Word 2007 or later

If you have all of this software, then open vi.lib\addons\_office\_wordsub.llb\Word_Save_Document.vi and make the following modification:

 

1.png

 

More specifically, add the ".pdf" case with a value of "17" inside. Now, if you wire the path to a PDF file to the Save Report to File.vi for a Word report, then a PDF file will be generated:

 

2.png

 

We will try to get this change into the Report Generation Toolkit in a future version. I realize that this trick doesn't solve all the use cases (like PDF generation on a system without Word installed), but I'm hoping that it can help out some people today.

Message 1 of 11
(11,355 Views)

Hello Darren,

 

I wonder if this tricks works for a Excel report as well.

 

UliB

0 Kudos
Message 2 of 11
(11,260 Views)

Or if you don't have Report Generation Toolkit for Microsoft Office (which, I think, is not so cheap) you can just simply install PDF Creator and use it as a printer in Easy Text Report.vi 🙂 Solution with some faults but cheaper...

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.
Message 3 of 11
(11,163 Views)

@UliB wrote:

 

I wonder if this tricks works for a Excel report as well.


Yes, I was able to get it to work with Excel with a similar edit to vi.lib\addons\_office\_exclsub.llb\Excel_Save_Workbook.vi. Some things to keep in mind:

 

  • For Excel 2010 and later, the numeric value inside the ".pdf" case would be 57.
  • For Excel 2007, I think you would need to first install the Microsoft Save as PDF or XPS add-in.
  • For Excel 2007, I think the numeric value inside the ".pdf" case would be -1.

 

I'm not 100% sure about the Excel 2007 scenario, because I didn't have a test machine available to try it out. But for Excel 2010 and later, it definitely works.

Message 4 of 11
(11,136 Views)

run this vi,i have an error code 1498,how to solve it

0 Kudos
Message 5 of 11
(11,034 Views)

@happy_learning wrote:

run this vi,i have an error code 1498,how to solve it


How does this have anything to do with this thread?  Go to the main menu of the LabVIEW forum and click on the "New Message" button located to the left, just above the list of topics.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 11
(10,925 Views)

@happy_learning wrote:

run this vi,i have an error code 1498,how to solve it


Have you installed the Report Generation Toolkit?

 

 

George Zou
0 Kudos
Message 7 of 11
(10,885 Views)

Seeing as the RGT is LVOOP based, technically you could just extend it without having to modify existing toolkit funcitonality, which would then break if someone loaded the code on a different machine without this instance of the "save" in vi.lib

Message 8 of 11
(10,836 Views)

FYI to anyone still following this thread, I'm happy to announce that these changes have made it into the Report Generation Toolkit for LabVIEW 2015 and later.

Message 9 of 11
(7,615 Views)

Yes great, thanks a million Darren.  I am using this capability to save excel pdf files using the RGT.  My only problem is that it does not seem to save multipage workbooks.  Is there a workaround for this?

0 Kudos
Message 10 of 11
(5,997 Views)