PDF from HTML
I want to Prevent Images from Breaking Across Pages in HTML to PDF
You want to generate a PDF from HTML without having images split awkwardly across pages.Why This Happens
When converting HTML to PDF, especially in long documents, browsers or PDF renderers may automatically break content (like images or<div>s) across pages. This results in visual issues where a single image may appear partially on one page and continue on the next.
How to Keep Images (or Elements) Intact
To prevent this, you’ll use a CSS style that instructs the PDF renderer not to break certain elements across pages.Step-by-Step Fix
Use thebreak-inside:avoid CSS Rule: Add a <style> tag in the HTML head with a rule that prevents elements (like <div>, <p>, or <img>) from splitting.
Inject the CSS Using Profiles: Use the profiles parameter to inject the style into your HTML during conversion.
Example: Preventing Breaks in Zapier or Make
Zapier or Integromat/Make Users: Set theProfiles field to:
For Developers (API)
When using the /pdf/convert/from/html or /pdf/convert/from/url endpoints, include theprofiles parameter like this:
Applies To:
Helpful Tips
- Always test the final PDF to confirm formatting appears as expected.
- Combine this method with margin settings or custom page breaks for better layout control.
How to Convert HTML to PDF with a Custom Page Size
You want to generate a PDF from HTML with a specific page size—such as 4 inches by 6 inches—instead of the default A4.How to Set a Custom PDF Page Size
To generate a PDF at a custom size, use thepaperSize parameter in your API call or integration.
Example: to create a 4x6 inch PDF, set:
px→200px 300pxmm→100mm 150mmcm→10cm 15cmin→4in 6in
API Example
Here’s a sample API request to convert HTML to a 4x6 inch PDF:Zapier
In the HTML to PDF Converter action:- Find Page Size Override
- Enter
4in 6in
Make / Integromat
In the PDF.co Convert HTML to PDF module:- Set Paper Size → Custom
- Enter
4in 6inin the size field
Helpful Tips
- Always include the unit (e.g.,
in,mm,px) inpaperSize - Use
margins:0for full-page layouts - Use
printBackground:trueif your HTML needs background styles
How to Keep Form Controls When Converting HTML to PDF
When you convert an HTML page to PDF, form controls like input fields, checkboxes, and dropdowns appear as static visuals but are not interactive.Why This Happens
The PDF format doesn’t automatically convert HTML form elements into interactive form fields. They’re rendered as plain graphics rather than fillable fields.How to Make PDF Forms Fillable
To add interactive form controls, you need to create form fields in the PDF after converting from HTML. 2-Step Workflow:- Convert the HTML to PDF Use the /pdf/convert/from/html API or your preferred HTML-to-PDF tool to generate the static PDF.
- Add Form Fields to the PDF Use the /pdf/edit/add API endpoint to insert form fields like textboxes, checkboxes, and dropdowns into the PDF.
Platform-Specific Guides
- Zapier: Follow this step-by-step guide → Create Fillable Forms with PDF.co in Zapier
- Make/Integromat: Follow this tutorial → Create Fillable Forms with PDF.co in Make
Helpful Tips
- Use PDF.co’s built-in PDF Inspector Tool to visually test field placement.
- Use exact coordinates for better precision when placing fields.
I Want to Create Navigation Links Inside a PDF When Using HTML to PDF
The Issue
You want to add clickable navigation links inside a PDF—such as a table of contents that jumps to a section, or internal links between parts of a long document—but the links aren’t working as expected.Why This Happens
When converting HTML to PDF, some users may not realize that internal anchor links (#marker) require properly placed markers (<a name="...">) in the HTML for the PDF converter to recognize them. Without these, the links won’t work in the output file.
How to Create Navigation Links
To add internal navigation links to your PDF:- Add a Marker Where You Want to Jump
- Add a Link to That Marker
Example: Create a Table of Contents
Here’s a sample HTML that adds navigation to two sections:What Happens in the PDF
Once converted using the HTML to PDF tool, the output PDF will preserve these internal links. Clicking on “Section 1” or “Section 2” in the navigation will jump directly to the respective areas—just like in the original HTML document.Helpful Tips
Double-check that both the link (href="#...") and the marker (name="...") match exactly.
- Ensure correct HTML syntax—mismatched quotes or missing closing tags can break links.
- Test in a browser first to confirm links are functioning before converting.
I Want to Avoid Page Breaks in My PDF
You may be experiencing unwanted page breaks in your generated PDF—such as a section of text or a table being split across two pages.Why This Happens
By default, PDFs are set to render in A4. When your content exceeds the default page height, it causes automatic page breaks.How to Avoid Page Breaks
To prevent this, you can customize the page size using the paperSize parameter. This ensures the page is long enough to hold all your content without forcing a break.Example: Use a Custom Page Size
To avoid page breaks and allow more vertical space, increase the page length. Set thepaperSize like this:
Helpful Tips
- Adjust
paperSizeaccording to your content length. - Use longer page heights to accommodate full content without breaks.
- If using
async: true, monitor job status for large files.
I Want to Force a New Page in the Output PDF
You want to make sure that certain content in your PDF always starts on a new page, but currently, everything appears continuously without page breaks.Why It Happens
When you’re generating PDFs from HTML or HTML templates, content flows naturally like a webpage—without automatic page breaks—unless you explicitly tell it where to break using specific CSS rules.How to Force a New Page
To force a page break in your PDF output, use the following CSS property in your HTML:Examples
Example 1 — Using a <div> tag:
Example 2 — Using a <p> tag:
Helpful Tips
- Apply the style to a
<div>or<p>between sections you want to separate. - Combine with layout styles like
clear:bothto prevent content from overlapping.
I Want to Insert a Link into a PDF Created from HTML
You’re trying to add a clickable link (like a URL or email address) inside a PDF that was originally generated from HTML.Why This Happens
When you convert HTML to PDF, the PDF is generated as a static document. If the original HTML didn’t include the link as an anchor tag (<a>), or if you want to place a new link in a specific position after conversion, it won’t exist in the PDF by default. That’s why adding the link requires a second step after conversion.
How to Insert a Link
To insert a link, you’ll use two steps:- Convert HTML to PDF
Tip:
Use the PDF Inspector Tool to visually identify the coordinates (x, y) of where you want to place the link.Example Workflow
Let’s say you want to generate a PDF from HTML and then place a clickable link at the bottom right of the first page:- Convert HTML to PDF
- Add the Link
- The URL of the newly created PDF.
- The coordinates where you want the link.
- The link itself (e.g., “link”: “https://yourwebsite.com”).
- The target page number (e.g., page 1).
Platform-Specific Related Resources
- Zapier:
- Make/Integromat:
- Other Integrations: Contact us for guidance on specific platforms.
Helpful Tips
- You can add multiple links in one request by using an array of annotations.
- Use
async: truefor large PDFs to avoid timeout. - Make sure the coordinates you select fall within the content area of the page.
PDF from CSV
How to Convert a Specific Google Sheets Worksheet to PDF
You’re Trying to Convert Just One Worksheet
You want to export only one worksheet from a Google Sheets document as a PDF file—not the entire spreadsheet.How to Convert a Specific Worksheet
To convert a single worksheet from Google Sheets to PDF, you’ll need to construct a custom download URL. Use the following format:[spreadsheet_id]: The unique ID of your Google Sheets document (found in the URL).[file_format]: The format you want to export to — in this case, use “pdf”.[worksheet_id]: The specific gid (worksheet ID) of the tab you want to export.
Example
If you want to download a worksheet with:- Spreadsheet ID:
12345 - Worksheet ID (gid):
6789
Platform-Specific Related Resources
- Zapier: Convert Specific Excel Worksheet to PDF using PDF.co and Zapier
- Make: Convert Specific Excel Worksheet to PDF using PDF.co and Make
Helpful Tips
- Make sure the Google Sheet is shared publicly or with anyone with the link so the system can access it.
- To automate this in workflows, pass the export link dynamically using spreadsheet/worksheet metadata.
I Want to Convert Google Sheets/Excel to PDF
You’re trying to convert a Google Sheet or Excel file into a PDF—possibly to share, archive, or prepare a report. However, you’re not sure how to get it formatted correctly, or how to convert specific sheets or orientation (landscape vs portrait).How to Convert Google Sheets/Excel to PDF
To convert a spreadsheet to a PDF, you’ll typically follow one of two methods:- Use an automation platform like Zapier or Make
- Use a direct download link or API call
Zapier
Use these step-by-step guides to set up automated spreadsheet-to-PDF conversions:- Convert Google Sheets/Excel to PDF in Landscape
- Convert a Specific Worksheet in Excel to PDF
- Convert Google Form Responses (via Sheets) to PDF
Integromat / Make
If you’re using Make (formerly Integromat), follow this resource:Web API Code Samples
If you’re working with the PDF.co API directly, these code samples will help:Alternative Method: Use Google Sheet Direct Download Link
You can also convert Google Sheets to PDF using a simple direct link:INSERT_FILE_ID with your sheet’s actual ID.
To force landscape, add &portrait=false to the URL.
Helpful Tips
- Use Zapier/Make to automate recurring conversions.
- In API mode, control page size, margins, and orientation.
- Make sure your spreadsheet is publicly accessible or properly authenticated if you’re using a URL.