Name: nuxeo-platform-pdf-utils
Owner: Nuxeo
Description: Nuxeo Platform PDF Utils addon
Created: 2016-11-03 09:07:20.0
Updated: 2016-11-07 12:25:08.0
Pushed: 2018-05-18 09:29:45.0
Homepage: null
Size: 1177
Language: Java
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A set of utilities to deal with PDFs from a nuxeo application.
These operations can be used in Studio after importing their JSON definitions to the Automation registry.
A quick reminder: To get the JSON definition of an operation, you can install the plug-in, start nuxeo server then go to {server:port}/nuxeo/site/automation/doc. All available operations are listed, find the one you are looking for and follow the links to get its JSON definition.
PDF: Add Page Numbers
(id PDF.AddPageNumbers
)
Accepts a Blob, returns a Blob
The input blob must be a PDF
The returned blob contains the page numbers, displayed using the parameters (position, font, …)
The following parameters let you tune the operation:
startAtPage
(default: 1)
startAtNumber
(default: 1)
position
Can be Bottom right, Bottom center, Bottom left, Top right, Top center, or Top left
Default: Bottom Right
fontName
(default: Helvetica)
fontSize
(default: 16)
hex255Color
Expressed as either 0xrrggbb or #rrggbb (case insensitive)
Default value: 0xffffff
password
: If the PDF is encrypted, the password that will allow modification.
PDF: Extract Pages
(id PDF.ExtractPages
)
Accept either a blob or a document as input
Returns a blob built with the extracted pages
If the input is a document, the xpath
parameter must be used (default: file:content
)
The following parameters let you tune the operation:
startPage
If < 1 => realigned to 1
If > endPage
or > number of pages, a blank PDF is returned
endPage
If > number of pages, it is realigned to the number of pages
fileName
If not used, the filename will be the original file name plus the page range. For example, if the original name was “mydoc.pdf” and you extract pages 10 to 25, the resulting PDF will have a file name of “mydoc-10-25.pdf”.
pdfTitle
If not used, title is not set
Warning: This is not the dc:title
. It is the title as stored in the metadata of the PDF.
pdfSubject
If not used, subject is not set
pdfAuthor
If not used, author is not set
password
: If the PDF is encrypted, the password that will allow extraction.
PDF: Merge with Blob(s)
(id PDF.MergeWithBlobs
)
This operation merges all the blobs in a specific order (see below) and returns the final, merged PDF. Some properties (subject, …) can also be set at the same time (optional)
The order of the PDF is the following:
Input blob
Blob referenced by the Context variable whose name is toAppendVarName
Blobs referenced as a BlobList
by the Context variable whose name is toAppendListVarName
Blobs stored in the documents whose IDs are referenced as a String List
by the Context variable whose name is toAppendDocIDsVarName
The xpath
parameter is used to get the blob in each document
Optional. Default value is file:content
Important: The operation expects the Context variable names, not the values of the variables. For example in Studio, say you have a multivalued String field named myschema:the_ids
. It stores IDs of documents (typically, filled by the user using a “Multiple Documents Suggestion Widget”). In an Automation Chain, to merge the PDF embedded in a these documents with an input blob you would write (see we use listArticles
, not @{listArticles}
):
. previous operations . . .
Context Variable
: listArticles
e: @{Document["myschema:the_ids"]}
.
Merge with Blob(s)
her parameters
pendDocIDsVarName: listArticles
These parameters are optional. Still, you probably want to use at least one of them :-)
PDF: PDF: Merge with Document(s)
(id PDF.MergeWithDocs
)
See the documentation of PDF: Merge with Blob(s)
The difference is that the input is a document. The operation extracts the blob from the xpath
field. Notice that it is ok for this blob to be null, the operation will still merge all the other blobs referenced in the parameters
PDF: Info to Fields
(id PDF.InfoToFields
)
Extract the info of the PDF and put them in the fields referenced by the properties
parameter, return the modified document. If there is no blob or if the blob is not a PDF, all the values referenced in properties
are cleared (set to empty string, 0, …)
Parameters:
xpath
: The xpath of the blob to handle in the document. Default value is file:content
save
: If true, the document is saved after its fields have been populatedproperties
key=value
list (one key-value pair/line), where key
is the xpath of the destination field and value
is one of the following (case sensitive): name
size
version
count
size
width
height
layout
e
or
ect
producer
ent creator
tion date
fication date
ypted
ords
a box width
a box height
box width
box height
Print
Modify
Extract
Modify Annotations
Fill Forms
Extract for Accessibility
Assemble
Print Degraded
The permission fields (starting with “Can …“) contain “true” or “false”. Every field is “true” if the document is not encrypted or is opened with the owner password.
InfoOfPDF
schema, prefix iop
, with misc. fields. You could write:pdf_version=PDF version
page_count=Page count
page_size=Page size
tc...
PDF: Watermark with Text
(id PDF.WatermarkWithText
)
Accepts a Blob, returns a Blob
Returns a new blob combining the input PDF and the watermark
text set on every pages, using the different properties
.
If watermark
is empty, a simple copy of the input blob is returned
properties
is a key=value
set where key
can be one of the following. When not used, a default value applies:
fontFamily
(default: “Helvetica”)fontSize
(default: 36.0)rotation
(default: 0)hex255Color
(default: “#000000”)alphaColor
(default: 0.5)xPosition
(default: 0)yPosition
(default: 0)invertY
(default: “false”)More details about some properties
:
xPosition
and yPosition
start at the bottom-left corner of each pagealphaColor
is a float with any value between 0.0 and 1.0. Values < 0 or > 1 are reset to the default 0.5PDF: Watermark with Image
(id PDF.WatermarkWithImage
)
Accepts a Blob, returns a Blob
Returns a new blob combining the input PDF and an image set on every page (using the x
, y
and scale
parameters)
The image to use for the watermark can be one of the following:
imageContextVarName
: A Context variable which references a Blob containing the image.
imageDocRef
: The path or the ID of a document whose file:content
field contains the image to use
Notice: If imageDocRef`
is used, an UnrestrictedSession
fetches its blob, so the PDF can be watermarked even if current user has not enough right to read the watermark itself.
Notice: The operation first checks for imageContextVarName
.
x
and y
start at the bottom-left of the page
Dimensions of the image will be * by scale
(so 1.0 means “Original size”, 0.5 means half the size. 4 means four time the size, …)
PDF: Watermark with PDF
(id PDF.WatermarkWithPDF
)
Accepts a Blob, returns a Blob
Returns a new blob combining the input pdf and an overlayed PDF on every page
The PDF to use for the watermark can be one of the following:
pdfContextVarName
: A Context variable which references a Blob containing the PDF.
pdfDocRef
: The path or the ID of a document whose file:content
field contains the PDF to use
Notice: If pdfDocRef`
is used, anUnrestrictedSession
fetches its blob, so the PDF can be watermarked even if current user has not enough right to read the watermark itself.
Notice: The operation first checks for pdfContextVarName
.
This operation uses PDFBox
to overlay the PDF. The count of pages in each PDF can be different. Basically, the PDF to overlay will be repeated over the PDF to watermark. So for a final PDF of 10 pages:
PDF: Encrypt Read Only
(id PDF.EncryptReadOnly
)
Accepts Blob, Blobs, Document, Document(s)
Encrypts the PDF in readonly mode: User can print, copy, print degraded, extract info for accessibility, but cannot assemble, modify, modify annotations.
Returns a new blob, copy of the original one, but encrypted
Parameters:
originalOwnerPwd
: If the PDF is already encrypted, the password to open and modify itowenrPwd
; The new password to use for encryption. An owner can do everything on the PDF. If not passed, we use originalOwnerPwd
userPwd
: The password for users, who will have restriction (read only) on the PDFkeyLength
: The length to use for the encryption key. Possible values are 40 and 128. If no value is passed, 128 is usedxpath
: If the input is Document
or Documents
, the field where to get the blob from (file:content
by default)PDF: Encrypt
(id PDF.Encrypt
)
Accepts Blob, Blobs, Document, Document(s)
Encrypts the PDF with the permissions given in permissions
Returns a new blob, copy of the original one, but encrypted
Parameters:
originalOwnerPwd
: If the PDF is already encrypted, the password to open and modify itowenrPwd
; The new password to use for encryption. An owner can do everything on the PDF. If not passed, we use originalOwnerPwd
userPwd
: The password for users, who will have restriction (read only) on the PDFkeyLength
: The length to use for the encryption key. Possible values are 40 and 128. If no value is passed, 128 is usedxpath
: If the input is Document
or Documents
, the field where to get the blob from (file:content
by default)permissions
is a key=value
set where key
can be one of the following. When not used, false
is applied (permission to do the action is denied):print
modify
copy
modifyAnnot
fillForms
extractForAccessibility
assemble
printDegraded
So for example, if you pass…
t=true
=true
… the user will only be able to print and copy.
PDF: Remove Encryption
(id PDF.RemoveEncryption
)
Accepts Blob, Blobs, Document, Document(s)
Remove the encryption
Returns a new blob, copy of the original one, not encrypted at all.
If the PDF already was encrypted, the operation still returns a copy of it (not the orginal blob)
Parameters:
wnerPwd
: Password to use to decrypt and remove the permissionsxpath
: If the input is Document
or Documents
, the field where to get the blob from (file:content
by default)PDF: Get Links
(id PDF.GetLinks
)
Accepts Blob
Returns a JSON String containing an array of objects. Each object has the following fields:
page
: The page number where the link issubType
: The subType of the field. This is PDFBox (underlying java tool used to handle the PDF) label. It can be one of the following: Launch
, GoToR
or URI
.text
: The text of the linklink
: The link itself (depending on subType
)Parameters
type
: One of the following (case insensitive):
Launch
Remote Go To
URI
getAll
: If true
, the operation returns a list of all the links (of category Launch, Remote Go To or URI)
Important: If getAll
is false
, type
must be filled (or an error will occur)
Conversion > PDF: Convert to Pictures
(id PDF.PDFToPictures
)
fileName
(default: PDF file name)fileName
+ page number
+ .png
. Optionalxpath
(default: file:content
)password
Nuxeo dramatically improves how content-based applications are built, managed and deployed, making customers more agile, innovative and successful. Nuxeo provides a next generation, enterprise ready platform for building traditional and cutting-edge content oriented applications. Combining a powerful application development environment with SaaS-based tools and a modular architecture, the Nuxeo Platform and Products provide clear business value to some of the most recognizable brands including Verizon, Electronic Arts, Sharp, FICO, the U.S. Navy, and Boeing. Nuxeo is headquartered in New York and Paris. More information is available at www.nuxeo.com.