PDF/FOP with Natural For Ajax

Hi All,

For those who would like to learn more about PDF support, here are some hints:

NJX supports 2 ways to use PDF with Natural for AJAX:

  1. REPORT control (see the Natural for AJAX documentation):
    That’s the way which requires more programming on the Natural side. You have to fill the report yourself at runtime.
    The njxdemos contain an example for this: Start the njxdemos and select Reporting/Report.

  2. Adapter Listener (com.softwareag.cis.server.adapterlistener.PDFFOPListener)
    That’s the way which requires nearly no programming on the Natural side. You do the report design at design time: Create an PDF Print Form layout in Layout Painter.
    NJX812 contains an example for this. Since NJX812 is not available yet, please find attached a simple example to get started:

Explanation:
* The PDF_FOP_Demo.xml  is a normal NATPAGE layout in which the Adapter Listener com.softwareag.cis.server.adapterlistener.PDFFOPListener is set.
* PDF_FOP_Demo_fop.xml is a PDF Print Form. It is bound to the NATPAGE via naming conventions: same name + "_fop"
* The texts in the print form are also directly bound to fields in the NATPAGE via naming convention: Search for example for "fromFirstName" in both layouts.

How to run it:
* Copy the 2 attached layouts
* Do the Natural Adapter/html generation in the usual way
* For PDF_FOP_Demo_fop.xml  no Natural Adapter will be generated because it is a PDF Print Form.
* For PDF_FOP_Demo.xml  an Natural Adapter PDF-8.NS8 will be generated
* Generate a corresponding Natural Programm for PDF-8.NS8 in the usual way.
* You do not have to write any code: Simply run your main program, enter some values and press the "Generate Invoice" button.

Best Regards,
Christine
PDF_FOP_Demo_fop.xml (10.6 KB)
PDF_FOP_Demo.xml (4.94 KB)

Hi,

I have looked at the way the Report control works and was wondering if there is a way of using one button to generate the Report and either Print or create a PDF instead of using two buttons?

Let me explain in more detail. In the example provided in NaturalOne the page has three buttons on it, one to Fill the Report, on to Generate a PDF and one to Print the Report. In order to get things to work you have to click the Fill the Report button and then click either the PDF or Print button. What I/we want to do is to allow our users to fill out a screen and then, if they wish, Print the screen out. Is it possible to get one button to both create the Report structure and perform the Print function? I have tried but it doesn’t seem to do what I want.

Thanks
Matt