Saturday, June 2, 2018

How to Generate the PDF Report through LabVIEW

There has been a previous sister article (reply the key word "WORD" to get this sister article - editor's note: This article is reproduced from the WeChat public number "LabVIEW-Jobs", so you need to reply to the public number.) It's about how to read the contents of MS WORD documents through LabVIEW. At the end of the article, there is a primer that LabVIEW can also complete the production of MS WORD documents and PDF format documents. PDF is a very complex format, so here are some tools to achieve our goals. It's also from the story of a sister article, a PDF format report generated by a customer's production test software, which solved the read problem and thought how it was generated. After looking at every corner of the software, the key word "itextsharp©" seems to be related, finding the source through a search - itextsharp© is indeed an open source library that specializes in dealing with PDF. Those who are interested can learn more about this library.

 

Itextsharp© free open source library, the main tool of this article. It has served tens of thousands of people, and it is necessary to briefly introduce the source. At present, the open source library has been published on two major hosting platforms: https://github.com/itext/itextsharp and https://sourceforge.net/projects/itextsharp/, which are interested in going in and worshipping the big gods--the great people. The details are not introduced. Let me explain the copyright license of this tool. Itextsharp© is completely free, before the fourth edition is the open source MPL and LGPL protocol, the popular free freedom of open source, whether your own project is open source or closed source. After the 4.2 version, itextsharp© is still open source, but you must also open your own project, that is, the AGPL protocol. And commercial projects unwilling to open source must purchase copyrights, and names become iText© (Fifth Edition), no longer itextsharp. As you can see from the screenshot below, we use the 4.1.6.0 version, which should be without copyright.


 

Even if you get this open source library, further integration into LabVIEW® is very tedious, since there are a lot of parameters to be configured. So here we want to introduce another LabVIEW-based toolkit which called Exaprom PDF. This toolkit developed based on our previous itextsharp© by a Canadian company. Since itextsharp© is open source, Exaprom PDF is also open source, BSD protocol.

 

First download the toolkit, the download and installation instructions are at: https://decibel.ni.com/content/docs/DOC-10952. The author (Jean-Marc Simard, who is also a great god) posted on the NI forum and can see that he has been maintaining and is still answering some questions from the user. The following is basically a porter. The author produced two versions:

2013 version download address: https://forums.ni.com/ni/attachments/ni/3046/11150/4/Exaprom%20PDF2.0%20(LV2013).zip; 2009 version Download address: https://forums.ni.com/ni/attachments/ni/3046/11150/6/Exaprom%20PDF2.0%20(LV2009).zip. After downloading the archive, unzip it to get a folder and a file, as shown in the following figure: One is the .VI code package, and the other .mnu file is the menu file.


 

 

Next, place them in the specified directory: C:\Program Files\National Instruments\LabVIEW Version\vi.lib\ (Maybe it is a little different upon your Windows® OS version) Place the code folder here, refer to the below screenshot.


 

Then place the menu file, as shown in the following screenshot: C:\Program Files\National Instruments\LabVIEW Version\menus\Categories\Programming\, (maybe a little different upon your Windows OS version) as the name implies, it knows the specific location.

 

After you place all files into the specific locations and restart LabVIEW, you can see that the function panel has loaded all PDF-related functions. As shown the below:

 

Reading here, you should feel a lot of peace of mind. The author developed this toolkit entirely based on LabVIEW® and NI style and it very easy to use and start. In addition, you can also find that the author (Great God) has complete copyright notice information in each function's program panel and Help page - both itextsharp's copyright statement and the author's own BSD copyright notice.

 

Finally, is it feeling less or missing? Yes, it seems that there is no user instruction? In fact, the author has provided the very detailed help information for every function, as well as a very detailed user manual. The author is very clever to integrate the entire user manual into a VI. It is the function VI labeled in the next screenshot. After opening and running, it will generate a 43 page PDF document, which is a lot of pictures and text, and the User Manual.vi is full of the creation of the text and various instances of the PDF document. Just imagine: an example has generated an PDF document with 43 pages of illustrations. What else can't be done? If there is a higher requirement, or the discovery of bug, it can interact with the original author at the place where the article is published, and it can basically solve the general problem. Of course, with the progress of technology, PDF is also a further development, but it can be seen that copyright considerations, the author does not upgrade the itestsharp©, and can not be upgraded in the existing mode.


 

 

It is over here. It can be said that in addition to the author (myself) introduced this artifact(toolkit), and talked about copyright issues many times. It also promotes a kind of copyright awareness. Even if it is free and open source software, it is also required the agreement, such as signature, re-open source and so on. Therefore, if the software is developed through this article, not expect to label the copyright agreement everywhere, at least the copyright notice of itestsharp and Exaprom PDF is marked on the copyright page of the software. Again, the toolkit mentioned in this article can be used for closed-source commercial purposes without paying fees, and only the developer's copyright information needs to be retained. Well, the spread of this article also requested to retain the source and signature - WeChat® public number: LabVIEW-Jobs :-)

 

Reference:

1. https://decibel.ni.com/content/docs/DOC-10952 (Exaprom PDF release page)

2. Https://itextpdf.com/ (itestsharp official website)

3. Https://sourceforge.net/projects/itextsharp/ (itestsharp source code shared release page)

 

Note: This article is translated and reprinted from WeChat public account--LabVIEW-Jobs, please follow this WeChat public number for the original source inquiry. And any question about this article, please also contact with author by email support@itestgroup.com

 


No comments:

Post a Comment