Step 1: Source Code and Template
To begin, open the Visual Studio Code or your favorite editor and save the following files.
Step 2: Install Requests Module
To install the requests module, kindly type the
npm install requests in your terminal. We will use this requests module for file upload.
Step 3: Insert API Key
In line 12, insert your API key inside the double quote. You can get the API key in your PDF.co dashboard here.
Step 4: Source and Destination File
In line 15, add your source PDF file and type your desired output file name in line 19. Aside from JSON output, you can also extract tables with text in CSV and XML formats.
Step 5: Add Template
In line 96, add the template name. The Document Parser supports both JSON and YML template formats.
For more details about Document Parser Template, check out this page.
To run the program, simply type
node file.js in the terminal.
Step 7: Extract Table with Text Demo
Here’s a quick demo to extract a table with text from the PDF.