Database to document

PDF and Word Document Generation API

PDF and Word Generator API

Businesses create a variety of documents from their enterprise systems such as CRM, ERP, SCM, etc. The most common approach for the development of document automation functionality is by coding for each document template inside the core systems. It makes the code less modular and inflexible. Moreover, every time a template changes, the associated code requires modifications.

PDF generator API extends the enterprise application's core functionality in generating documents. Thus you can automate document generation from CRM, ERP and other front and back-office applications.

One of the USPs of API is it empowers your business users to use existing templates. They can create/edit templates in their favorite Word and PDF editors without seeking IT intervention.

EDocGen Word and PDF Generator API

It offers REST API that allows you to generate PDF and Word documents from various data sources including

  1. XML, JSON, and Excel data
  2. Databases including SQL and Oracle
  3. Enterprise systems
  4. Online forms

Using API, you can distribute generated documents through email, e-sign, print, and sync to cloud storage.

EDocGen is API first product and you can do pretty much everything that you can do with the online app. This includes the dynamic population of

  1. Text
  2. Tables
  3. Hyperlinks
  4. Images
  5. Content Blocks

Apart from this, API also supports multi-lingual document templates, Arithmetic calculations, conditional statements (if-else) that allow you to generate proposals, invoices, contracts, etc. without any manual intervention.

The PDF generation API is built for high performance and generate thousands of complex documents in a few seconds. Since the API calls are asynchronous, you can initiate high volume requests to generate millions of documents.

Using EDocGen, you can also create one document at a time. This is useful if you want to have a form on your website and want to create a PDF /Word document with user filled data.

Programming Language Support

REST API can be consumed either as SAAS or can be deployed on on-premise servers to accommodate your specific performance and security needs. With the RESTful API, the document generation becomes modular. Applications make a call to the API server and the API returns the desired output.

Generate PDF and Word documents from practically any programming environment. It doesn’t matter what language and platform you are using because you make browser calls to API working in your preferred programming environment :

  1. JavaScript
  2. PHP
  3. Python
  4. Ruby
  5. Java
  6. C#
  7. VB.NET

Execution Steps

Document generator API

Here are the steps to authentication and making the REST API call to the EDocGen.

  1. API uses token-based web authentication. Register and obtain an access token by passing username and password to /login. Use this token for every API call
  2. Order of actions is Upload template -> Generate documents -> Search Output by name and get ID --> Download
    1. Upload template through Post call
    2. Get the template id.

    3.   $ curl '' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:86.0) Gecko/20100101 Firefox/86.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'x-access-token: tokenid' | json_pp
         "status" : 200,
         "documents" : [
               "_id" : "5f61dd26604d2322bb786d8e",
               "name": "test.docx",
    4. Generate documents by passing template id and data file

    5.  curl '' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:86.0) Gecko/20100101 Firefox/86.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/json;charset=utf-8' -H 'x-access-token: tokenid' -H 'Origin:' -H 'Connection: keep-alive' -H 'Referer:' -H 'Cookie: continually_user_id=3eyk8pxzw6rn; _ga=GA1.2.1505829491.1596462685; x-session-id=s%3A4dezI-EfFmWK4ikHM9HirDfLq37ZHviq.mwKON5WAuvOQfBs8wF3tOgQYGSUhnd0KyhhgNWXQlAfbdg' --data-raw '{"markers":{"ATM":"1234567","MA":[{"SNo":"1","Local_Time":"12:00:01","Type":"Time","Currency":"$","Amount":"350","Cash_Amount":"300","Discount":"10","Profit":"50","Your_Share":"30"}],"Sum":"450"},"documentId":"5f61dd26604d2322bb786d8e","async":true,"format":"pdf","outputFileName":"Output.pdf"}'
      Post data:
        "markers": {
          "ATM": "1234567",
          "MA": [
              "SNo": "1",
              "Local_Time": "12:00:01",
              "Type": "Time",
              "Currency": "$",
              "Amount": "350",
              "Cash_Amount": "300",
              "Discount": "10",
              "Profit": "50",
              "Your_Share": "30"
          "Sum": "450"
        "documentId": "5f61dd26604d2322bb786d8e",
        "async": true,
        "format": "pdf",
        "outputFileName": "Output.pdf"
    6. Query for output files by name using /api/v1/output/name/{name}. Get the document identifier from the response. The file will only be available after a successful generation. To identify any problems with document generation, query events using /api/v1/events?startIndex=<startIndex>&endIndex=<endIndex>
    7. For downloading the output file, once id and token are known, you can simply do a get to<id>?access_token=<access-token>. On clicking this URL, the browser automatically asks for saving the output file. For bulk generation, the output is a zip file.

Frequently Asked Questions

Does my account give access to API?

If you have an active EDocGen account then you may use the API.

Can I use it in production?

Once you are ready to deploy, contact us to obtain production status.

Does your API support my programming language?

If your language can send HTTP requests and receive HTTP responses, then yes. This isn't a problem for modern languages.

What Dynamic field types EDocGen supports

EDocGen supports the dynamic population of Text, Tables, Hyperlinks, content blocks and Images. Apart from this, it also supports conditions (if-else) and calculations using basic arithmetic operations

Can I generate PDF documents

Yes. You can use both Word templates and fillable pdf templates for pdf document generation.

What are the delivery options available for assembled documents

1. Download generated documents in Zip containing PDF/Docx files. Single documents would be in PDF/Docx format.

2. Email generated file.

3. Sync generated files to Google Drive or SharePoint DMS.

Popular Posts