PDF +
Premium PDF generation and manipulation module for BoxLang+ applications: build, merge, stamp, secure, and extract content programmatically.
The Boxlang+ Licensed edition of the bx-pdf module equips your BoxLang+ applications with robust PDF creation and processing capabilities—ideal for invoices, reports, forms, certificates, and archival workflows.
This module is only available to +/++ subscribers only but can be installed in conjunction with the bx-plus Module with a limited trial.
This module provides comprehensive PDF manipulation and generation functionality for BoxLang, including:
PDF Document Generation - Create PDF documents from HTML content
PDF Form Manipulation - Populate and extract data from PDF forms
PDF Document Processing - Advanced PDF operations like merging, splitting, watermarking
Adobe ColdFusion Compatibility - Full compatibility with ColdFusion PDF tags
Installation
# For Operating Systems using our Quick Installer
install-bx-module bx-plus,bx-pdf
# Using CommandBox to install for web servers
box install bx-plus,bx-pdfComponents
This module contributes the following components to the BoxLang runtime:
Document Generation Components ( Free Tier )
document- Main component for creating PDF documents from HTMLdocumentitem- Specifies headers, footers, and page breaksdocumentsection- Divides documents into sections with unique properties
PDF Manipulation Components ( Boxlang+ Only )
pdf- Advanced PDF operations (merge, split, watermark, etc.)pdfparam- Parameters for PDF operations like attachments
PDF Form Components ( Boxlang+ Only )
pdfform- Manipulate PDF forms (populate/read form fields)pdfformparam- Specify individual form field values
Document Component
The document component creates PDF documents from HTML content with extensive customization options.
Attributes
format
String
"pdf"
Document format (PDF only)
filename
String
-
Output file path
variable
String
-
Variable name to store PDF binary
encryption
String
"none"
Encryption level: "128-bit", "40-bit", "none"
orientation
String
"portrait"
Page orientation: "portrait", "landscape"
pageType
String
"A4"
Page size (A4, LETTER, LEGAL, etc.)
pageWidth
Numeric
-
Custom page width in inches
pageHeight
Numeric
-
Custom page height in inches
marginTop
Numeric
-
Top margin
marginBottom
Numeric
-
Bottom margin
marginLeft
Numeric
-
Left margin
marginRight
Numeric
-
Right margin
scale
Numeric
100
Scaling percentage (≤100)
backgroundVisible
Boolean
true
Show background elements
bookmark
Boolean
true
Generate bookmarks
htmlBookmark
Boolean
false
Convert HTML anchors to bookmarks
fontEmbed
Boolean
true
Embed fonts in document
fontDirectory
String
-
Custom font directory
localUrl
Boolean
false
Generate with local URLs
openpassword
String
-
Password to open document
ownerPassword
String
-
Owner password for restrictions
pdfa
Boolean
false
Generate PDF/A compliant document
saveAsName
String
-
Browser save filename
overwrite
Boolean
false
Overwrite existing files
src
String
-
URL or path to HTML content
srcfile
String
-
Absolute path to HTML file
mimeType
String
"text/html"
Source content MIME type
unit
String
"inches"
Measurement unit: "in", "cm"
Unsupported Attributes
The following attributes are not currently implemented and will throw an error if used:
permissions- Granular permissibility is not yet supportedpermissionspassword- Granular permissibility is not yet supporteduserPassword- Granular permissibility is not yet supportedauthPassword- Authentication password not supportedauthUser- Authentication user not supporteduserAgent- HTTP user agent identifier not supportedproxyHost- Proxy server configuration not supportedproxyPassword- Proxy authentication not supportedproxyPort- Proxy port configuration not supportedproxyUser- Proxy user authentication not supportedtagged- ACF OpenOffice integration not supportedformfields- Form field attributes not implemented in standard moduleformsType- Form type specification not implemented in standard module
DocumentItem Component
Specifies headers, footers, and page breaks within PDF documents.
Attributes
type
String
Yes
Item type: "header", "footer", "pagebreak"
evalAtPrint
Boolean
No
⚠️ Deprecated - content always evaluated
DocumentSection Component
Divides PDF documents into sections with unique headers, footers, and page numbering.
Attributes
name
String
Section name (used for bookmarks)
marginTop
Numeric
Section top margin
marginBottom
Numeric
Section bottom margin
marginLeft
Numeric
Section left margin
marginRight
Numeric
Section right margin
src
String
URL or relative path to content
srcfile
String
Absolute path to content file
mimeType
String
Content MIME type
Unsupported Attributes
The following attributes are not currently implemented and will throw an error if used:
userAgent- HTTP user agent identifier for URL fetchingauthPassword- Authentication password for URL contentauthUser- Authentication username for URL content
PDFForm Component
Manipulates PDF forms created in Adobe Acrobat and Adobe LiveCycle Designer. Supports both populating form fields and extracting form data.
Actions
populate - Fill form fields with data
read - Extract form field data to structures or files
Attributes
action
String
Yes
"populate" or "read"
source
Any
Yes
Source PDF form (file path, byte array, or variable)
destination
String
No
Output file path (populate action)
result
String
No
Variable name for extracted data (read action)
overwrite
Boolean
No
Overwrite existing files (default: false)
overwriteData
Boolean
No
Overwrite existing form data (default: false)
fdfdata
String
No
FDF file path for import/export
XMLdata
String
No
⏳ XML data (planned feature)
Examples
Populating Form Fields
Reading Form Data
FDF Data Operations
PDFFormParam Component
Specifies individual form field values when populating PDF forms. Must be nested within a pdfform component.
Attributes
name
String
Yes
Form field name
value
String
Yes
Value to assign to the field
index
Integer
No
Field index for LiveCycle forms (default: 1)
Usage Notes
Acrobat Forms: Cannot have multiple fields with the same name, so
indexis not applicableLiveCycle Forms: Support multiple fields with the same name, use
indexto distinguish themCase Sensitivity: Field values are case-sensitive
Data Types: Component handles various field types (text, checkbox, radio, dropdown, etc.)
Example
PDF Component
Performs advanced PDF operations like merging, splitting, watermarking, and form manipulation.
Supported Actions
addAttachments
Add file attachments to PDF
addHeader
Add headers to pages
addFooter
Add footers to pages
addWatermark
Add watermark to pages
deletePages
Remove specific pages
export
Export form data (FDF/XFDF)
extractText
Extract text content
extractimage
Extract embedded images
getInfo
Get PDF metadata
import
Import form data
merge
Combine multiple PDFs
protect
Add password protection
removePassword
Remove password protection
removeWatermark
Remove watermarks
removeHeaderFooter
Remove headers/footers
thumbnail
Generate page thumbnails
transform
Transform/manipulate pages
unsign
Remove digital signatures
validatesignature
Validate signatures
write
Save PDF to file
Key Attributes
action
String
Operation to perform (see actions above)
source
Any
Source PDF(s) - file path, binary data, or variable
destination
String
Output file path
pages
String
Page selection: "1-5", "1,3,5", "*"
overwrite
Boolean
Overwrite existing files
password
String
Password for encrypted PDFs
Examples
Reading PDF Information
Copy
Merging Multiple PDFs
Copy
Extracting Text Content
Copy
Adding Watermarks
Copy
Adding Headers and Footers
Copy
Protecting PDF with Password
Copy
Removing Password Protection
Copy
Generating Thumbnails
Copy
Deleting Specific Pages
Copy
Setting Document Information
Copy
Using PDF Variables
Copy
Complex Multi-Action Example
Copy
PDFParam Component
Specifies parameters for PDF operations, particularly for merge and attachment operations.
Attributes
source
String
Source file path
filename
String
Attachment filename
encoding
String
File encoding (default: UTF-8)
mimeType
String
File MIME type
description
String
Attachment description
password
String
Password for encrypted files
Example
Advanced Examples
Complete Document Generation
PDF Processing Pipeline
Form Processing Workflow
CFML Compatibility
This module provides full compatibility with CFML PDF tags:
✅
cfdocument→bx:document✅
cfdocumentitem→bx:documentitem✅
cfdocumentsection→bx:documentsection✅
cfpdf→bx:pdf✅
cfpdfparam→bx:pdfparam✅
cfpdfform→bx:pdfform✅
cfpdfformparam→bx:pdfformparam
Migration from ColdFusion requires only prefix changes (cf → bx).
Technical Requirements
BoxLang Runtime 1.0.0+
Java 21+
Support and Documentation
Issue Tracking: JIRA
BoxLang Information: https://boxlang.io
BoxLang Documentation: https://boxlang.ortusbooks.com
Ortus Solutions: ortussolutions.com
📎 Related Modules
https://github.com/ortus-boxlang/boxlang-docs/blob/v1.x/boxlang-framework/boxlang-plus/modules/bx-plus-pdf/bx-spreadsheet/README.mdhttps://github.com/ortus-boxlang/boxlang-docs/blob/v1.x/boxlang-framework/boxlang-plus/modules/bx-plus-pdf/bx-plus/README.mdReturn to the Modules Overview.
Last updated
Was this helpful?
