In this tutorial, we will show you how to extract tables with text from PDF in PHP using PDF.co Web API. The image below shows the source file, sample template, and the extracted table output.

  1. Source Code
  2. Start Apache
  3. Run Program
  4. Extracted Table Output
  5. Extract Table Demo

 

Sample PDF, Sample Template, and Extracted Table Output
Sample PDF, Sample Template, and Extracted Table Output

Step 1 – Source Code

To begin, let’s copy the HTML and the PHP source code here. Save it in a folder inside the /www or /htdocs directory depending on whether you are using XAMPP or WampServer

Source code

Step 2 – Start Apache

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

Step 3 – Run Program

Now, let’s run our program. Type in localhost/folder_name/sample.html in your browser. Then, enter your PDF.co API Key, sample PDF, and sample template. You can get your API Key in the dashboard here.

Run program

NOTE: You can get a copy of our sample files here.

Step 4 – Extracted Table Output

PDF.co will return a temporary URL to access the extracted table output. Kindly open the URL to see the result.

Extracted table output

Step 5 – Extract Table Demo

Here’s the Extract Table in action.

Extract Table Demo
Extract Table Demo

In this tutorial, you learned how to extract tables with text in PHP using PDF.co Web API. You also learned how easy it is to set up the code samples to get your program running right away.

Related Pages:

Related Samples: