PDF Form Filler Service
The PDF Form Filler Service allows you to inject database data into a pre-existing PDF template
and store the completed document in your database.
This can be used for auto completing documents like tax forms, customs documents, etc.
You access the PDF Form Filler service by
making an API call
as shown below.
Example - Populate a PDF Template
Simply call parasql_http() as shown below.
Replace YOUR_API_KEY with a key you create via Tools > API Keys.
CALL parasql_http(
'POST',
'https://www.appsynergy.com/api?action=PDF_AUTOFILL&apiKey=YOUR_API_KEY',
JSON_OBJECT(
'sourcePdf', myDocumentField, -- a document field that contains the PDF template
'outputFilename', 'Filled_TAX_W2.pdf',
'fieldValues', JSON_OBJECT(
'SSN', '012-34-5678', -- be sure to use fully qualified field names
'FirstName', 'Bob',
'LastName', 'Smith'
),
'flattenFields': 'FILLED', -- enum: NONE, FILLED, ALL
'ignoreMissingFields': true
),
'MyCallback', -- name of your callback procedure
NULL,
NULL
);
If you do not know the field names for the fieldValues property you can specify anything to begin with and
the response will contain a list of valid field names.
The flattenFields option determines if editable fields are made read-only in the output PDF.
The Response
Your callback procedure must take the following parameters:
respCode INTEGER, respBody JSON, respHeaders JSON, optMetadata JSON
The respBody will look like this:
{
"status": "OK",
"errorMessage": "",
"errorCode": "",
"data": {
"outputPdf": "MyFilledW2TaxForm.pdf;12048;1598992709098;database/files/a655f610-febd-4f6a-b11d-6bcd696f5466.pdf",
"pdfFieldInfo": [
{
"fullyQualifiedName": "topmostSubform[0].Copy1[0].BoxA_ReadOrder[0].f2_01[0]",
"isRequired": "false",
"isReadOnly": "false",
"type": "Tx"
},
{
"fullyQualifiedName": "topmostSubform[0].Copy1[0].Col_Left[0].f2_02[0]",
"isRequired": "false",
"isReadOnly": "false",
"type": "Tx"
}
]
}
}
You can get the outputPdf document field value like this:
JSON_VALUE(respBody, '$.data.outputPdf')
Your callback procedure will need to save the outputPdf to your database
with code something like this:
INSERT INTO MyTable (MyTable_ID, MyDocumentField)
VALUES (parasql_next_val('MyTable'), JSON_VALUE(respBody, '$.data.outputPdf') );