The PDF component is used to manipulate existing PDF documents or create new ones.
This functionality is only available to Boxlang+/++ subscribers only but can be installed in conjunction with the bx-plus Module with a limited trial.
Component Signature
<bx:PDF action=[string]
ascending=[boolean]
type=[string]
ddxfile=[string]
destination=[string]
directory=[string]
encrypt=[string]
flatten=[boolean]
image=[any]
filter=[string]
info=[struct]
inputfiles=[struct]
keepbookmark=[boolean]
name=[string]
opacity=[double]
order=[string]
outputfiles=[struct]
overwrite=[boolean]
pages=[string]
newOwnerPassword=[string]
newUserPassword=[string]
password=[string]
permissions=[string]
saveoption=[string]
showonprint=[boolean]
source=[any]
stoponerror=[boolean]
version=[double]
text=[string]
numberformat=[string]
align=[string]
leftmargin=[numeric]
rightmargin=[numeric]
topmargin=[numeric]
bottommargin=[numeric]
format=[string]
imageprefix=[string]
resolution=[string]
transparent=[boolean]
overridepage=[boolean]
hires=[boolean]
scale=[double]
position=[double]
rotation=[double]
hscale=[double]
vscale=[double]
foreground=[boolean]
isbase64=[boolean]
copyfrom=[any]
exportTo=[string]
importFrom=[string]
encodeall=[boolean] />Attributes
action
string
false
String - The action to perform on the PDF document. Supported values: addheader, addfooter, addwatermark, deletepages, export, extracttext, extractimage, getinfo, import, merge, protect, read, removepassword, removewatermark, removeheaderfooter, sanitize, setinfo, sign, thumbnail, transform, unsign, validatesignature, write. NOTE: Some actions are not yet implemented and will throw a NOT_IMPLEMENTED error.
open
ascending
boolean
false
Boolean - Sort order for operations. Default: true.
true
type
string
false
String - The type of operation or format. Used with export/import actions to specify the data format (e.g., "fdf", "xfdf").
ddxfile
string
false
String - DDX file path for processddx operations. NOTE: processddx action is not yet implemented.
destination
string
false
String - The destination file path for output operations. Used with actions like extracttext, write, and export.
directory
string
false
String - The directory path for operations that create multiple files, such as thumbnail generation or image extraction.
encrypt
string
false
String - Encryption settings for PDF operations.
flatten
boolean
false
Boolean - Whether to flatten form fields. Default: false.
false
image
any
false
Any - Image data or file path for watermark operations.
filter
string
false
String - Filter criteria for extraction operations.
info
struct
false
Struct - Document information structure for setinfo operations.
inputfiles
struct
false
Struct - Input file mappings for batch operations.
keepbookmark
boolean
false
Boolean - Whether to preserve bookmarks during operations.
name
string
false
String - The name of the variable to store the result in. Alternative to destination for storing output in memory.
opacity
double
false
Double - Opacity level for watermarks (0.0 to 1.0). Default: 0.5.
0.5
order
string
false
String - Ordering specification for merge operations.
outputfiles
struct
false
Struct - Output file mappings for batch operations.
overwrite
boolean
false
Boolean - Whether to overwrite existing files. Default: false.
false
pages
string
false
String - Specifies which pages to operate on. Can be page ranges like "1-5", individual pages like "1,3,5", or "*" for all pages. Required for addheader, addfooter, and deletepages actions.
newOwnerPassword
string
false
String - The new owner password when protecting a PDF. Required for the protect action.
newUserPassword
string
false
String - The new user password when protecting a PDF.
password
string
false
String - The password for encrypted PDF documents.
permissions
string
false
String - The permissions to set when protecting a PDF document.
saveoption
string
false
String - Save options for write operations.
showonprint
boolean
false
Boolean - Whether watermark shows when printing.
source
any
false
Any - The source PDF document(s) to operate on. Can be a file path, binary data, or PDF document variable.
stoponerror
boolean
false
Boolean - Whether to stop processing on first error.
version
double
false
Double - PDF version to use for output documents.
text
string
false
String - Text content for header/footer operations.
numberformat
string
false
String - Number format for page numbering in headers/footers. Valid values: "numeric", "lowercaseroman", "uppercaseroman". Default: "numeric".
numeric
align
string
false
String - Text alignment for header/footer text. Valid values: "left", "right", "center". Default: "left".
left
leftmargin
numeric
false
Numeric - Left margin in points for header/footer positioning.
rightmargin
numeric
false
Numeric - Right margin in points for header/footer positioning.
topmargin
numeric
false
Numeric - Top margin in points for header positioning.
bottommargin
numeric
false
Numeric - Bottom margin in points for footer positioning.
format
string
false
String - Output format for thumbnail generation. Default: "jpeg".
jpeg
imageprefix
string
false
String - Prefix for generated image filenames. Default: "".
resolution
string
false
String - Resolution quality for thumbnails. Valid values: "low", "medium", "high". Default: "high".
high
transparent
boolean
false
Boolean - Whether thumbnail background is transparent. Default: false.
false
overridepage
boolean
false
Boolean - Whether to override existing pages. Default: false.
false
hires
boolean
false
Boolean - High resolution mode for operations. NOTE: This attribute is not yet implemented.
scale
double
false
Double - Scale factor for thumbnails and watermarks. Default: 100.0.
100.0
position
double
false
Double - Position for watermark or signature placement.
rotation
double
false
Double - Rotation angle in degrees for watermarks or signatures.
hscale
double
false
Double - Horizontal scale factor for watermarks. Default: 1.0.
1.0
vscale
double
false
Double - Vertical scale factor for watermarks. Default: 1.0.
1.0
foreground
boolean
false
Boolean - Whether watermark appears in foreground. Default: false.
false
isbase64
boolean
false
Boolean - Whether input data is base64 encoded. Default: false.
false
copyfrom
any
false
Any - Source document to copy pages from.
exportTo
string
false
String - Target file path for export operations.
importFrom
string
false
String - Source file path for import operations.
encodeall
boolean
false
Boolean - Whether to encode all content. NOTE: This attribute is not yet implemented.
Examples
Reading PDF Information
Merging Multiple PDFs
Extracting Text Content
Adding Watermarks
Adding Headers and Footers
Protecting PDF with Password
Removing Password Protection
Generating Thumbnails
Deleting Specific Pages
Setting Document Information
Using PDF Variables
Complex Multi-Action Example
Supported Actions
addheader - Add headers to PDF pages
addfooter - Add footers to PDF pages
addwatermark - Add text or image watermarks
deletepages - Remove specific pages
extracttext - Extract text content
getinfo - Get document metadata
merge - Combine multiple PDFs
protect - Add password protection
read - Load PDF into memory
removepassword - Remove password protection
setinfo - Set document metadata
thumbnail - Generate page thumbnails
write - Save PDF to file
Related Components
Last updated
Was this helpful?
