PL/DOC
PDF and EPUB document generation for Oracle
Compose business documents directly in PL/SQL. Use one document definition to generate PDF and fixed-layout EPUB, with reusable styles, Unicode text, tables, images and automatic pagination.
One document definition, two output formats
Keep document composition close to your Oracle data and business logic.
PL/DOC provides a high-level PL/SQL API for building structured documents. Define the page, register fonts, apply styles and add content. The layout engine handles text flow and pagination.
Seal the document once, then render PDF, fixed-layout EPUB or both. Return the output as Oracle BLOBs for your application to store, stream or export.
Typical documents
- Invoices and multipage line-item documents
- Reports, statements and summaries
- Product catalogs and information packs
- Manuals and other paged publications
- Business letters and application-generated documents
Document features
A practical composition API for documents generated from Oracle data.
Layout and pagination
Compose boxes and column layouts, set page dimensions and margins, add fixed headers and footers, and control page breaks and keep-together behavior.
Tables and lists
Build tables with repeated headers, final footer rows, alignment and column spans. Add bullet lists, numbered lists and structured items.
Styles and Unicode fonts
Reuse named styles and inheritance. Register TrueType font families and faces for Unicode text, including DejaVu fonts with suitable glyph coverage.
Rich text and links
Combine styled text runs, hyperlinks and page-number placeholders. Use VARCHAR2 or CLOB content for short paragraphs and longer documents.
Images and fitting
Place prepared image assets in your document. Choose contain, cover, stretch or intrinsic fitting to suit the available space.
PDF output options
Generate standard PDF or PDF/A-3B. Choose automatic, full or subset TrueType embedding according to the output requirements and font permissions.
A simple document lifecycle
1. Create and style
Create the document, choose page settings, register font and image assets, and define reusable styles.
2. Compose the content
Add text, images, tables, lists and containers. Build content from application data while the layout engine manages the document flow.
3. Seal and render
Close the content scopes, seal the document and render the required formats. Deliver the returned BLOBs and release the resources.
A clear PL/SQL API
Use PL_DOC_API to compose the document and render both formats from the same sealed source.
The fragment below uses l_doc as PL_DOC_API.T_DOCUMENT and l_pdf and l_epub as BLOB variables. The DejaVu Sans catalog asset is included in the demo kit.
l_doc := pl_doc_api.create_document(
p_title => 'Monthly report', p_author => 'My application');
pl_doc_api.register_font(l_doc,
'pl_doc_demo/DejaVuSans.ttf', 'DejaVu');
pl_doc_api.define_style(l_doc, 'body', pl_doc_api.style_spec(
p_font_name => 'DejaVu', p_font_size => '11pt'));
pl_doc_api.text(l_doc, 'Created from Oracle data.',
p_style => 'body');
pl_doc_api.seal(l_doc);
l_pdf := pl_doc_api.render_pdf(l_doc);
l_epub := pl_doc_api.render_epub(l_doc,
p_identifier => 'urn:example:monthly-report');
-- Store or stream the output BLOBs here, before cleanup.
dbms_lob.freetemporary(l_pdf);
dbms_lob.freetemporary(l_epub);
pl_doc_api.free_document(l_doc);
Add exception-safe cleanup when integrating this sequence into an application. The API returns BLOBs; saving files or delivering downloads is handled by your application.
Explore the API with working examples
The demo kit contains 19 separate PL/SQL examples, each focused on a document feature or use case.
Start with a minimal document, then explore styles, Unicode text, image fitting, tables, rich text, lists and paged invoices. Additional examples cover custom page geometry, table footers, long CLOB content, PDF/A-3B and font embedding.
Included in the demo
- A separate procedure for each example
- PDF and EPUB output examples
- Same-source PDF and EPUB rendering
- Font, image and stylesheet fixtures
- Install, run, export and uninstall SQL scripts
- API documentation and feature guidance
Designed for Oracle applications
Application integration
Call PL_DOC_API from stored PL/SQL, database jobs, Oracle APEX or other applications that invoke Oracle procedures. Keep control of the data, document construction and output delivery in your application.
Unicode and font assets
Register the TrueType faces used by the document, including bold and italic variants where needed. Choose fonts containing the characters required by your languages and content.
PDF/A-3B output
Archival output requires suitable embedded fonts and a configured RGB ICC profile. Validate the final document against the profile required by your workflow.
Fixed-layout EPUB
EPUB output preserves the document pages and geometry. Check the publication in the intended reader applications, because fixed-layout display and reader features can vary.
Try PL/DOC
Bring PDF and EPUB generation into your Oracle workflows. Request an evaluation kit, the API guide and the demo package, or contact us about your document requirements.
