workflow PDFExample1;
method main() {
//Open the document with key 100
var document = pdf->open(100);
var pageIndex = 1;
var top = 100;
var left = 150;
var size = 32;
var text = "Hello world";
pdf->writeText(document, pageIndex, top, left, size, text);
//Update the file
pdf->update(document, 100);
//Save the updated document to as new. The original document will remain unchanged.
var newStorageFileKey = pdf->save(document, "new-document-name.pdf");
}
workflow PDFExample2;
method main() {
//Open the document with key 100
var document = pdf->open(100);
var startPage = 1;
var endPage = 3;
var newDocument = pdf->extractPages(document, startPage, endPage);
//Save the new document. The original document will remain unchanged.
newDocument.fileName = "extracted.pdf";
var newStorageFileKey = pdf->save(newDocument);
}
function addPage(doc as pdfdocument) as int
Adds a new empty page to the document with size A4.
function addPageWithSize(doc as pdfdocument, width as decimal, height as decimal) as int
Adds a new empty page to the document with the specified size.
function convertPageToImage(doc as pdfdocument, page as int, fileName as string, format as int, dpi as int) as int
Converts one page from a PDF document to the specified image format.
format argument is one of the following:
0 for BMP1 for JPEG2 for WBMP3 for PNG4 for GIF5 for TIFFfunction copyPage(src as pdfdocument, page as int, dest as pdfdocument) as int
Copies a page from src document, appending it to the end of the dest PDF document.
method copyPageAtIndex(src as pdfdocument, page as int, dest as pdfdocument, index as int, overwrite as boolean)
Copies a page from src document, inserting it at the specified index of the dest PDF document between the existing pages.
If overwrite is true, then the page at the specified index is replaced in the dest PDF document.
function create() as pdfdocument
Creates a new PDF document with one empty page with size A4.
function createWithSize(width as decimal, height as decimal) as pdfdocument
Creates a new PDF document with one empty page with the specified size.
method drawBarcode(doc as pdfdocument, page as int, barcode as pdfbarcode)
Renders a barcode on the specified PDF page.
method drawImage(doc as pdfdocument, page as int, image as pdfimage)
Draws an image on the specified PDF page.
method drawRectangle(doc as pdfdocument, page as int, rectangle as pdfrectangle)
Draws a rectangle on the specified page.
method embedFile(doc as pdfdocument, storageFileKey as int)
Embeds a file into the PDF document.
function extractPages(doc as pdfdocument, startPage as int, endPage as int) as pdfdocument
Extracts a range of pages from a PDF document into a new document.
function getFieldNames(form as pdfform, fieldName as string) as list of string
Returns a list of all acro field names.
function getCheckBoxFieldValue(form as pdfform, fieldName as string) as bool
Returns the value of a CHECKBOX_FIELD. Throws an error if the field type does not match.
function getChoiceFieldValues(form as pdfform, fieldName as string) as list of string
Returns the value of a CHOICE_FIELD. Throws an error if the field type does not match.
function getFieldType(form as pdfform, fieldName as string) as int
Returns the type of the field identified by fieldName or null if no such field exists.
The return value is one of the following:
0 the field is BUTTON_FIELD1 the field is TEXT_FIELD2 the field is CHOICE_FIELD3 the field is CHECKBOX_FIELDfunction getImage(doc as pdfdocument, page as int, image as pdfimage) as byte[]
Retrieves the image data from the specified PDF page and image object.
function getPageCount(doc as pdfdocument) as int
Returns the number of pages in a PDF document.
function getPageHeight(doc as pdfdocument, page as int) as decimal
Returns the height of the page.
function getPageWidth(doc as pdfdocument, page as int) as decimal
Returns the width of the page.
function getSignatures(storageFileKey as int) as list of documentsignature
Returns the signatures for the PDF document with the specified storageFileKey.
function getSignaturesAtVersion(storageFileKey as int, storageVersion as int) as list of documentsignature
Returns the signatures for the PDF document with the specified storageFileKey and storageVersion.
function getTextLineWidth(doc as pdfdocument, text as pdftextline) as pdfsize
Size of rendered text.
function getTextWidth(doc as pdfdocument, fontSize as decimal, text as string) as pdfsize
Size of rendered text.
function getTextFieldValue(form as pdfform, fieldName as string) as string
Returns the value of a TEXT_FIELD. Throws an error if the field type does not match.
function merge(docA as pdfdocument, docB as pdfdocument) as pdfdocument
Merges two PDF documents into a new PDF document. The merge is done by copying all the pages from docA to the new document and after that copying all the pages from docB to the new document.
function open(storageFileKey as int) as pdfdocument
Opens an existing PDF document.
function openAtVersion(storageFileKey as int, version as int) as pdfdocument
Opens an existing version of a PDF document.
method insertPage(doc as pdfdocument, page as int)
Removes a page from the document.
function removeSignatures(storageFileKey as int, storageVersion as int) as int
Removes the signature fields of the PDF document with the specified storageFileKey and storageVersion.
function save(doc as pdfdocument) as int
Saves the PDF document to storage.
function scanBarcodes(doc as pdfdocument, dpi as int) as list of pdfbarcode
function sign(storageFileKey as int, storageVersion as int, pin as string, libraryPath as string
) as int
Signs the PDF document with the specified storageFileKey and storageVersion.
function update(doc as pdfdocument, key as int) as int
Updates the PDF document in storage.
method writeText(doc as pdfdocument, page as int, top as decimal, left as decimal, fontSize as decimal, text as string)
Writes the text at the specified page and offset. top: to be offset from the top of the page; left: to be offset from the left of the page.
method writeTextLine(doc as pdfdocument, page as int, text as pdftextline)
Writes text at the specified page.
string constant:192.168.5.150
TIMES_ROMANTIMES_BOLDTIMES_ITALICTIMES_BOLD_ITALICHELVETICAHELVETICA_BOLDHELVETICA_OBLIQUEHELVETICA_BOLD_OBLIQUECOURIERCOURIER_BOLDCOURIER_OBLIQUECOURIER_BOLD_OBLIQUESYMBOLZAPF_DINGBATSAbeerArialDejaVuSansCondensed-Boldint constant:
0 - AZTEC1 - CODABAR2 - CODE_393 - CODE_934 - CODE_1285 - DATA_MATRIX6 - EAN_87 - EAN_138 - ITF9 - MAXICODE10 - PDF_41711 - QR_CODE12 - RSS_1413 - RSS_EXPANDED14 - UPC_A15 - UPC_E16 - UPC_EAN_EXTENSION