Doc
Doc object represents the PDF file and is the means by which the majority of JavaScript functionality in Revu is accessed apart from app. There are a number of ways to access Doc, the most common of which is that this
is bound to the active Doc in most contexts. Additionally, a number of functions return Doc objects such as extractPages. The Doc object is also available through events.
example:
console.println(this.author) // 'this' is the active Doc
properties
author
Secure | Type | Access |
---|---|---|
No | string | R/W |
The author of the document stored in file properties.
author is deprecated
The recommended way to access author is through the info property
baseURL
Secure | Type | Access |
---|---|---|
No | string | R/W |
The base URL of the document used to resolve relative links when executing hyperlink actions.
this.baseURL = "https://www.bluebeam.com/"
// Any relative hyperlink will now be referenced from https://www.bluebeam.com
bookmarkRoot
Secure | Type | Access |
---|---|---|
No | object | R |
Returns a Bookmark
object representing the root bookmark in the PDF file.
calculate
Secure | Type | Access |
---|---|---|
No | boolean | R/W |
Specifies whether or not form field calculations should be run. Turning off calculations while manipulating lots of form fields can be a performance optimization.
creationDate
Secure | Type | Access |
---|---|---|
No | Date | R |
The creationDate of the document stored in file properties.
creationDate is deprecated
The recommended way to access creationDate is through the info property
creator
Secure | Type | Access |
---|---|---|
No | string | R |
The creator of the document stored in file properties, for example "Bluebeam Revu"
creator is deprecated
The recommended way to access creator is through the info property
dataObjects
Secure | Type | Access |
---|---|---|
No | array | R |
Array of Data
objects which represent embedded files in the PDF.
example:
this.dataObjects.forEach(d => { console.println(d.name) })
delay
Secure | Type | Access |
---|---|---|
No | boolean | R/W |
Exists for compatibility reasons. Always returns false
dirty
Secure | Type | Access |
---|---|---|
No | boolean | R/W |
Specifies whether the document needs to be saved
disclosed
Secure | Type | Access |
---|---|---|
No | boolean | R/W |
Exists for compatibility reasons. Always returns false
docID
Secure | Type | Access |
---|---|---|
No | array | R/W |
Array of two strings that are hex-encoded binary. The first string is a permanent ID associated with the PDF file. The second string is an ID that updates upon each save.
documentFileName
Secure | Type | Access |
---|---|---|
No | string | R |
The filename of the PDF with the extension.
dynamicXFAForm
Secure | Type | Access |
---|---|---|
No | boolean | R |
Exists for compatibility reasons. Always returns false
external
Secure | Type | Access |
---|---|---|
No | boolean | R |
Exists for compatibility reasons. Always returns false
filesize
Secure | Type | Access |
---|---|---|
No | number | R |
The size of the PDF file in bytes.
hidden
Secure | Type | Access |
---|---|---|
No | boolean | R |
When true the PDF file is open silently in the background and not loaded in a tab.
icons
Secure | Type | Access |
---|---|---|
No | array | R |
Array of Icon
document level icon objects. If there are no icons, null is returned.
example:
if (this.icons != null)
this.icons.forEach(i => { console.println(i.name) })
info
Secure | Type | Access |
---|---|---|
No | object | R |
Object that provides access to the key/value file properties in the PDF.
Predefined keys:
- Title
- Author
- Subject
- Keywords
- Creator
- Producer
- CreationDate
- ModDate
- Trapped
Custom keys can be used as well.
innerAppWindowRect
Secure | Type | Access |
---|---|---|
No | array | R |
Rectangle representing the bounds of the Revu application minus the title bar.
array is in the form of [x, y, width, height]
.
var rect = this.innerAppWindowRect // returns [0, 24, 2560, 1550]
innerDocWindowRect
Secure | Type | Access |
---|---|---|
No | array | R |
Returns the same value as innerAppWindowRect.
keywords
Secure | Type | Access |
---|---|---|
No | string | R/W |
The keywords of the document stored in file properties.
keywords is deprecated
The recommended way to access keywords is through the info property
layout
Secure | Type | Access |
---|---|---|
No | string | R/W |
The page layout of the PDF file.
Valid values:
- "SinglePage"
- "OneColumn"
- "TwoColumnLeft"
- "TwoColumnRight"
- "TwoPageLeft"
- "TwoPageRight"
example:
this.layout = "TwoColumnLeft"
modDate
Secure | Type | Access |
---|---|---|
No | date | R |
The modified date of the document stored in file properties.
modDate is deprecated
The recommended way to access modDate is through the info property
mouseX
Secure | Type | Access |
---|---|---|
No | number | R |
The X coordinate of the mouse in PDF space.
example:
function printMouse() {
console.clear()
console.println("x: " + this.mouseX + " y: " + this.mouseY)
}
var obj = app.setInterval("printMouse()", 100)
mouseY
Secure | Type | Access |
---|---|---|
No | number | R |
The Y coordinate of the mouse in PDF space. See mouseX for an example.
numFields
Secure | Type | Access |
---|---|---|
No | number | R |
Total number of form fields in the PDF.
numPages
Secure | Type | Access |
---|---|---|
No | number | R |
Total number of pages in the PDF.
numTemplates
Secure | Type | Access |
---|---|---|
No | number | R |
Total number of Template objects in the PDF.
numTemplates is deprecated
The recommended way to access the number of templates is through the templates property
path
Secure | Type | Access |
---|---|---|
No | string | R |
Device-independent path of the PDF file.
example:
console.println(this.path) // Might return /c/path/to/my/file.pdf
outerAppWindowRect
Secure | Type | Access |
---|---|---|
No | array | R |
Rectangle representing the complete bounds of the Revu application.
array is in the form of [x, y, width, height]
.
var rect = this.outerAppWindowRect // returns [-18,-18, 2560, 1550]
outerDocWindowRect
Secure | Type | Access |
---|---|---|
No | array | R |
Returns the same value as outerAppWindowRect.
pageNum
Secure | Type | Access |
---|---|---|
No | number | R/W |
Index of the active page in Revu (0-based)
example:
this.pageNum++ // Navigate to the next page
pageWindowRect
Secure | Type | Access |
---|---|---|
No | array | R |
Rectangle representing the PDF display bounds within the Revu application.
array is in the form of [x, y, width, height]
.
var rect = this.pageWindowRect
permStatusReady
Secure | Type | Access |
---|---|---|
No | boolean | R |
Exists for compatibility reasons. Always returns true
producer
Secure | Type | Access |
---|---|---|
No | string | R |
The producer of the document stored in file properties.
producer is deprecated
The recommended way to access producer is through the info property
requiresFullSave
Secure | Type | Access |
---|---|---|
No | boolean | R |
True if the PDF file does not yet exist on disk.
securityHandler
Secure | Type | Access |
---|---|---|
No | string | R |
Specifies the security handler if the PDF file is encrypted. Returns null if the file is unencrypted. Revu only supports the "Standard" security handler.
subject
Secure | Type | Access |
---|---|---|
No | string | R/W |
The subject of the document stored in file properties.
subject is deprecated
The recommended way to access subject is through the info property
templates
Secure | Type | Access |
---|---|---|
No | array | R |
Array of Template
objects.
example:
this.templates.forEach(t => { console.println(t.name) })
title
Secure | Type | Access |
---|---|---|
No | string | R/W |
The title of the document stored in file properties.
title is deprecated
The recommended way to access title is through the info property
URL
Secure | Type | Access |
---|---|---|
No | string | R |
URL of the PDF file. If the file is in Studio Projects for instance, it will return a web URL. If a local file, the URL will be prefixed with file:///
zoom
Secure | Type | Access |
---|---|---|
No | number | R/W |
Zoom level of the PDF file as a percentage. 100 equals 100%.
example:
this.zoom = 50 // Set the zoom to 50%
zoomType
Secure | Type | Access |
---|---|---|
No | string | R/W |
Zoom type of the PDF file.
Zoom types and corresonding constants that can be used:
Zoom type | Constant |
---|---|
"NoVary" | zoomtype.none |
"FitPage" | zoomtype.fitP |
"FitWidth" | zoomtype.fitW |
"FitHeight" | zoomtype.fitH |
"Preferred" | zoomtype.pref |
example:
this.zoomType = zoomtype.fitP // Fit to the page
methods
addField
Secure |
---|
No |
Adds a form field to the PDF file.
addField(cName, cFieldType, nPageNum, oCoords)
cName: Name of the new field. Can denote a heirarchy by using dots to separate the names. i.e. "parent.child"
cFieldType: Type of the new field. See valid types below.
nPageNum: 0-based page index to add the new field to.
oCoords: Array of 4 numbers specifying the rectangle for the field. The rectangle is in the form of [upper-left-x, upper-left-y, lower-right-x, lower-right-y].
Returns the new Field
.
cFileType values:
- "text"
- "button"
- "combobox"
- "listbox"
- "checkbox"
- "radiobutton"
- "signature"
see app.goBack for a complete example.
example:
this.addField("myTextBox", "text", 0, [100, 100, 200, 80])
addIcon
Secure |
---|
No |
Adds a document level icon to the PDF file.
addIcon(cName, icon)
cName: Name of the new icon.
icon: Icon
object to add.
bringToFront
Secure |
---|
No |
Sets an open document to be the active tab in Revu.
bringToFront()
calculateNow
Secure |
---|
No |
Triggers all form field calculations to take place at once. Commonly used in conjunction with the calculate property to temporarily turn off calculations, make a number of modifications programatically, then force calculations to run when done.
calculateNow()
example:
this.calculate = false
// Lots of form field modifications
this.calculate = true
this.calculateNow()
closeDoc
Secure |
---|
No |
Closes the active document with the option to prompt the user to save any unsaved changes.
closeDoc(bNoSave)
bNoSave: [optional] When true, the file will close without saving. When false, the user will be prompted to save if there are unsaved changes. Default is false.
example:
this.closeDoc(true) // Would cause the file to close, losing any unsaved changes
createDataObject
Secure |
---|
No |
Creates a new Data
object.
createDataObject(cName, cValue, cMIMEType, cCryptFilter)
cName: Name of the data object
cValue: Data to be embedded
cMIMEType: [optional] MIME type of the data object. Default is "text/plain"
cCryptFilter: [optional] Not used by Revu
example:
this.createDataObject("NewFile.txt", "Data to embed")
deletePages
Secure |
---|
No |
Deletes pages from the PDF file.
deletePages(nStart, nEnd)
nStart: [optional] 0-based index of the first page in the range to delete. Default is 0
nEnd: [optional] 0-based index of the last page in the range to delete. Default is nStart
Returns true if the pages were successfully deleted.
example:
this.deletePages() // Deletes the first page
this.deletePages({nStart: 2, nEnd: 3}) // Deletes pages 2 and 3 (0-based)
exportAsFDF
Secure |
---|
Yes |
Exports form field data as FDF
exportAsFDF(bAllFields, bNoPassword, aFields, bFlags, cPath, bAnnotations)
bAllFields: [optional] Not used by Revu
bNoPassword: [optional] When true, omit exporting any fields marked as a password. Default is true
aFields: [optional] String array of names of form fields to export, or a string of a single name. When null, all fields will be exported. Default is null.
bFlags: [optional] Not used by Revu
cPath: [optional] The device-independent path of the output FDF file. When supplied, this function requires elevated permissions. Default is null
bAnnotations: [optional] When true, export annotations in addition to the form fields. Default is true
example:
// Export all fields (except those with that are password)
this.exportAsFDF(true, true, null)
// Exports particular fields to a specific file, requires elevated permissions
this.exportAsFDF(true, true, ['field1', 'field2'], true, '/c/path/to/my/file.fdf')
exportDataObject
Secure |
---|
No |
Exports the data object to a local file. exportDataObject no longer requires elevated permissions because cDIPath is no longer supported.
exportDataObject(cName, cDIPath, bAllowAuth, nLaunch)
cName: The name of the data object.
cDIPath: [optional] No longer supported. Function always fails if cDIPath is supplied.
bAllowAuth: [optional] Not used by Revu
nLaunch: [optional] Launch mode, see below:
nLaunch values:
Value | Description |
---|---|
0 | Saved to user chosen location and not opened |
1 | Saved to user chosen location and opened |
2 | Saved to a temporary location and opened |
example:
// Saved to a temp location and opened
this.exportDataObject("myAttachment.pdf", null, false, 2)
extractPages
Secure |
---|
Yes |
Extracts pages into a new PDF file.
extractPages(nStart, nEnd, cPath)
nStart: [optional] 0-based index of the first page in the range to extract. Default is 0
nEnd: [optional] 0-based index of the last page in the range to extract. Default is nStart
cPath: [optional] The device-independent path of the output PDF file. When supplied, this function requires elevated permissions. Default is null
Returns a Doc
object of the newly created document if cPath is null, otherwise returns null.
example:
this.extractPages() // Extracts the first page and opens a a new file
this.extractPages(1, 2) // Extracts the pages 2 and 3 and opens as a new file
flattenPages
Secure |
---|
No |
Embeds all annotations directly into the page content making them no longer interactive.
flattenPages(nStart, nEnd, nNonPrint)
nStart: [optional] 0-based index of the first page in the range to flatten. Default is 0
nEnd: [optional] 0-based index of the last page in the range to flatten. Default is nStart, if nStart is supplied, otherwise, the default is the last page of the file.
nNonPrint: [optional] Not used by Revu
example:
this.flattenPages() // Flattens all pages in the file
this.flattenPages(1) // Flattens just the 2nd page in the file
getAnnots3D
Secure |
---|
No |
Returns a Annot3D object with the single property of activated
. Exists for compatibility reasons, 3D Annotation JavaScript is not supported by Revu.
getAnnots3D(nPage)
nPage: 0-based index of the page in the file
getDataObject
Secure |
---|
No |
Returns a specific Data
object associated with the supplied name.
getDataObject(cName)
cName: Name of the Data object to return
Returns a Data
object.
example:
var data = this.getDataObject("data.txt")
console.println(data.size)
getDataObjectContents
Secure |
---|
No |
Returns a stream to the file contents of the Data object.
getDataObjectContents(cName, bAllowAuth)
cName: Name of the Data object.
bAllowAuth: [optional] Not used by Revu
Returns a ReadStream
object.
example:
var stream = this.getDataObjectContents("data.txt")
var text = util.stringFromStream(stream, "utf-8")
console.println(text)
getField
Secure |
---|
No |
Returns a Field
object associated with the supplied name.
getField(cName)
cName: Name of the form field.
Returns a Field object.
example:
var f = this.getField("MyField")
getIcon
Secure |
---|
No |
Returns an Icon
object associated with the supplied name.
getIcon(cName)
cName: Name of the icon
Returns an Icon object.
example:
var icon = this.getIcon("MyIcon")
var field = this.getField("button")
field.buttonSetIcon(icon)
getNthFieldName
Secure |
---|
No |
Returns the name of the field in the file with index of n. See numFields.
getNthFieldName(nIndex)
nIndex: Index of the field
Returns the name of the field
example:
// Prints all field names in the file
for (var n = 0; n < this.numFields; n++)
console.println(n + ": " + this.getNthFieldName(n))
getNthTemplate
Secure |
---|
No |
Returns the name of the template in the file with index of n.
getNthTemplate is deprecated
The recommended way to access templates is through the templates property.
getNthTemplate(nIndex)
nIndex: Index of the template
Returns the name of the template
getOCGs
Secure |
---|
No |
Returns an array of OCG
objects for the specified page. Note that OCGs (Optional Content Groups) are referred to as Layers within Revu.
getOCGs(nPage)
nPage: [optional] The 0-based page number to constrain the returned OCGs. If no page number is specified, all OCGs in the file are returned.
Returns an array of OCG objects. If there are no OCGs, null is returned.
example:
var ocgArray = this.getOCGs() // Get all OCGs in file
if (ocgArray != null) {
ocgArray.forEach(o => { console.println(`Name: ${o.name} State: ${o.state}`) })
}
getPageBox
Secure |
---|
No |
Returns a rectangle for the specified page box. See the Page Setup feature in Revu.
getPageBox(cBox, nPage)
cBox: [optional] The type of page box. The default is Crop. See below for the full list.
nPage: [optional] The 0-based page number. The default is 0.
The following are the valid options for cBox:
- "Art"
- "Bleed"
- "BBox"
- "Crop"
- "Media"
- "Trim"
Returns an array of numbers specifying the rectangle.
example:
var rect = this.getPageBox("Crop")
var width = rect[2] - rect[0]
var height = rect[1] - rect[3]
console.println(`Width: ${width} Height: ${height}`)
getPageLabel
Secure |
---|
No |
Returns the page label for the specified page.
getPageLabel(nPage)
nPage: [optional] The 0-based page number. The default is 0.
Returns the page label string.
example:
var label = this.getPageLabel(5)
console.println("Page 6 label: " + label) // Might print "vi" for roman numerals
getPageRotation
Secure |
---|
No |
Returns the rotation of the specified page in degrees.
getPageRotation(nPage)
nPage: [optional] The 0-based page number. The default is 0.
Returns the rotation in degrees (0, 90, 180, or 270).
example:
var rotation = this.getPageRotation(0)
console.println("First page rotation: " + rotation)
getPrintParams
Secure |
---|
No |
Returns a PrintParams
object that can be used to control printing options.
getPrintParams()
Returns a PrintParams object.
example:
var pp = this.getPrintParams()
pp.firstPage = 0
pp.lastPage = 4
pp.interactive = pp.constants.interactionLevel.automatic
this.print(pp)
getTemplate
Secure |
---|
No |
Returns a Template
object with the specified name.
getTemplate(cName)
cName: Name of the template
Returns a Template object.
example:
var template = this.getTemplate("MyTemplate")
gotoNamedDest
Secure |
---|
No |
Navigates to a named destination within the PDF file.
gotoNamedDest(cName)
cName: Name of the destination
example:
this.gotoNamedDest("Chapter2")
importAnFDF
Secure |
---|
No |
Imports form field data and annotations from an FDF file.
importAnFDF(cPath)
cPath: [optional] The device-independent path of the FDF file to import. If not specified, the user will be prompted to select a file.
example:
this.importAnFDF("/c/data/form_data.fdf")
importDataObject
Secure |
---|
No |
Imports a file as a data object (attachment) into the PDF.
importDataObject(cName, cDIPath, cCryptFilter)
cName: Name for the data object
cDIPath: [optional] The device-independent path of the file to import. If not specified, the user will be prompted to select a file. Requires elevated permissions when specified.
cCryptFilter: [optional] Not used by Revu
Returns true if the import was successful, false otherwise.
example:
// Prompt user to select a file
this.importDataObject("UserAttachment")
// Import specific file (requires elevated permissions)
this.importDataObject("Report", "/c/documents/report.xlsx")
importIcon
Secure |
---|
No |
Imports an image file as an icon into the PDF.
importIcon(cName, cDIPath, nPage)
cName: Name for the icon
cDIPath: [optional] The device-independent path of the image file. If not specified, the user will be prompted to select a file. Requires elevated permissions when specified.
nPage: [optional] Page number if importing from a PDF file. Default is 0.
Returns:
- 0 - Success
- 1 - User cancelled
- -1 - Could not open file
- -2 - Invalid page number
example:
var result = this.importIcon("CompanyLogo")
if (result == 0) {
console.println("Icon imported successfully")
}
insertPages
Secure |
---|
Yes |
Inserts pages from another PDF file into the current document.
insertPages(nPage, cPath, nStart, nEnd)
nPage: [optional] 0-based page number after which to insert pages. Default is 0.
cPath: [optional] The device-independent path of the source PDF file. If not specified, the user will be prompted to select a file.
nStart: [optional] 0-based index of the first page to insert from the source. Default is 0.
nEnd: [optional] 0-based index of the last page to insert from the source. Default is nStart.
example:
// Insert all pages from another PDF after page 5
this.insertPages(5, "/c/documents/appendix.pdf")
// Insert pages 2-4 from another PDF after the first page
this.insertPages(1, "/c/documents/source.pdf", 2, 4)
mailDoc
Secure |
---|
No |
Emails the PDF document as an attachment.
mailDoc(bUI, cTo, cCc, cBcc, cSubject, cMsg)
bUI: [optional] When true, the email client UI is shown. Default is true.
cTo: [optional] Semicolon-delimited list of recipients
cCc: [optional] Semicolon-delimited list of CC recipients
cBcc: [optional] Semicolon-delimited list of BCC recipients
cSubject: [optional] Email subject line
cMsg: [optional] Email body text
example:
this.mailDoc(true, "recipient@example.com", "", "", "PDF Document", "Please review the attached document.")
mailForm
Secure |
---|
No |
Emails the form data as an FDF attachment.
mailForm(bUI, cTo, cCc, cBcc, cSubject, cMsg)
bUI: [optional] When true, the email client UI is shown. Default is true.
cTo: [optional] Semicolon-delimited list of recipients
cCc: [optional] Semicolon-delimited list of CC recipients
cBcc: [optional] Semicolon-delimited list of BCC recipients
cSubject: [optional] Email subject line
cMsg: [optional] Email body text
example:
this.mailForm(true, "forms@example.com", "", "", "Form Submission", "Form data attached.")
movePage
Secure |
---|
No |
Moves a page to a new position within the document.
movePage(nPage, nAfter)
nPage: [optional] 0-based index of the page to move. Default is 0.
nAfter: [optional] 0-based index of the page after which to place the moved page. Use -1 to move to the beginning. Default is 0.
example:
// Move page 5 to the beginning
this.movePage(5, -1)
// Move page 2 after page 10
this.movePage(2, 10)
newPage
Secure |
---|
Yes |
Inserts a new blank page into the document.
newPage(nPage, nWidth, nHeight)
nPage: [optional] 0-based index where the new page will be inserted. Default is 0.
nWidth: [optional] Width of the new page in points. Default is 612 (8.5 inches).
nHeight: [optional] Height of the new page in points. Default is 792 (11 inches).
example:
// Add a new letter-sized page at the beginning
this.newPage(0)
// Add a new A4 page (595 x 842 points) after page 3
this.newPage(3, 595, 842)
openDataObject
Secure |
---|
No |
Opens an embedded PDF data object as a new document.
openDataObject(cName)
cName: Name of the data object to open
Returns a Doc
object if the data object is a PDF, null otherwise.
example:
var attachedDoc = this.openDataObject("embedded.pdf")
if (attachedDoc) {
console.println("Opened: " + attachedDoc.documentFileName)
}
Secure |
---|
No |
Prints the document or specified pages.
print(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotations, printParams)
bUI: [optional] When false, prints without showing the print dialog. Requires elevated permissions. Default is true.
nStart: [optional] 0-based index of the first page to print. Default is 0.
nEnd: [optional] 0-based index of the last page to print. Default is last page.
bSilent: [optional] When true, suppresses the cancel dialog during printing. Default is false.
bShrinkToFit: [optional] When true, shrinks pages to fit the paper size. Default is false.
bPrintAsImage: [optional] When true, prints pages as images. Default is false.
bReverse: [optional] When true, prints pages in reverse order. Default is false.
bAnnotations: [optional] When true, prints annotations. Default is true.
printParams: [optional] A PrintParams
object with print settings. When specified, other parameters are ignored.
example:
// Print with dialog
this.print()
// Print pages 1-3 silently (requires privileges)
this.print(false, 0, 2, true)
// Print using PrintParams object
var pp = this.getPrintParams()
pp.firstPage = 0
pp.lastPage = 4
this.print(pp)
removeDataObject
Secure |
---|
No |
Removes an embedded data object from the PDF.
removeDataObject(cName)
cName: Name of the data object to remove
example:
this.removeDataObject("oldAttachment.xlsx")
removeField
Secure |
---|
No |
Removes a form field from the PDF.
removeField(cName)
cName: Name of the field to remove
example:
this.removeField("obsoleteField")
removeIcon
Secure |
---|
No |
Removes an icon from the PDF.
removeIcon(cName)
cName: Name of the icon to remove
example:
this.removeIcon("oldLogo")
resetForm
Secure |
---|
No |
Resets form fields to their default values.
resetForm(aFields)
aFields: [optional] Array of field names to reset. If not specified, all fields are reset.
example:
// Reset all fields
this.resetForm()
// Reset specific fields
this.resetForm(["name", "email", "phone"])
setDataObjectContents
Secure |
---|
No |
Updates the contents of an existing data object.
setDataObjectContents(cName, oStream, cCryptFilter)
cName: Name of the data object to update
oStream: A ReadStream
object containing the new contents
cCryptFilter: [optional] Not used by Revu
example:
var stream = util.streamFromString("New file contents", "utf-8")
this.setDataObjectContents("data.txt", stream)
setPageBoxes
Secure |
---|
No |
Sets the dimensions of a page box for specified pages.
setPageBoxes(cBox, nStart, nEnd, rBox)
cBox: [optional] Type of page box to set. Default is "Crop". Valid values are:
- "Art"
- "Bleed"
- "Crop"
- "Media"
- "Trim"
nStart: [optional] 0-based index of the first page. Default is 0.
nEnd: [optional] 0-based index of the last page. Default is nStart.
rBox: [optional] Array of 4 numbers [left, top, right, bottom] defining the rectangle.
example:
// Set crop box for page 1
this.setPageBoxes("Crop", 0, 0, [72, 72, 540, 720])
// Set media box for all pages
this.setPageBoxes("Media", 0, this.numPages - 1, [0, 0, 612, 792])
setPageLabels
Secure |
---|
No |
Sets page labels for specified pages.
setPageLabels(nPage, aLabel)
nPage: [optional] 0-based page number where labeling begins. Default is 0.
aLabel: [optional] Array with label settings:
- [0] - Style: "", "D" (decimal), "r" (lowercase roman), "R" (uppercase roman), "a" (lowercase letters), "A" (uppercase letters)
- [1] - Prefix string
- [2] - Starting number
example:
// Set pages to use roman numerals starting with "i"
this.setPageLabels(0, ["r", "", 1])
// Set pages to use "Chapter A-" prefix with uppercase letters
this.setPageLabels(10, ["A", "Chapter ", 1])
// Remove page labels
this.setPageLabels(0)
setPageRotations
Secure |
---|
No |
Sets the rotation for specified pages.
setPageRotations(nStart, nEnd, nRotate)
nStart: [optional] 0-based index of the first page. If not specified, applies to all pages.
nEnd: [optional] 0-based index of the last page. Default is nStart.
nRotate: [optional] Rotation in degrees (0, 90, 180, or 270). Default is 0.
example:
// Rotate page 1 by 90 degrees
this.setPageRotations(0, 0, 90)
// Rotate pages 5-10 by 180 degrees
this.setPageRotations(5, 10, 180)
// Reset all pages to 0 rotation
this.setPageRotations(0, this.numPages - 1, 0)
spawnPageFromTemplate
Secure |
---|
No |
Creates a new page from a template.
spawnPageFromTemplate(cTemplate, nPage, bRename, bOverlay, oXObject)
cTemplate: Name of the template to spawn
nPage: [optional] 0-based page number where the template will be spawned. Default is 0.
bRename: [optional] When true, renames fields to avoid conflicts. Default is true.
bOverlay: [optional] When true, overlays the template on an existing page. When false, inserts as a new page. Default is true.
oXObject: [optional] Object with form field data to populate the spawned template
example:
// Spawn template as overlay on page 5
this.spawnPageFromTemplate("InvoiceTemplate", 5, true, true)
// Spawn template as new page with data
var data = {
"invoice_number": "12345",
"date": "2024-01-15",
"amount": "$1,234.56"
}
this.spawnPageFromTemplate("InvoiceTemplate", 3, true, false, data)
submitForm
Secure |
---|
No |
Submits form data to a specified URL.
submitForm(cURL, bFDF, bEmpty, aFields, bGet, bAnnotations, bXML, bIncrChanges, bPDF, bCanonical, bExclNonUserAnnots, bExclFKey, cPassword, bEmbedForm, oJavaScript, cSubmitAs, bInclNMKey, aPackets, cCharset, oXML, cPermID, cInstID, cUsageRights)
cURL: URL to submit the form to
bFDF: [optional] When true, submit as FDF. Default is true.
bEmpty: [optional] When true, include fields with no value. Default is false.
aFields: [optional] Array of field names to submit. If not specified, all fields are submitted.
bGet: [optional] When true, use HTTP GET. When false, use POST. Default is false.
bAnnotations: [optional] When true, include annotations. Default is false.
bXML: [optional] When true, submit as XML. Default is false.
bIncrChanges: [optional] Not supported by Revu
bPDF: [optional] When true, submit the entire PDF. Default is false.
bCanonical: [optional] When true, include a canonical format. Default is false.
bExclNonUserAnnots: [optional] When true, exclude non-user annotations. Default is false.
bExclFKey: [optional] When true, exclude the F key. Default is false.
cPassword: [optional] Not supported by Revu
bEmbedForm: [optional] When true, embed the form in the submitted data. Default is false.
oJavaScript: [optional] Not supported by Revu
cSubmitAs: [optional] Format for submission: "FDF", "HTML", or "PDF". Default is "FDF".
bInclNMKey: [optional] When true, include the NM key. Default is false.
aPackets: [optional] Not supported by Revu
cCharset: [optional] Character set for submission
oXML: [optional] Not supported by Revu
cPermID: [optional] Not supported by Revu
cInstID: [optional] Not supported by Revu
cUsageRights: [optional] Not supported by Revu
example:
// Submit all form fields as FDF
this.submitForm("https://example.com/submit")
// Submit specific fields as HTML POST
this.submitForm("https://example.com/submit", false, false, ["name", "email"], false, false, false, false, false, false, false, false, null, false, null, "HTML")
syncAnnotScan
Secure |
---|
No |
Ensures that all annotations have been scanned. Exists for compatibility reasons.
syncAnnotScan()