Document
Functions to edit and get informations from documents e.g. PDF, word
decode Base64(data, filename)
Decode string in Base64 encoding into a File
| Name | Required | Type | Description |
|---|---|---|---|
data |
Yes |
Text |
Base64 file content |
filename |
Yes |
Text |
File name with extension |
File |
document.decode Base64("aGVsbG8=", "document.pdf") => "file"
decode Base64 from data url(data, filename)
Decode data url string with Base64 encoding into a File
| Name | Required | Type | Description |
|---|---|---|---|
data |
Yes |
Text |
Base64 file content |
filename |
Yes |
Text |
File name with extension |
File |
document.decode Base64 from data url("data:application/pdf;base64,aGVsbG8=", "document.pdf") => "file"
encode Base64(data)
Encode file content using the Base64 encoding
| Name | Required | Type | Description |
|---|---|---|---|
data |
Yes |
File |
Object |
Text |
document.encode Base64(file) => "aGVsbG8="
encode Base64 to data url(data)
Encode file content using the Base64 encoding and return it in data url format
| Name | Required | Type | Description |
|---|---|---|---|
data |
Yes |
File |
Object |
Text |
document.encode Base64 to data url(file) => "data:application/pdf;base64,aGVsbG8="
pdf extract form(PDF File, [regex])
Function that returns values from fields in a pdf form if present.
| Name | Required | Type | Description |
|---|---|---|---|
PDF File |
Yes |
File |
PDF file to extract form from |
regex |
No |
Text |
Regular expression that allows to filter out fields of the PDF form. Default regex is: (page|section|#subform|subform|overflowpage|master|frontpage).* |
Any |
document.pdf extract form(pdf) => "Returns contents inside the form, if any"
document.pdf extract form(pdf, regex) => "Returns the filtered contents inside the form, if any"
pdf extract pages(PDF File, From Page, [To Page], [File Name])
Function that returns a PDF with only the page range given in the parameters.
| Name | Required | Type | Description |
|---|---|---|---|
PDF File |
Yes |
File |
PDF file to extract pages from |
From Page |
Yes |
Number |
First page to extract |
To Page |
No |
Number |
Optional last page to extract. If not provided, all pages from the From Page until the end of the document will be extracted. |
File Name |
No |
Text |
Optional file name for the resulting extracted PDF file. If not provided, a default name will be used. |
File |
document.pdf extract pages(pdf, 1, 1) => "Returns only the first page of the pdf as a new file"
document.pdf extract pages(pdf, 3) => "Returns pages from the third one until the end of the document"
document.pdf extract pages(pdf, 3, "Relevant Sections") => "Returns pages from the third one until the end of the document in a PDF named \"Relevant Sections\""
document.pdf extract pages(pdf, 3, 5, "Relevant Sections") => "Returns pages from the third one until the fifth page in a PDF named \"Relevant Sections\""
pdf extract text(PDF File, [From Page], [To Page])
Function that returns the plain text of the pdf file as an array of text, one entry for each page
| Name | Required | Type | Description |
|---|---|---|---|
PDF File |
Yes |
File |
PDF file to extract form from |
From Page |
No |
Number |
First page to extract |
To Page |
No |
Number |
Last page to extract |
Collection of Text |
document.pdf extract text(pdf) => "[\"Hello\", \"World\"]"
document.pdf extract text(pdf, 1, 3) => "[\"Hello\", \"World\", \"Trisotech\"]"
document.pdf extract text(pdf, 2) => "[\"World\", \"Trisotech\"]"
document.pdf extract text(pdf, 2, 2) => "[\"World\"]"
pdf fill form(Contents, PDF File, [File Name])
Function that fills the content of a PDF form
| Name | Required | Type | Description |
|---|---|---|---|
Contents |
Yes |
Any |
A set of key-value pairs where each key corresponds to the name of a field in the PDF form, and each value is the information you want to insert into that field. This is written as a FEEL context (e.g., { "firstName": "John", "age": 35 }) |
PDF File |
Yes |
File |
PDF file to fill |
File Name |
No |
Text |
Optional file name for the resulting filled PDF file. If not provided, a default name will be used. |
File |
document.pdf fill form(contents, pdf to fill) => "Returns the provided PDF filled with the provided contents"
document.pdf fill form(contents, pdf to fill, "Passport Request") => "Returns the provided PDF filled with the provided contents in a PDF named \"Passport Request\""
pdf merge(First PDF File, Second PDF File, [File Name])
Function that merge two pdf together.
| Name | Required | Type | Description |
|---|---|---|---|
First PDF File |
Yes |
File |
First PDF File to merge |
Second PDF File |
Yes |
File |
Second PDF File to merge |
File Name |
No |
Text |
Optional file name for the resulting merged PDF file. If not provided, a default name will be used. |
File |
document.pdf merge(pdf1, pdf2) => "Returns a resulting pdf with the pages from pdf2 appended to pdf1"
document.pdf merge(pdf1, pdf2, "Combined Forms") => "Returns a resulting pdf with the pages from pdf2 appended to pdf1 in a PDF named \"Combined Forms\""
pdf meta info(PDF File)
Function that returns meta information from a PDF, such as number of pages, if it is digitally signed, protected and meta information.
| Name | Required | Type | Description |
|---|---|---|---|
PDF File |
Yes |
File |
PDF file to extract information from |
document.pdf meta info(pdf) => "Returns a map of available information"
word extract text(Word File, [From Page], [To Page])
Function that returns the plain text of the word file as an array of text, one entry for each page. Please note that document has to be paginated to make from and to parameters effective.
| Name | Required | Type | Description |
|---|---|---|---|
Word File |
Yes |
File |
Word file to extract form from |
From Page |
No |
Number |
First page to extract |
To Page |
No |
Number |
Last page to extract |
Collection of Text |
document.word extract text(word) => "[\"Hello\", \"World\"]"
document.word extract text(word, 1, 3) => "[\"Hello\", \"World\", \"Trisotech\"]"
document.word extract text(word, 2) => "[\"World\", \"Trisotech\"]"
document.word extract text(word, 2, 2) => "[\"World\"]"
Data Types
MetaInfo
Meta information about PDF file
Properties
| Name | Type | Description |
|---|---|---|
author |
Text |
Author (expressed as String) |
can extract content |
Boolean |
Document’s content can be extracted (expressed as Boolean) |
can fill in form |
Boolean |
Document’s form can be filled in (expressed as Boolean) |
can modify |
Boolean |
Document can be modified (expressed as Boolean) |
creation date |
Text |
Creation date (expressed as Date and time) |
creator |
Text |
Creator (expressed as String) |
is encrypted |
Boolean |
Document is encrypted (expressed as Boolean) |
is signed |
Boolean |
Document is signed (expressed as Boolean) |
modification date |
Text |
Title (expressed as Date and time) |
pages count |
Number |
Number of pages (expressed as a Number) |
producer |
Text |
Producer (expressed as String, e.g. Microsoft: Print To PDF) |
title |
Text |
Title (expressed as String) |