Skip to main content

Error 442: Input Document Is Damaged or of Incorrect Type

Updated over 4 months ago

What Causes Error 442?

  1. File is restricted or not publicly accessible

  2. File is not a supported format (e.g., .exe, .pages, etc.)

  3. Google Drive prevents the file from being downloaded (due to scan limits, size, or permissions)

How to Fix It

  1. File is restricted or not publicly accessible

This error often occurs when the file you're trying to use is stored on a private server, cloud storage platform, or file-sharing link that blocks access.

  • Make sure the file is publicly accessible or shared with view permissions

    • If using Google Drive, Dropbox, or OneDrive: set the file to "Anyone with the link can view/download"

    • If hosted on your server: ensure it's not behind a login, firewall, or expired token

  • Test your link by opening it in a private/incognito browser. If it doesn’t download immediately, PDF.co won’t be able to access it either

  • Use a direct file URL (not a page preview link or viewer interface)

NOTE: You can also upload files directly to PDF.co via our Upload API if public hosting isn’t an option.

2. File is Not a Supported Format

PDF.co APIs only support certain file types depending on the endpoint you're using.

  • Make sure the file is in a format supported by the specific endpoint you're using

    • For example: use JPG or PNG for the Image to PDF endpoint

  • If you're unsure, check the API documentation for the list of accepted file formats

3. Google Drive prevents the file from being downloaded (due to scan limits, size, or permissions) - ADVANCED

This issue often arises when a Google Drive file cannot undergo virus scanning. This keeps the PDF.co engine from accessing the actual file.

image

Step 1: Test If Your File Is Publicly Downloadable

Try accessing your file using this direct link format:

Replace FILE_ID with your actual Google Drive file ID.

Open the link in a private browser tab. If it doesn’t download automatically, the file is restricted — and you’ll need to use one of the two options below.

Option 1: Use a Google API Key

This method lets PDF.co download your file through Google’s API, even if the file isn’t public.

Protect Your API Key in Logs

Before using your API Key in the file URL, enable Strict Mode for API Logs to hide the full URL (and protect your key).

How to Generate a Google API Key:

  1. Create a new Project (or select an existing one)

  2. From the left menu, go to APIs & Services → Enabled APIs and Services

  3. Click + Enable APIs and Services at the top

  4. Search for Google Drive API

  5. Click Enable to activate the API for your project

  6. Go to APIs & Services → Credentials

  7. Click + Create Credentials → choose API Key

  8. Under API Restrictions, select:

    • Restrict Key

    • Choose Google Drive API

  9. Click Save

Use the API Key in the File URL:

Replace FILE_ID and API_KEY with your actual values. Use this as the source file URL in your PDF.co request.

NOTE: If you need help setting up restrictions or securing your key, please reach out to Google Support.

Option 2: Use a Google OAuth Access Token

For user-specific or private files, you can authenticate access using OAuth 2.0.

Did this answer your question?