v3.4.0 · Oracle 19c+
API Usage Index
Every official PL_FPDF feature — what each one does and how to call it. Full parameter and error detail in the API reference.
How to pass parameters: every API accepts positional notation
(Cell(0, 10, 'Hello', '1', 1, 'C')) or named
(Cell(pw => 0, ph => 10, ptxt => 'Hello', palign => 'C')) — named is the
recommended one. Parameters with a default may be omitted; measurements use the unit
given to Init; colours are RGB 0–255; page ranges accept 'ALL' or
'1,3-5,21-'; extra options travel in a JSON_OBJECT_T.
The examples are snippets: they run inside a PL/SQL block, after Init and
AddPage, with the l_ variables declared; whatever depends on an object of
yours (a table, a header procedure) says so in its comment. Each API name leads to the full reference.
01 Life cycle
Every document starts with Init; the state lives in the session (package-only).
| API | What it does |
|---|---|
| Init(orient, unit, format, encoding) | Starts a document: 'P'/'L' · mm/cm/pt/in · A3/A4/A5/Letter/Legal · UTF-8 |
| Reset | Clears the state and frees temporary CLOBs |
| IsInitialized | TRUE if a document is in progress |
| co_version | Constant holding the installed version |
DECLARE l_pdf BLOB; BEGIN PL_FPDF.Init( p_orientation => 'P', -- 'P' portrait | 'L' landscape p_unit => 'mm', -- 'mm' | 'cm' | 'pt' | 'in' p_format => 'A4'); -- 'A4' | 'A3' | 'A5' | 'Letter' | 'Legal' PL_FPDF.AddPage(); PL_FPDF.SetFont('Arial', 'B', 16); -- family, style ''/B/I/BI/U, size in pt PL_FPDF.Cell(0, 10, 'Hello, World!', '0', 1, 'C'); l_pdf := PL_FPDF.OutputBlob(); END;
02 Pages and positioning
| API | What it does |
|---|---|
| AddPage(orient, format, rotation) | New page; NULL inherits from Init; rotation 0/90/180/270 |
| SetPage(n) · GetCurrentPage · PageNo | Go back to an existing page · active page · current number |
| SetMargins(l,t,r) and variants | Margins (SetLeftMargin / SetTopMargin / SetRightMargin) |
| SetAutoPageBreak(auto, margin) | Automatic break on reaching the bottom margin |
| Ln(h) · GetX/SetX · GetY/SetY · SetXY | Control of the writing cursor |
PL_FPDF.SetMargins(left => 20, top => 15, right => 20); -- right omitted = same as left PL_FPDF.SetAutoPageBreak(pauto => TRUE, pMargin => 15); -- breaks 15mm from the bottom PL_FPDF.AddPage(p_orientation => 'L'); -- only what changes; the rest inherits from Init PL_FPDF.SetXY(x => 20, y => 40); -- cursor in the document unit
03 Fonts and UTF-8
| API | What it does |
|---|---|
| SetFont(family, style, size) | Core: Arial/Helvetica, Times, Courier · styles '', B, I, BI, U |
| SetFontSize(pt) | Changes the size only |
| AddTTFFont(name, blob, enc, embed) | TrueType from a BLOB, with embedding |
| LoadTTFFromFile(name, file, directory) | TrueType from an Oracle DIRECTORY |
| IsTTFFontLoaded · GetTTFFontInfo · ClearTTFFontCache | Font cache management |
04 Writing text
| API | What it does |
|---|---|
| Cell(w,h,txt,border,ln,align,fill,link) | Rectangular block — the most used API |
| MultiCell(w,h,txt,border,align,fill) | Paragraph with automatic wrapping (the function returns the line count) |
| Write(h, txt, link) | Inline flowing text (mix fonts mid-sentence) |
| Text(x, y, txt) | Absolute position, without moving the cursor |
| CellRotated(...) · WriteRotated(...) | Text rotated 0/90/180/270 |
| GetStringWidth(txt) · SetLineSpacing | Measuring in order to centre · line spacing |
PL_FPDF.Cell( pw => 0, -- width; 0 = up to the right margin ph => 10, -- cell height ptxt => 'Total: 1,234.56', pborder => 'LTB', -- '0' | '1' | any combination of L,T,R,B pln => 1, -- 0 cursor to the right | 1 next line | 2 below palign => 'R', -- 'L' | 'C' | 'R' pfill => 1, -- 1 = background in the SetFillColor colour plink => ''); -- URL; internal links do not exist (-20601) l_lines := PL_FPDF.MultiCell(0, 6, l_paragraph, '1', 'J'); -- 'J' justified; returns the line count PL_FPDF.CellRotated(40, 10, 'VERTICAL', p_rotation => 90); -- 0/90/180/270
05 Colours and drawing
| API | What it does |
|---|---|
| SetDrawColor / SetFillColor / SetTextColor (r,g,b) | RGB 0–255 colours for stroke, fill and text |
| SetLineWidth · SetDash · SetLineDashPattern | Thickness and dashes |
| Line(x1,y1,x2,y2) · Rect(x,y,w,h,style) | Line · rectangle ('' outline, 'F' filled, 'DF' both) |
| Poly(points, close, style) · Triangle(...) | Polygons and triangles |
PL_FPDF.SetDrawColor(r => 200, g => 0, b => 0); -- RGB 0-255; r alone = shade of grey PL_FPDF.SetFillColor(240, 240, 240); PL_FPDF.SetLineWidth(0.5); -- in the document unit PL_FPDF.Rect(px => 10, py => 40, pw => 60, ph => 25, pstyle => 'DF'); -- '' outline | 'F' filled | 'DF' both PL_FPDF.SetLineDashPattern('[3 2] 0'); -- 3 on, 2 off (PDF points)
06 Images and links
| API | What it does |
|---|---|
| ImageFromBlob(blob, name, x, y, w, h, link) | A PNG/JPEG already in a table or variable — no network and no ACL; w or h = 0 keeps the aspect ratio |
| Image(url, x, y, w, h, type, link) | A PNG/JPEG fetched by URL; needs a network ACL granted to the schema |
| getImageFromUrl(url) | Downloads the image via UTL_HTTP and returns the bytes, without drawing |
| Link(x,y,w,h,url) | A clickable area leading to a URL. One per page: a second call on the same page replaces the first |
| AddLink · SetLink | Not supported: internal links (table of contents, index) are not implemented, and the call raises ORA-20601. Use a URL |
SELECT logo INTO l_logo FROM empresa WHERE id = 1; -- BLOB with the PNG/JPEG PL_FPDF.ImageFromBlob( p_blob => l_logo, p_name => 'LOGO', -- cache key: the same name reuses the image pX => 10, pY => 10, pWidth => 40, -- fixed width… pHeight => 0, -- …0 = proportional height pLink => 'https://msbrasil.inf.br'); -- clickable image (optional)
07 Automatic header and footer
Register procedures of your own to run on every page, with parameters.
| API | What it does |
|---|---|
| SetHeaderProc(proc, params) | Procedure called at the top of every page |
| SetFooterProc(proc, params) | Procedure called in the footer |
| SetAliasNbPages('{nb}') | Placeholder for the page total ("Page 2/{nb}") |
-- a procedure of yours, called on every page: PL_FPDF.SetFooterProc(footerprocname => 'my_pkg.my_footer'); -- with parameters: tv4000a is an associative array indexed by the parameter NAME -- l_p PL_FPDF.tv4000a; (there is no tv4000a(...) constructor) l_p('p_title') := 'Monthly Report'; l_p('p_period') := 'Aug/2026'; PL_FPDF.SetHeaderProc( headerprocname => 'my_pkg.my_header', paramTable => l_p); PL_FPDF.SetAliasNbPages('{nb}'); -- use '{nb}' in the text = total pages
08 QR Code and barcode
| API | What it does |
|---|---|
| AddQRCode(x, y, size, data, format, correction) | Formats TEXT, URL, PIX, VCARD, WIFI, EMAIL · correction L/M/Q/H |
| AddBarcode(x, y, w, h, code, type, text) | CODE128, CODE39, EAN13, EAN8, ITF14 and ITF — ITF (Interleaved 2 of 5) takes any even number of digits, such as the 44 of a boleto |
PIX with a full EMV payload and Boleto in the FEBRABAN layout live in the brazilian-payments extension, optional and installed separately — both are Brazilian payment standards. It has no bank certification: before using it in production, validate the boleto with the bank and the PIX with your payment provider.
PL_FPDF.AddQRCode( p_x => 150, p_y => 20, p_size => 40, -- position and side (document unit) p_data => 'https://msbrasil.inf.br', p_format => 'URL', -- TEXT | URL | PIX | VCARD | WIFI | EMAIL p_error_correction => 'M'); -- L 7% | M 15% | Q 25% | H 30% PL_FPDF.AddBarcode( p_x => 30, p_y => 70, p_width => 150, p_height => 20, p_code => '7891234567895', p_type => 'EAN13', -- CODE128 | CODE39 | EAN13 | EAN8 | ITF14 | ITF p_show_text => TRUE); -- human-readable number below the bars
09 Metadata and configuration
| API | What it does |
|---|---|
| SetTitle / SetSubject / SetAuthor / SetKeywords / SetCreator | Document metadata |
| SetDisplayMode(zoom, layout) | How the reader opens the PDF |
| SetCompression(bool) | Content compression |
| SetDocumentConfig(json) · GetDocumentMetadata | Batch configuration and reading via JSON |
| GetPageInfo(n) | Dimensions and rotation of a page (JSON) |
PL_FPDF.SetTitle('Monthly Report'); PL_FPDF.SetAuthor('M&S do Brasil'); PL_FPDF.SetDisplayMode(zoom => 'fullpage', layout => 'single'); -- how the reader opens it PL_FPDF.SetCompression(TRUE); -- or everything at once: PL_FPDF.SetDocumentConfig(JSON_OBJECT_T('{"title":"Report","author":"M&S"}'));
10 Output — producing the PDF
| API | When to use it |
|---|---|
| OutputBlob → BLOB | The default: store in a table, e-mail, APEX, ORDS. The returned BLOB is temporary: after storing or sending it, free it with DBMS_LOB.FREETEMPORARY |
| OutputFile(file, directory) | Write into an Oracle DIRECTORY |
| ReturnBlob · Output | Compatibility with legacy code / classic FPDF |
l_pdf := PL_FPDF.OutputBlob(); -- BLOB for a table/e-mail/APEX PL_FPDF.OutputFile( p_filename => 'report.pdf', p_directory => 'PDF_DIR'); -- Oracle DIRECTORY with write permission
11 Editing an existing PDF
The flow: LoadPDF → inspect/modify → OutputModifiedPDF.
| API | What it does |
|---|---|
| LoadPDF(blob) | Loads and parses an existing PDF. An encrypted PDF is refused with ORA-20867: run it through DecryptPDF first |
| GetPageCount · GetPDFInfo | Page total · metadata/version (JSON) |
| RotatePage(n, degrees) · RemovePage(n) | Rotation 0/90/180/270 · page removal |
| AddWatermark(text, opacity, rotation, pages, font, size, colour) | Watermark on 'ALL' or '1,3-5' |
| GetWatermarks · GetActivePageCount · IsPageRemoved · IsPDFModified | State queries (JSON) |
| OutputModifiedPDF → BLOB · ClearPDFCache | Produces the final PDF · frees memory |
PL_FPDF.LoadPDF(l_pdf); PL_FPDF.RotatePage(p_page_number => 1, p_rotation => 90); -- 0/90/180/270 PL_FPDF.AddWatermark( p_text => 'CONFIDENTIAL', p_opacity => 0.3, -- 0.0 transparent … 1.0 opaque p_rotation => 45, -- the classic diagonal p_pages => 'ALL', -- or '1,3-5' p_size => 48, -- points p_color => 'gray'); PL_FPDF.RemovePage(3); l_pdf := PL_FPDF.OutputModifiedPDF();
12 Overlays — content on top of an existing PDF
Stamps, logos and sign-off marks at exact coordinates (PDF points; Y counts upwards).
| API | What it does |
|---|---|
| OverlayText(page, text, x, y, options) | JSON options: font, fontSize, color, opacity, rotation, align, bold, zOrder |
| OverlayImage(page, blob, x, y, w, h, options) | JPEG/PNG; opacity, rotation, maintainAspect, scaleToFit |
| GetOverlays(page) · RemoveOverlay(id) · ClearOverlays(page) | Management of the overlays |
PL_FPDF.OverlayText( p_page_number => 1, p_text => 'APPROVED', p_x => 400, p_y => 700, -- PDF points; Y counts from the bottom up p_options => JSON_OBJECT_T('{ "fontSize":24, "color":"FF0000", "opacity":0.8, "rotation":0, "align":"left", "bold":true }')); PL_FPDF.OverlayImage( p_page_number => 1, p_image_blob => l_logo, p_x => 450, p_y => 750, p_width => 100, p_height => NULL, -- NULL = proportional / original p_options => JSON_OBJECT_T('{"opacity":0.9,"maintainAspect":true}'));
13 Multi-PDF: merge, split and extraction
| API | What it does |
|---|---|
| LoadPDFWithID(blob, id) · UnloadPDF(id) · GetLoadedPDFs | Several PDFs in memory, each with an ID |
| MergePDFs(ids JSON) → BLOB | Merges in the order of the array |
| SplitPDF(id, ranges JSON) → JSON | Splits by range ("1-10", "11-20", "21-") |
| ExtractPages(id, '1,5-10,15') → BLOB | A new PDF with only the pages given |
PL_FPDF.LoadPDFWithID(l_cover, 'cover'); PL_FPDF.LoadPDFWithID(l_body, 'body'); l_final := PL_FPDF.MergePDFs(JSON_ARRAY_T('["cover","body"]'));
14 Security and encryption
| API | What it does |
|---|---|
| EncryptPDF(pdf, user_password, owner_password, permissions, algorithm) | Protects a finished BLOB — 'AES-256', 'AES-128', 'RC4-128' or 'RC4-40'. Without the algorithm, the default is the legacy RC4-128: pass 'AES-256' |
| DecryptPDF(pdf, password) | Removes the protection |
| IsEncrypted(pdf) · GetSecurityInfo(pdf) | Checks and inspects (algorithm, key, permissions) |
| SetEncryption(...) · SetPermissions(...) | Encryption and permissions for a new document, before OutputBlob |
| SetPDFVersion('1.7') · GetPDFVersion | Version of the generated file |
l_perms := JSON_OBJECT_T(); l_perms.put('print', TRUE); -- also: modify, copy, annotate, l_perms.put('copy', FALSE); -- fill_forms, extract, assemble, print_high l_seguro := PL_FPDF.EncryptPDF( p_pdf => l_pdf, p_user_password => 'readPassword', -- asked for on opening p_owner_password => 'adminPassword', -- NULL = same as the user one p_permissions => l_perms, p_encryption => 'AES-256'); -- or 'AES-128', 'RC4-128', 'RC4-40'
A password is not a signature. The encryption above protects the file (who opens it, who prints it, who copies from it) — it does not attest authorship nor detect tampering. Digital signatures (PAdES, ICP-Brasil certificates) do not exist in the library yet.