PL/ACROFORM — PDF Form Processing for Oracle PL/SQL
Extract form data as JSON, fill interactive AcroForm PDFs, and flatten completed forms into static PDF documents—directly in Oracle Database.
Work with existing PDF forms stored as Oracle BLOBs. Keep PDF processing close to your application data without relying on an external document service.
Process existing PDF forms inside Oracle
PL/ACROFORM provides a focused PL/SQL API for working with the AcroForm fields in existing PDF documents. Read field values, populate form data, or turn an interactive form into a non-editable PDF for delivery and downstream processing.
Extract form data
Read AcroForm field values into a JSON document with the original field names. Suitable for processing submitted forms, database storage and application workflows.
Fill PDF forms
Set text, checkbox, radio, choice and multi-select values from JSON. Keep the PDF interactive when it must remain editable.
Flatten completed forms
Transfer visible field appearances into page content and remove active form widgets. Return a static PDF BLOB ready for storage, distribution or further processing.
A simple, consistent PL/SQL API
Three public functions cover the primary PDF form workflow. All operations accept an existing PDF BLOB and return a CLOB or a new PDF BLOB.
-- Read form fields and values as JSON.
l_json := pl_acroform.extract(p_pdf => l_source_pdf);
-- Populate an interactive PDF form.
l_filled_pdf := pl_acroform.fill(
p_pdf => l_source_pdf,
p_data => l_json_data
);
-- Fill and flatten with one PDF save.
l_static_pdf := pl_acroform.fill(
p_pdf => l_source_pdf,
p_data => l_json_data,
pl_flatten => true
);
-- Flatten an existing filled PDF.
l_flat_pdf := pl_acroform.flatten(p_pdf => l_filled_pdf);
The pl_flatten argument defaults to FALSE, so existing fill() calls continue to return an interactive form.
Example: fill a W-9 form from JSON
This example uses field identifiers from a W-9 AcroForm PDF. The example names and addresses are fictional. The source PDF is assumed to be available in l_source_pdf.
declare
l_source_pdf blob; -- Load the W-9 PDF from your application.
l_data clob;
l_output_pdf blob;
begin
l_data := q'~{
"fields": {
"topmostSubform[0].Page1[0].f1_01[0]": "Alex Morgan",
"topmostSubform[0].Page1[0].f1_02[0]": "Example Business LLC",
"topmostSubform[0].Page1[0].Address_ReadOrder[0].f1_07[0]": "100 Main Street"
}
}~';
l_output_pdf := pl_acroform.fill(
p_pdf => l_source_pdf,
p_data => l_data,
p_format => 'JSON',
pl_flatten => true
);
-- Store or stream l_output_pdf from your application.
-- Release the returned temporary BLOB after use.
end;
/
Use pl_flatten => FALSE (or omit the argument) if the recipient must continue editing the PDF form.
One-pass fill and flatten
When flattening is requested as part of fill(), PL/ACROFORM updates the fields and generates the required appearances in a single open PDF document. It then adds the visible appearances as page content and saves the result once, rather than creating an intermediate filled PDF and reopening it.
Existing page content retained
Original page content streams remain unchanged. New page content streams reference the form appearance XObjects.
Form controls removed
Flattened widget annotations and the active AcroForm catalog entry are removed from the resulting document structure.
Document JavaScript detached
The document-level AcroForm-related JavaScript name tree is detached during flattening, preventing legacy form-version warning scripts from running.
Built for Oracle application workflows
BLOB in, BLOB out
Integrate with stored PL/SQL, Oracle APEX, database jobs and any application that can pass Oracle LOB values.
Appearance-aware output
Use the PDF form appearance streams for static output and preserve the applicable PDF font and graphics resource references.
Interactive or static delivery
Choose whether to return a fillable document or a static final PDF without changing the surrounding application design.
Supported scope and important considerations
Supported use cases: AcroForm text fields, checkboxes, radio buttons, choice fields and multi-select values; JSON extraction and filling; static flattening; classic cross-reference tables and cross-reference streams in tested PDFs.
Current limitations: XFA and XFDF processing are not provided. The appearance of unsupported glyphs may depend on the original PDF fonts; missing embedded font programs can lead to reader-dependent substitution. Digitally signed or encrypted PDF inputs require separate handling and should not be assumed supported.
Incremental output: Flattening removes active form controls, but older PDF revisions may remain physically present in the output bytes. It is not a redaction or secure data-removal operation.
Try PL/ACROFORM
Evaluate PDF form extraction, filling and flattening in your Oracle environment. Request the install kit, the PL/ACROFORM User Guide and the W-9 demo package, or ask about testing in the hosted PL/ sandbox.
