Introduction:
PL/PDF is a PL/SQL package collection that you can use to create PDF files. Easy to integrate with Oracle APEX, it can be called from a Page or Application Process in Oracle Apex. No additional hardware is required, PL/PDF installs into the same database as APEX i.e. Oracle.
PL/PDF Features:
- Robust reporting engine
- Charts
- Bar, Line & Pie
- Barcode Printing
- Use Existing PDF files as Templates
- TrueType Font Embedding
- Encrypted PDF Documents
- Native Support for PNG & JPEG images
Basic Methods:
- Init() – Called once to initialize PL/PDF
- Parameters – p_orientation, p_unit, p_format
- newPage() – Creates a new page
- Parameters – p_orientation
Initialising PL/PDF:
Get the Template
SELECT blob_content INTO l_template_pdf
FROM wwv_flow_files
WHERE filename = 'MyTemplate.pdf' ;
l_template := plpdf_parser.getTemplate(l_template_pdf,1);
— Initialize PL/PDF
plpdf.init(p_format => ‘letter’);
l_template_id := plpdf.InsTemplate(l_template);
CREATE a NEW page plpdf.NewPage;
Place the TEMPLATE ON the page plpdf.useTemplate(l_template_id);
- setCurrentXY() – Sets the position of the cursor
- Parameters – p_x, p_y, Similar: setCurrentX, setCurrentY
- setPrintFont() – Sets the font family and style used for text
- Parameters – p_family, p_style, p_size
- PrintCell() : Print line of text on page.
- Parameters – P_w, P_h, P_txt, P_border, p_in, P_align, P_fill, P_link, P_Clipping
Sample Example Output:
In our example we have implemented “Barcode Printing” with PL/PDF using Code39 Procedure from PLPDF_BARCODE package.We are Printing Barcode for the Text “E150305” which is representing Employee’s Identity Number.There are other variants available with same like e.g (EAN13,UPC_A,B2OF5,QRCODE) Barcodes.
Sample Code Highlights :
Other Usages
Template feature in PLPDF allows you to use any tool to create the structure of a document and use PL/PDF APIs only to populate the data,This way you can focus on filling in the data instead of actually creating structure of document through PL/PDF which is time consuming approach.So using Template feature one can Automate form filling using dynamic data from the Database.Below are few examples of this approach,
Essentially, PL/PDF is a series of calls to PL/PDF procedures and functions from a PL/SQL script, package, procedure or function. If you are not familiar with the PL/SQL programming language, study the Oracle documentation.
Please choose appropriate version of PLPDF as per Oracle Database version.You can download trial version of PLPDF from http://plpdf.com/downloads-v2.php.
Download sample code from zCon Solutions Github Repo
Written by Dhananjay Nandgaonkar ,Sr. Software Engg. at zCon Solutions