Tech-Docs

Template Document Generation using Adobe Document Generation API

Table of Contents

Steps to Generate Token, Upload File, Generate Document (DOCX or PDF), and Retrieve Output

1. Create a Document Template

Use Microsoft Word to create a document template. Add template tags to indicate where dynamic content will be inserted. For example:

Document Template Example

Figure 1: Example of a document template in Microsoft Word with template tags.

2. Prepare Your JSON Data

Create a JSON file with the data that will replace the template tags. Ensure the JSON structure matches the template tags. For example:

{
  "customer_name": "Rajesh Kumar",
  "product": {
    "name": "Mystery Novel",
    "price": "399.00"
  },
  "order": {
    "number": "789012",
    "date": "2024-12-04",
    "delivery_date": "2024-12-10"
  },
  "company": {
    "name": "BookVista Publishers",
    "address": {
      "street": "123 Book Street",
      "city": "Mumbai",
      "zip": "400001"
    }
  },
  "author": "Anita Desai"
}

3. Get API Key from Adobe Developer Console

To interact with the Adobe Document Generation API, you need to obtain an API key from the Adobe Developer Console. Follow these steps:

  1. Sign in to Adobe Developer Console: Go to the Adobe Developer Console and sign in with your Adobe ID.
  2. Create a New Project: Click on “Create New Project” and give your project a name.
  3. Add an API: Select “Add API” and choose “Document Generation API” from the list.
  4. Generate API Key: Follow the instructions to generate an API key. Note down the client_id and client_secret as you will need these for authentication.

Adobe Developer Console Example

Figure 3: Steps to obtain an API key from the Adobe Developer Console.

4. Generate Token

Use Adobe’s Identity Management Service (IMS) to generate an access token.

Endpoint: https://ims-na1.adobelogin.com/ims/token

Request:

Response:

Obtaining access token Example

Figure 4: Generating an access token using Postman.

5. Get Upload Presigned URI

Get a pre-signed URL for uploading your file to Adobe’s cloud storage.

Endpoint: https://pdf-services.adobe.io/assets

Request:

Response:

Requesting presigned URI

Figure 5: Requesting a presigned URI for file upload using Postman.

6. Upload File

Use the pre-signed URL to upload your file to Adobe’s cloud storage.

Request:

Example:

PUT <UPLOAD_URI> HTTP/1.1
Host: <UPLOAD_HOST>

<FILE_CONTENT>

Response:

File Upload Example Figure 6: Uploading the file to Adobe’s cloud storage using Postman.

7. Document Generation (DOCX or PDF)

Submit a document generation job to Adobe’s API, specifying the desired format (DOCX or PDF) and providing the JSON data for merge.

Endpoint: https://pdf-services.adobe.io/operation/documentgeneration

Request:

Response:

Document Generation Request Example

Figure 7: Sending a document generation request using Postman.

8. Poll the Document Generation Periodically check the status of your document generation job using Adobe’s API until it’s completed

Endpoint: https://pdf-services-ue1.adobe.io/operation/documentgeneration//status

Request:

Response:

Check File Generation Status Example

Figure 8: Polling the status of document generation using Postman.

9. Get the Output File

Once the document generation is complete, download the output file from Adobe’s cloud storage.

Endpoint: <DOWNLOAD_URI>

Request:

Response:

Example:

GET <DOWNLOAD_URI> HTTP/1.1
Host: <DOWNLOAD_URI>

Response:

Download Generated Document Example

Figure 9: Downloading the generated document using Postman.

Notes:

This completes the detailed steps for integrating with Adobe Document Services API. 😊📄🚀