Convert a Base64-Encoded Image to PDF Using PDF.co and Zapier

4 Minutes Read

This tutorial shows how to receive a Base64-encoded image, upload it to PDF.co, convert it into a PDF, and save the resulting file.

Workflow

Trigger → PDF.co Base64 Upload → PDF.co Anything to PDF Converter → File Storage

Step 1: Create the Trigger

Create a new Zap with a trigger that supplies the Base64 data. For example, select Webhooks by Zapier and use Catch Hook to receive data from another application.

Send a test request containing a field such as:

{
  "file": "data:image/png;base64,iVBORw0KGgoAAA..."
}

The Base64 value can also come from a form, database, CRM, or another preceding Zapier step.

Step 2: Upload the Base64 File

Add an action and select PDF.co. Choose Custom API Call, then connect your PDF.co account.

Configure the action:

  • PDF.co API Endpoint: /v1/file/upload/base64
  • Input JSON:
{
  "file": "MAP_THE_BASE64_VALUE_HERE",
  "name": "signature.png"
}

Replace MAP_THE_BASE64_VALUE_HERE by mapping the Base64 field from the trigger.

The filename should use the correct extension for the encoded file, such as .png, .jpg, or .tiff.

Test the action. A successful response contains:

  • url: Temporary URL of the uploaded image
  • error: false
  • status: 200

The upload endpoint accepts either raw Base64 file bytes or a complete data URI such as data:image/png;base64,.... See the Base64 upload documentation for details.

Step 3: Convert the Image to PDF

Add another PDF.co action and select Anything to PDF Converter.

Configure it as follows:

  • Input Format: Select the option for an image URL or multiple image URLs.
  • Input Source: Map the url returned by the Base64 upload step.
  • File Name: Enter signature.pdf.

If the Base64 data contains several images, upload each image first and pass their URLs to the converter in the supported comma-separated format.

Test the action. PDF.co will return a temporary URL for the generated PDF.

The current PDF.co actions are listed on the PDF.co Zapier integration page.

Step 4: Save the PDF

Because PDF.co output URLs are temporary, add a final action to store the PDF.

For example, select Google Drive → Upload File and configure:

  • File: Map the PDF URL returned by PDF.co.
  • File Name: Enter signature.pdf.
  • Folder: Select the destination folder.

You can also send the PDF by email or save it to another supported storage service.

Step 5: Test and Publish

Test the complete Zap and confirm that:

  1. The trigger receives the Base64 value.
  2. PDF.co uploads the decoded image.
  3. The image is converted into a PDF.
  4. The completed PDF is saved or delivered successfully.

Publish the Zap when the test succeeds.

Conclusion

The completed workflow receives a Base64-encoded image, uploads it through PDF.co’s Base64 endpoint, converts it into a PDF, and stores the result automatically.

Related Tutorials

See Related Tutorials