Extract Email Address in PDF in PHP using PDF.co Web API

Sep 2, 2024·3 Minutes Read

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

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 PDF.co API Key. You can get it in your PDF.co dashboard.
  • Load the Input PDF.
  • Choose the template file.

Then, click the Proceed button.

Run Program

Step 4: Result

Great! PDF.co 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

In this tutorial, you learned how to extract an email address in a PDF in PHP using PDF.co 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.

Video Guide

Related Tutorials

See Related Tutorials