PDF File
Read a signed PDF file and extract data coming from the embedded certificate
The source PDF file is identified starting from the source directory id + fileName.
The specified PDF file is signed file, i.e. it contains a certificate; this certificate is then extracted and saved in the destination directory. The certificate file, if recognized with a MIME type, is renamed to a name having the original name + its real extension. Otherwise, it is saved with the original source file name.
Syntax
Details
The returned javascript object contains the following attributes:
expirationDate
firstName
lastName
personId
signerCountry
signerId
signerOrganization
personalVatNumber
corporateVatNumber
corporateName
personCountry
mimeType - MIME type for the embedded file; e.g. application/xml, application/pdf, etc.
destFilePath - absolute path + file name, related to the embedded file
signDate - the sign date, expressed as a javascript Date
Writing a very long PDF file on the server file system
From 6.0.2 version
Write a very long PDF file on the server file system, through a 3 steps approach:
first, open the output stream, through the "openPDFFile" method; it can work with already existing files as well, but in such a case, the memory consumption is higher and it is not recommended to read an already existing file if this is pretty big (hundreds pages or more).
next, add as many rows as you need, by invoking the "addLineToPDFFile" method multiple times, for each row to add
finally, close the output stream, by invoking the "closePDFFile"
Data could be retrieved from a SQL query, through the executeQueryWithCallback method, since this will ensure a limited amount of memory consumption.
Important note: the PDF file can be filled starting from a set of text lines; all lines inherit the same style (font + line height); lines are appended automatically, each with the same specified height; it is possibile to define the page size (e.g. A4, Letter, etc.), orientation (portrait vs landscape) and margins; a new page is automatically created when appended lines reach the bottom part of the current page.
This method can be used to create up to 1M lines (more or less some tens thousand pages), approximately in 15 mins, consuming about 200Mb of memory. Memory is upper-bound limited to such amount, since data is automatically flushed every 1000 pages.
Syntax for openPDFFile method
Details
Syntax for addLineToPDFFile method
Details
Syntax for loadPDFFont method
Use this method to register an external TTF font to use within this PDF, through setLineToPDFFile
Details
Syntax for setLineToPDFFile method
Details
Syntax for addImageToPDFFile method
Details
Syntax for addBarcodeToPDFFile method
Details
Syntax for closePDFFile method
Details
Example
Syntax for addPageToPDFFile method
It can be used to force the creation of a new page.
Details
Syntax for movePDFPage method
It can be used to move the cursor to the specified page (index starts from 0). Use this method only if an already existing file has been read (overwriteFile attribute set to false).
Only after invoking this method, the setLineToPDFPage can be invoked.
Details
Syntax for getPDFPageCount method
It can be used to get the total number of pages in an already existing PDF document.
Details
Syntax for getPDFOrientation method
It can be used to get the PDF page orientation, for an already existing PDF document.
Details
Writing a background text to a PDF file
From 6.0.2 version
Starting from an already existing PDF file, this method adds a text in the middle of the page, for each page, in the background.
Syntax
Details
Note: if no settings has been specified, the default values reported above will be used.
Protecting a PDF file
From 6.0.2 version
Starting from an already existing PDF file, this method defines the protection policy to add to a document for password-based protection: it protects a PDF document with password for the document owner and in read-only for the generic user
Syntax
Details
Merging multiple PDF files
Starting from already existing PDF files, this method creates a new PDF files composed of all the other files, appended in the same order specified in the input list.
Syntax
Details
Last updated