In this tutorial, we will show you how to extract specific text from a Quote using PDF.co and PHP.

  1. Source Code
  2. Start Apache Server
  3. Run Program
  4. Document Parser Result
  5. Demo

Here’s the image of our sample Quote.

Source PDF
Source PDF

And here’s the JSON output.

Document Parser Output
Document Parser Output

Step 1 – Source Code

First, let’s copy the PHP and the HTML source code here. 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 Server

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

Step 3 – Run Program

Now, let’s run the program.

  • Open your browser and type in localhost/Name of your folder/HTML file e.g., localhost/documentparser/program.html
  • In the API Key field, add your API Key. You can get the API key in your PDF.co dashboard here.
  • Click on the Choose File button to load your source PDF file.
  • And then, choose and open your template in JSON or YML format.
  • Now, click on the Proceed button to process your request.

Program HTML

To learn more about Document Parser, please visit this page.

Step 4 – Document Parser Result

Great! PDF.co successfully processed our request. Click on the output link to view the result.

Document Parser Output URL

Step 5 – Demo

Here’s the Quote Parser in action.

Parse Quote Demo
Parse Quote Demo

In this tutorial, you learned how to parse specific text in a Quote using PDF.co and PHP. You learned how to run the source code samples. You also learned how to convert the Quote into JSON format.