|TechTip: More iSeries PDF Wizardry|
|Tips & Techniques - Document Management|
|Written by Giuseppe Costagliola|
|Thursday, 26 January 2006 18:00|
Note: If you haven't read "TechTip: Spooled Files and PDF, Part Three," where I introduced the iText library, you'll need to do so because these utilities rely on this Java class library. However, because we will use some new functionality that has recently been added to this library, you have to download the latest version, called the Early Access Version. The current Early Access Version at lowagie.com is itext-1.3.6.jar. But before downloading and using this Java library, please carefully read the iText License Agreement.
CRTJVAPGM CLSF('/pdf/ADDWMTXT.class') OPTIMIZE(40)
CRTJVAPGM CLSF('/pdf/CONCATPDF.class') OPTIMIZE(40)
CRTJVAPGM CLSF('/pdf/SCS2ITEXT.class') OPTIMIZE(40)
You are now ready to play with these new utilities.
ADDWMXPDF (Add Watermark/Page Number)
This utility can be used to stamp watermarks, such as "Confidential" on pages that include sensitive information, or "Draft" on a preliminary PDF to be distributed for review, or your company logo. In fact, you can even put one logo on the first page and a different logo on the following pages. In addition, you can add up to six lines of text to the first page. For example, you can add the recipient name and address and/or the document date. This date can be optionally editable and changed at printing time. And finally, you can put the page number.
ADDRESS(*YES) ADDRESSPOS(320 745)
ADDRESSLN(‘Name’ ‘Street’ ‘Town’ ‘Country’)
DATELN('February 4, 2005') DATEPOS(320 650) DATEEDIT(*YES)
PAGENBR(*YES) PAGENBRPOS(560 15)
ADDRESSPOS, DATEPOS, and PAGENBRPOS metrics use the standard Adobe PDF coordinate space. The origin of this space is at the bottom left of the document. Distances are measured up and to the right in points. Points are a traditional measure for print work; there are 72 points in an inch. In the example, the first line of the address is positioned 320 points from the left of the page and 745 points up from the bottom. The PdfCoordinates.gif enclosed in the download can help you find the coordinates where the text should be placed.
EXTPDF (Extract Pages from PDF)
This utility lets you split up one or more PDF documents based on page numbers and/or page ranges. By combining page numbers and ranges, you can specify which pages should be merged together to form a new PDF, like in the following examples:
This will extract pages 1 to 5, 10 to 12, and 15 to 17.
You can specify both page numbers and ranges like this:
This will extract pages 1, 3, 5, 15, 16, 17.
You can also extract pages going backward:
CONCATPDF (Concatenate PDF)
This utility lets you merge up to 64 PDFs into one final PDF document. Pages from multiple input documents are sequentially copied (appended) into a new output document. Here's an example:
Giuseppe Costagliola is a programmer in Turin, Italy. You can reach him at firstname.lastname@example.org.
|Last Updated on Tuesday, 19 October 2010 10:58|