In this tutorial, we will show you how to parse data from purchase orders using PDF.co and PHP.

  1. PHP and HTML Source Code
  2. Start Apache Module
  3. Run Program
  4. Parsing Result
  5. Program Demo

Here’s the sample Purchase Order and the JSON output.

Sample Source Document and JSON Output
Sample Source Document and JSON Output

How to parse purchase orders to JSON using PDF.co Web API in PHP:

Step 1: PHP and HTML Source Code

  • To begin. First, copy the PHP and the HTML source code here. Next, save the files in a folder inside the /www or /htdocs directory depending on whether you are using XAMPP or WampServer.

PHP and HTML Source Code

Step 2: Start Apache Module

  • Next, start the Apache module so we can run the program on our local machine.

Start Apache Module

Step 3: Run Program

Now, let’s run the program.

  • Open your browser and type in localhost/Folder name/HTML file.
  • Next, add your API Key. You can get the API key in your PDF.co dashboard here
  • And, load your source PDF file.
  • Then, add the template in JSON or YML format. You can create a new template in PDF.co Document Parser Template Editor here. To learn more about PDF.co Document Parser, please visit this page.
  • Now, click on the Proceed button to send a request.

Run Program

Step 4: Parsing Result

  • Once the program successfully processed our request. Click on the output link to view the result.

Parsing Result

Step 5: Program Demo

  • Here’s the Purchase Order Parser in action.
Parse Purchase Order Demo
Parse Purchase Order Demo

In this tutorial, you learned how to parse data from Purchase Orders using PHP. You learned how to use the PDF.co Document Parser Template Editor and create a template in JSON or YML format. You also learned how to set up the code samples and run the program.

Related Pages:

Related Samples: