Sign In

PDF Generation

You can use AppSynergy's PDF Generator to convert dynamically generated HTML from your database data into a PDF document. This is often used for generating customer-facing documents like proposals, quotes, invoices, etc.

This feature works by calling an AppSynergy API. Please see Making RESTful API calls from PL/SQL for details.


This example uses two stored procedures, one to generate the PDF (the request procedure), and one to save the PDF into your database (the callback procedure). You can create and manage stored procedures via Tools > Stored Routines.

Request Procedure - Generating the PDF

Simply call parasql_http() as shown below. Replace YOUR_API_KEY with an actual API key you create via Tools > API Keys. In the example below the HTML is dynamically generated via a stored function called Invoice_GetHTML(); you can see its code here.

BEGIN CALL parasql_http( 'POST', '', JSON_OBJECT( 'filename', 'MyInvoice.pdf', 'html', Invoice_GetHTML(12345), -- call a function to generate the HTML 'makePublic', true ), 'MyCallback', -- name of your callback procedure NULL, NULL ); END

Callback Procedure - Save the generated PDF

Your callback procedure must take the following parameters:
respCode INTEGER, respBody JSON, respHeaders JSON, callbackData JSON

BEGIN INSERT INTO Invoice (Invoice_ID, Invoice_PDF) VALUES (parasql_next_val('Invoice'), JSON_VALUE(respBody, '$.data.documentField') ); END

API Specification


POST { "html": "<html><body><h1>Hello World</h1></body></html>", "filename": "HelloWorld.pdf", "makePublic": false }


{ "status": "OK", "errorMessage": "", "errorCode": "", "data": { "documentField": "HelloWorld.pdf;1048;1598992707098;database/files/a655f610-febd-4f6a-b11d-6bcd696f5456.pdf" } }