Convert PDF to HTML Using PDF.co and Zapier

This tutorial creates a Zap that monitors a Google Drive folder, converts each new PDF into HTML with PDF.co, and saves the resulting HTML file to another Google Drive folder.

Workflow Overview

  1. Google Drive: Detect a new PDF.
  2. Filter by Zapier: Continue only when the file is a PDF.
  3. PDF.co: Convert the PDF to HTML.
  4. Google Drive: Save the generated HTML file.

Prerequisites

Before creating the Zap, prepare:

  • A Zapier account
  • A PDF.co account
  • A Google Drive folder for incoming PDFs
  • A separate Google Drive folder for converted HTML files
  • At least one sample PDF in the input folder

Step 1: Create the Google Drive Trigger

If you haven't already then first create a free account with PDF.co and Zapier.

Sign Up to PDF.co
Sign Up to Zapier

Once you have your accounts ready, create a new Zap and select Google Drive as the trigger app.

Configure the trigger:

  • Trigger event: New File in Folder
  • Account: Connect the Google account containing the source files.
  • Drive: Select the appropriate Google Drive or shared drive.
  • Folder: Select the folder that will receive the PDFs.

Test the trigger and select a sample PDF. Confirm that Zapier retrieves the file name, file type, and downloadable file value.

Step 2: Limit the Workflow to PDF Files

The Google Drive trigger can detect any type of file added to the folder. Add Filter by Zapier so that non-PDF files are not sent to PDF.co.

Configure one of these conditions:

Mime Type | Exactly matches | application/pdf

Or, if the MIME type is unavailable:

File Name | Ends with | .pdf

Test the filter with the sample PDF.

Step 3: Add the PDF.co Conversion

Add another action:

  1. Select PDF.co.
  2. Choose PDF to Anything Converter.
  3. Select Add a new account.
  4. Sign in to PDF.co and authorize Zapier to access your account.

Configure the PDF.co action as follows.

Output Format

Select:

HTML

Source PDF URL

Map the File value returned by the Google Drive trigger.

When Google Drive provides several links, use the downloadable file value rather than a link to the Google Drive preview page.

Page Selection

Leave this field empty to convert every page.

PDF.co uses zero-based page numbering. Examples include:

0

Converts the first page.

0-2

Converts the first three pages.

0,2,4

Converts the first, third, and fifth pages.

2-

Converts the third page through the end of the document.

Output File Name

Enter a name ending in .html, such as:

converted-document.html

You may include values from the Google Drive trigger to make the name unique.

Inline Output Option

Set this to:

false

This makes PDF.co return a temporary URL to the generated HTML file. That URL can then be mapped into the Google Drive upload action.

Set this option to true only when a later Zap step needs the HTML markup directly as text.

OCR Language

Select the primary language of the document, such as English.

This setting is used when the PDF contains scanned pages or images of text. PDF.co can process two languages by combining their language codes, such as:

eng+deu

Extraction Region

Leave this field empty to process the complete page.

To extract only a specific rectangular area, enter:

x,y,width,height

For example:

0,0,500,300

Enable Line Grouping

Leave this disabled for a general PDF-to-HTML conversion. Enable it when text inside tables needs to be grouped into rows or columns.

Unwrap

Leave this disabled unless line grouping is enabled and text within table cells should be joined into single lines.

Custom Profiles

Custom Profiles are optional. Leave the field empty to use the standard conversion settings.

To create a self-contained HTML file with PDF images embedded directly into the output, enter:

{
  "SaveImages": "Embed",
  "OptimizeImages": true,
  "OutputPageWidth": 1024
}

The settings perform the following actions:

  • SaveImages embeds images into the HTML as Base64 data.
  • OptimizeImages reduces unnecessarily large image data.
  • OutputPageWidth controls the rendered HTML page width in pixels.

Embedding images is helpful when the HTML file must be moved or stored without a separate image folder.

Step 4: Test the PDF.co Action

Test the action and inspect the response.

A successful response should include:

  • url: Temporary URL of the generated HTML file
  • name: Output file name
  • status: Successful processing status
  • outputLinkValidTill: Expiration time for the temporary URL
  • pageCount: Number of processed pages, when returned

Open the URL and confirm that the document’s text, formatting, and images appear as expected.

Step 5: Save the HTML File to Google Drive

PDF.co output URLs are temporary, so add a storage step if the HTML file must be retained.

Add another action:

  1. Select Google Drive.
  2. Choose Upload File.
  3. Connect the destination Google Drive account.

Configure the action:

  • Drive: Select the destination drive.
  • Folder: Select the output folder.
  • File: Map the url returned by PDF.co.
  • File Name: Map the PDF.co output name or enter a name ending in .html.
  • Convert to Google Docs: Disable this option so the file remains HTML.

Test the action and confirm that the HTML file appears in the selected folder.

Step 6: Publish the Zap

Review the complete workflow and publish the Zap.

Add a new PDF to the source folder for a final test. Zapier should detect the file, confirm that it is a PDF, convert it to HTML, and save the result in the destination folder.

Conclusion

You now have a complete workflow that automatically converts PDFs from Google Drive into HTML files. The conversion can process selected pages, apply OCR to scanned documents, extract a specific page region, and embed images in a self-contained HTML file.

For all supported fields and Custom Profiles, see the PDF.co PDF to Anything documentation.

Related Tutorials

See Related Tutorials