In this tutorial, we will show you how to extract an email address in PDF in PHP using Web API. The image below shows the PDF input and the extracted email address in JSON format.

  1. Source Code
  2. Start Apache Server
  3. Run Program
  4. Result
  5. Extract Email Address Demo
Input PDF And Extracted Email Output
Input PDF and Extracted Email Output

Step 1 – Source Code

Let’s begin by saving the HTML and the PHP code samples in a directory inside the /www or the /htdocs folder.

Store Source Code Samples In Folder

Step 2 – Start Apache Server

Next, start the Apache Server.

Step 3 – Run Program

Now, let’s run our program.

  • In the address bar, type in localhost/folder_name/program.html.
  • In the API Key field, enter your API Key. You can get it in your dashboard here.
  • Load the Input PDF. You can download the input PDF here.
  • Choose the template file. You can copy the template here.

Then, click the Proceed button.

Run Program

Step 4 – Result

Great! returned a JSON URL where we can view the extracted email address. Simply copy and paste the link to view the result. You can also get the output in CSV or XML format.

Extracted Email Address JSON URL

Step 5 – Extract Email Address Demo

Here’s a short demo to see email address extraction in action.

Extract Email Address Demo
Extract Email Address Demo

In this tutorial, you learned how to extract an email address in a PDF in PHP using Web API. You learned how to set up the environment to run a PHP program. You also learned how to extract the email address in other formats.