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.
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
- In the API Key field, enter your PDF.co 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.
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.
Step 5 – Extract Email Address Demo
Here’s a short demo to see email address extraction in action.
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.