create pdf from natural

About 1 year ago I was able to create a simple PDF page from a Natural program in NJX. However, when I ran the program again today (under new versions of NJX and JBOSS), the program abended. I am not sure what changed. I tried to regen the layouts in the layout painter of application designer and check all I could to see what changed. Nothing has changed in terms of the programs or layouts since the last time I ran the program a number of months ago.

I did notice that in the log the following warning occurs (when saving the FOP layout

[FONode] table-layout=“fixed” and column-width unspecified => falling back to proportional-column-width(1)
[ElementMappingRegistry] Unknown formatting object ^column

When I run the program I get the following:

java.lang.NullPointerException

Also, does anyone have a step by step guide on how to create PDF docs from Natural? I am a little confused by some of the options. For example, in the program that I did last year, the PDF and the layout contained the same fields. However, in the current situation that I am coding, I do not really want to make the user see the entire screen before creating the PDF (long story, but it makes sense for the application).

thanks.

Demos

Hi Demos,

The first versions of NJX contained an older Apache FOP version. The newer versions are stricter regarding missing child elements or missing width specifications.
In your layout probably a child or width specification is missing. I am surprised that you don’t see an error in the protocol file.

Not sure if I understood your use-case regarding visibility: If you would like to hide controls of your NATPAGE layout and only show them after the PDF has been created, you could use the “VISIBLEPROP”, for instance in controls like ROWAREA. When your PDF-generation button is pressed you would change the value.

Did you have a look at the chapter “PDF and FOP Services” in the Application Designer documentation?

Best Regards,
Christine

Hi Christine

Thanks for your reply. I see your point about the using the VISIBLEPROP - that will work well.

I have read through the chapter on PDF and FOP services a number of times. However, I am driving the applications 100% from Natural and am not doing any JAVA at the moment. I was hoping that there would a step by step guide somewhere on how to set up and print PDF docs using just Natural.

Being able to produce PDF docs from mainframe data (Adabas) is a huge area of interest at my organization.

Have been following the REPORT example in SYSEXNJX (program: CTRREP-P), but was hoping there would be a different way to create PDF. I guess not. What I would like to suggest for an area of for future R&D is to be able to print any screen to a PDF. In other words, we have a control on the page that will allow the printing of whatever is on the page to a PDF. Perhaps it works like that now, but I am having trouble getting it work.

Thanks

Demos

Check out some of the free PDF printer drivers (SourceForge PDFCreator, FreePDF, etc). These allow you to define a “printer” that prints to PDF. For example, this lets you turn any web page into a PDF.

I believe there are also several products (Dazel is one) that supports PDF output from the mainframe.

Hi Douglas

Thanks for your suggestions. I looked into the info you mentioned and I think there is a lot of potential there. The one challlange I face is that using open source software is a bit a challenge (unless SAG vets it of course). My superiors are wary of allowing open source onto our network unless it goes through long vetting process etc. I guess this might be true for a number of sites out there.

The one product that seems to have a lot of potential is itext (http://en.wikipedia.org/wiki/IText). I am not sure how we could integrate this into the JBOSS application server, but itext seems to be a mature product and widely used. Howerver, the FOP part that comes with NJX does almost the same thing (although itext seems to have a lot more flexibility).

I guess I was looking for an easy solution. I was hoping to be able to produce reports and prints as easily from the NJX environment as one does from a regular 3270 type Natural environment. Perhaps one day… :slight_smile:

Regards

Demos

Hi Demos,

The fop framework, which is integrated into NJX, is the Apache implementation of FOP: http://xmlgraphics.apache.org/fop/.

Application Designer / NJX has wrapped this framework via a corresponding FOPPAGE layout and a set of corresponding controls to allow descriptive designing of the PDF documents.

For NATPAGEs the currently supported way without implementing Java is to add a corresponding FOPPAGE to your NATPAGE. In this FOPPAGE you design the rendering of the PDF document.
As an alternative you could also write your own Adapter Listener and use the PDF/FOP API to build the PDF document. But this would mean to implement Java.

I agree:
A control, which automatically generates a “default PDF document” for a NATPAGE layout would be a nice feature.
Also a “step-by-step” guide for building/customizing PDF-documents.

Best Regards,
Christine