Convert EML to PDF API – Bulk convert email files to PDF

August 26th, 2018 / by api2pdf /


I can only imagine you reading this if you are an attorney or work for an attorney in some capacity. Perhaps you are a programmer and have been tasked with converting thousands of emails to PDF format. If so, you have come to the right place. If you only need to convert a single EML file to PDF, there are easier ways to do that than what I’m about to describe.

Api2Pdf is a tool (REST API) for application developers to convert HTML, URLs, and various file types to PDF format, including EML to PDF and EMLX to PDF. Since this is an API, you can use this tool with any programming language (php, python, c#, java, javascript, ruby, nodejs, etc, etc.)

Quick Test: Convert EML to PDF

To convert EML to PDF using the Api2Pdf API service, we need to make use of our LibreOffice API. Details about our LibreOffice to PDF endpoint is outlined here:

  1. Grab an API key by registering at
  2. Go back to the documentation and click the little Lock Icon and copy and paste your API key to authorize the request (screenshot)
  3. Click Try It Out (screenshot)
  4. Replace the URL to the sample Word file with a URL to a sample EML or EMLX file (screenshot). If you do not have one handy, you can use this sample URL:
  5. Click Execute.

If all is well, this will generate generate a PDF and provide you with the result. This is just a quick test with our SwaggerHub documentation. If this worked well for you, see the next section on the best practices for doing it for real.

Bulk Convert EML to PDF

If your quick test was successful, that means you are ready for the real deal. Our Office to PDF API runs on AWS Lambda. This provides both advantages and disadvantages. The main advantage is that it can operate at massive scale. There are no rate limits or file size limits. Consume as many PDFs as you need. The disadvantage is that it does require the EML file to be accessible at some URL. The LibreOffice endpoint will consume the file at that URL and then convert it to PDF.

Your next steps —

Write a process that will upload the EML file to some accessible URL, preferably Amazon S3. Get the url and then make the API call to Api2Pdf. Api2Pdf will generate the PDF and return you are URL to that generated PDF. Download that PDF to your local cache for your permanent records. Api2Pdf only holds a PDF at that URL for 24 hours.

If you put this in a loop, you can convert EML to PDF, EMLX to PDF, etc in bulk and handle thousands of email files in a very short period of time.

Tags: , , , , , , , ,

Comments are closed.