writeText

Inserts text boxes in a PDF file and uploads the resulting document in the file upload location.

Syntax

Copy
function writeText(sourceRealName: string, outputFileName: string, textList: any[], textOptions: any): string
 
Parameter Description
sourceRealName Unique internal ID of the source PDF file (real name).
outputFileName Name of the resulting PDF file where you wish to add the text boxes. The file name must include the .pdf file extension.
textList Array of JSON objects containing the text boxes coordinates, text contents, and page numbers in the source PDF where they must be inserted.
textOptions JSON object containing formatting parameters for the inserted text.

The textList parameter has the following structure:

Copy
[
    {rect:{left: <'box 1 left margin'>, right: <'box 1 right margin'>, bottom: '<box 1 bottom margin>', top: '<box 1 top margin>'}, text:'<dummy text>', page: <source PDF box 1 page no.>, newText:'<box 1 text contents>'});
    {rect:{left: <'box 2 left margin'>, right: <'box 2 right margin'>, bottom: '<box 2 bottom margin>', top: '<box 2 top margin>'}, text:'<dummy text>', page: <source PDF box 2 page no.>, newText:'<box 2 text contents>'});
    ...
];

The textOptions object includes text formatting attributes, for example:

Copy
{fontColor: 'Black', fontSize: 10, fontName: 'Arial'}

Return Value

Returns a string containing the saved PDF's real name.

Type Aliases

 

Examples