Page 1 of 1

PDF Generation

Posted: Thu Jun 30, 2016 5:27 pm
by James-S
The most popular way to generate PDF's from RPG is to create a spool file then transform it to PDF and place on the IFS. With Profound being a web client interface the reporting output needs to be more modern look and not a legacy line printer form. AFP allows for the modern output but the coding is tedious and time consuming. Looking for a report generator (open source preferred) that can take data from RPG (xml, json, etc.) and generate a PDF document. Additionally, any integration with Profound would be great too.

Re: PDF Generation

Posted: Fri Jul 01, 2016 10:26 am
by Glenn
I don't have a whole lot of experience in generating PDFs, but I've heard good things about PDFLIB (http://www.pdflib.com/download/pdflib-family/pdflib-9/).

Glenn

Re: PDF Generation

Posted: Fri Jul 01, 2016 11:00 am
by Scott Klement
PDFLIB works very nicely, but it is not a report generator. It is a set of routines for building a PDF file directly. In other words, instead of creating an AFP document first and then converting it to PDF (which limits you to the "lowest common denominator" of the two technologies) you can call the routines in PDFLIB to generate a PDF natively with all the features that PDF can support.

PDFLIB runs on just about any platform, including IBM i, and is very efficient and powerful. There is definitely a learning curve to using it, though... much like calling APIs. PDFLIB is commercial software.

There is a Java package called iText that is similar to PDFLIB, but is open source. I don't like iText as much as PDFLIB, it is slower and clumsier to work with, but it is free.

Both of these options are NOT report generators, though. They're just sets of routines for making PDFs that you can call from your IBM i application (such as RPG) to generate PDFs. If you find AFP to be tedious and time consuming, I doubt that PDFLIB (or iText) would be any better. In fact, I suspect you'd find these tools to be worse in that respect.

For a report generator, off the top of my head, I know of New Generation Software (NGS) http://www.ngsi.com/company/index.html and also DB2 Web Query (I don't have a link for it -- I found it to be slow and a bit clumsy when I tried it years ago). Both are commercial tools. I do not know of an open source report generation software.

Profound UI integrates the same way with any PDF or report generator tool. It gives you an API that you can use to open a report from the browser, and an exit program where you can call the code to generate the report/pdf/whatever for it to download.

Re: PDF Generation

Posted: Fri Jul 01, 2016 12:16 pm
by James-S
Instead of "report generator" a better term may be "data transformation into PDF". Something like, taking like HTML data and convert to PDF. Using an HTML designer to build the HTML code. Copy the HTML code into a universal display file with dynamic data fields and generate the HTML from RPG. Then using a transform utility to generate the PDF from HTML. This would take work like AFP but after building AFP in DDS I hope to find something more WYSWIG and less trial and error as AFP DDS.

In our web development Java group, they are using a product call Jasper Reports (http://community.jaspersoft.com/project ... ts-library) along with Jasper Studio (http://community.jaspersoft.com/project ... oft-studio). Both open-source and licensed are available. It is a Java based application and would expect it to be able to run on System i. It does use Java classes to interface so RPG Java class development would be a consideration.

Re: PDF Generation

Posted: Thu Aug 04, 2016 2:11 pm
by James-S
Update: I downloaded the open-source Jasper Reports Library and implemented on the System i. Jasper Reports supports various input formats (SQL, XML, JSON...) which I used XML for input and was able to successfully create a PDF file on the IFS. I also encapsulated the required Jasper Report Library class file within RPG. Now my next step is to determine where within the Profound display file to place the pui.download api code to have the PDF file automatically show in a browser window without any user interaction. My goal is just have the user click a "Print" button and the browser window appear without further interaction.

Re: PDF Generation

Posted: Fri Aug 05, 2016 3:47 pm
by Glenn
James,

You could easily integrate our pui.download() API with a "print" button.

The page below shows an example of the API call you might put on the 'onclick' event of the button (see the example that mentions "itemrpt").
http://www.profoundlogic.com/docs/pages ... d=10092549

Here's some more info on the PUIDNLEXIT exit point you will need to code to allow the download.
http://www.profoundlogic.com/docs/pages ... d=10092551

Glenn