Guides
Export a PDF
Generate and download a PDF of a document that can be pushed to another system.
Overview
Often you will want to keep copies of completed and approved documents in another system of record. To enable this the GraphQL API provides the exportDocument mutation. Exporting a PDF of a document can take a moment, so it is done in two steps.
- Request that a document be exported
- When the export operation is complete, download the PDF document.
Enable document export
By default documents are not exportable. This is a configurable setting in each app. Before you can export a document through code you'll need to enable that setting. It's the Allow the exporting of documents in this app in the Form Settings of each app.
If you don't turn on this setting, you'll receive errors when you attempt to export a document via the GraphQL API.
Callback URL
This operation requires that you have a web server setup that exposes a callback URL that Kuali can call when the export operation is complete and the exported document is ready for download. Kuali will call this URL/server with information about the document and where it can be downloaded.
Step 1: Request that the document be exported
To initialize the export, call the exportDocument mutation. There are three variables you need to set for this to work.
- id: This is the id of the document that you want to export.
-
options:
Determines what to include in the export. One or more of the options can be used at a time.
- document: Includes the main document content.
- history: Includes the workflow history of the document.
- comments: Includes comments made by approvers in the workflow process.
- callbackUrl: When the export is prepared Kuali will call this url with information on where to retrieve the exported document.