PDF 100% in PL/SQL, right inside Oracle Database

Generate, edit, merge and encrypt PDFs without leaving the database — no Java, no middleware, no external dependencies. One installer, one deploy.

v3.4.0 Oracle 19c+ MIT licence Automated CI PIX & Boleto
report.sql — SQL*Plus
DECLARE
  l_pdf BLOB;
BEGIN
  -- create the document inside the database
  PL_FPDF.Init('P', 'mm', 'A4');
  PL_FPDF.AddPage();
  PL_FPDF.SetFont('Arial', 'B', 16);
  PL_FPDF.Cell(0, 10, 'Hello, World!', '0', 1, 'C');

  -- password protection and permissions
  l_pdf := PL_FPDF.EncryptPDF(
    p_pdf        => PL_FPDF.OutputBlob(),
    p_encryption => 'AES-256');
END;
Lineage. The generation core descends from the PL/SQL port by Pierre-Gilles Levallois, who brought Olivier Plathey's FPDF to Oracle — that is where the API you may already know comes from. On top of it, @Maxwbh has maintained a project of its own since 2019: PDF manipulation, PDF 1.5+ reading, AES-256 encryption, DEFLATE and INFLATE written in PL/SQL, and the PIX/Boleto extension.
3.4.0current version
170automated checks
2files to deploy
0external dependencies

Features

Everything your report needs, inside the database

From generating the document to protecting it — every step runs as pure PL/SQL, ready for triggers, jobs, APEX and APIs.

Runs inside the database

No application server, no Java Stored Procedures — build the PDF in the trigger, job or PL/SQL API itself.

Edits existing PDFs

Load, rotate, watermark, merge and split finished PDFs, including PDF 1.5+ with xref and object streams. Limits in the compatibility guide.

AES-256 security

AES-256, AES-128 or RC4 encryption, with user/owner passwords and permission control: print, copy, edit.

PIX and Boleto

Optional extension for PIX QR Codes (EMV) and FEBRABAN Boleto slips — the two Brazilian payment standards.

Zero dependencies

No Java, OWA, OrdImage or third-party libraries. Two PL/SQL packages, PL_FPDF and PL_FPDF_UTIL, in a single SQL installer.

Open source (MIT)

Open code, with automated CI, versioned releases and a documented history.

Examples

From nothing to a PDF in half a dozen lines

The same API covers creating new documents and editing existing files.

create_pdf.sql
DECLARE
  l_pdf BLOB;
BEGIN
  PL_FPDF.Init('P', 'mm', 'A4');
  PL_FPDF.AddPage();
  PL_FPDF.SetFont('Arial', 'B', 16);
  PL_FPDF.Cell(0, 10, 'Hello, World!',
               '0', 1, 'C');

  l_pdf := PL_FPDF.OutputBlob();
  -- and it is yours: store it, send it, return it
  INSERT INTO documents (pdf) VALUES (l_pdf);
END;
edit_pdf.sql
DECLARE
  l_pdf BLOB;
BEGIN
  SELECT pdf_blob INTO l_pdf
    FROM documents WHERE id = 1;

  PL_FPDF.LoadPDF(l_pdf);
  PL_FPDF.RotatePage(1, 90);
  PL_FPDF.AddWatermark('CONFIDENTIAL', 0.3);
  l_pdf := PL_FPDF.OutputModifiedPDF();
END;

And when the document is hard: the layout of a Boleto

An A4 page, three Helvetica variants in four sizes, 50 boxes positioned to the millimetre across two copies, the money column right-aligned, and the 44-digit ITF barcode a bank scanner actually reads. Not a single image — logo, rules and bars are vector drawing, the way a real Boleto is made. (A Boleto is the Brazilian bank payment slip.)

Bank Boleto generated by PL_FPDF: two copies, a grid of fields and an ITF barcode

Real output of examples/boleto.sql, produced inside Oracle. The 44 barcode digits arrive ready-made — PL_FPDF draws; computing the charge is somebody else's job.

boleto.sql
-- tiny label on top, value underneath
PL_FPDF.Rect(px, py, pw, ph, 'D');
PL_FPDF.SetFont('Arial', '', 6);
PL_FPDF.SetXY(px, py + 0.7);
PL_FPDF.Cell(pw, 2.4, protulo, '0', 0, 'L');

PL_FPDF.SetFont('Arial', 'B', 9);
PL_FPDF.SetXY(px, py + 3.2);
PL_FPDF.Cell(pw, 3.4, pvalor, '0', 0, 'R');
barcode.sql
-- 103 x 13 mm, as FEBRABAN requires
PL_FPDF.AddBarcode(
  16.5, 233, 103, 13,
  '34197167700000150001' ||
  '090000012323073123451000',
  'ITF', FALSE);

-- and the PDF comes out here, from the database
l_pdf := PL_FPDF.OutputBlob();

See the full example

And its colourful sibling: an event ticket

The Boleto proves the grid. The ticket proves the rest: colour — a filled band with white text over it, grey panels —, a QR Code and a Code 39 on the same page saying the same code, one page per ticket, and a shape that is not a rectangle: the little tail of the speech bubble. Again, not a single image.

Event ticket generated by PL_FPDF: colourful header, QR Code and barcode

Real output of examples/ticket.sql, produced inside Oracle.

colours.sql
-- colourful panel, and the title in white
PL_FPDF.SetFillColor(13, 25, 44);
PL_FPDF.Rect(12, 13.5, 186, 36, 'F');

PL_FPDF.SetTextColor(255, 255, 255);
PL_FPDF.SetFont('Arial', 'B', 17);
PL_FPDF.SetXY(16, 18);
PL_FPDF.Cell(178, 9, l_title, '0', 0, 'L');
symbols.sql
-- the same code in two symbologies,
-- to be scanned at the gate
PL_FPDF.AddQRCode(
  p_x => 156, p_y => 58,
  p_size => 32, p_data => l_code);

PL_FPDF.AddBarcode(
  45, 117, 120, 10,
  l_code, 'CODE39', FALSE);

See the ticket example

Install

Three steps and it is running

Works on Oracle 19c or later. No object other than the packages is created. Upgrading, installing into another schema and uninstalling are in the installation guide.

Download one file

No clone: the whole installer in a single .sql, with its SHA-256 beside it.

Download version 3.4.0

The latest stable version — GitHub's “latest” never includes pre-releases.

Run it

Open it in a SQL Window (F8) or run it in SQL*Plus. Plain SQL — no tool-specific command.

@pl_fpdf_install.sql

Check the version

The version shows in the Output tab, with DBMS_OUTPUT enabled (in SQL*Plus, SET SERVEROUTPUT ON). Ready to produce the first PDF.

BEGIN DBMS_OUTPUT.PUT_LINE(PL_FPDF.co_version); END; / -- 3.4.0

Pin the version for production. The link above always serves the newest one — fine to try it out, wrong for a change ticket. Every version has its own immutable URL on the releases page, with a SHA256.txt beside it to verify what you downloaded:

curl -LO https://github.com/Maxwbh/pl_fpdf/releases/download/v3.4.0/pl_fpdf_install.sql curl -LO https://github.com/Maxwbh/pl_fpdf/releases/download/v3.4.0/SHA256.txt sha256sum -c SHA256.txt

Found it useful? Leave a star ⭐

Stars make the project easier to find for other Oracle developers — and they are the best way to support the work.