HTML to PDF Converter

Description

The « HTML to PDF Converter » plugin, created by html2pdf.app, lets your visitors save any WordPress page or post as a PDF. Install the plugin, add your API key, and either drop a shortcode where you want the download link — or switch on the automatic button to add a « Save as PDF » link to every post and page with no shortcode at all.

Conversions are handled by the html2pdf.app cloud API, the same engine used by the standalone service, so PDFs render with full CSS, web fonts, and images.

Features

  • One shortcode — add a download button anywhere with [html2pdf text="Save as PDF"].
  • Automatic button — show a « Save as PDF » button on chosen post types automatically, with no shortcode. Choose the position (before, after, or both) and the button text.
  • Print-ready output — set the CSS media type to screen or print (globally or per shortcode) to use your theme’s @media print styles and hide unwanted sections.
  • Full conversion control — page format (A4, Letter, Legal, and more), portrait/landscape orientation, custom margins, and custom width/height.
  • Test your connection — validate your API key from the settings page in one click before you go live.
  • Styled, theme-friendly button — ships with a clean default style that your theme can override, and is hidden automatically in the PDF when converting with print media.

Why a PDF plugin?

PDF downloads are useful for invoices, receipts, documentation, recipes, event tickets, knowledge-base articles, and any content your visitors want to save or print. This plugin gives them a one-click way to do it.

External services

This plugin relies on the third-party html2pdf.app API to generate PDFs. When a visitor clicks a conversion link, the URL of the page being converted (together with your conversion settings) is sent to https://api.html2pdf.app/v1/generate, which fetches that public URL, renders it, and returns the PDF. Your API key is sent with the request for authentication.

Because the API fetches the page itself, the page being converted must be publicly accessible on the internet.

  • Service: html2pdf.app — https://html2pdf.app
  • Terms of Service: https://html2pdf.app/terms-of-service/
  • Privacy Policy: https://html2pdf.app/privacy-policy/

Plugin Settings

Go to Settings HTML to PDF to configure:

  • API Key — your html2pdf.app key (with a « Test connection » button to verify it).
  • Page Format — Letter, Legal, Tabloid, Ledger, or A0–A6.
  • Landscape — switch orientation to landscape.
  • Mediascreen or print. Choose « print » to apply your theme’s @media print styles. This is the default for every button and can be overridden per shortcode.
  • Margins — top, right, bottom, and left margins in pixels.
  • Width / Height — optional custom page size in pixels.
  • Automatic button — enable it, choose which post types it appears on, its position, and the button text.

Usage

Shortcode

Add the shortcode to any page or post:

[html2pdf text="Save as PDF"]

Supported attributes:

  • text — the button label (default: « Generate PDF »).
  • mediascreen or print (defaults to the Media setting).

Example: [html2pdf text="Download PDF" media="print"]

Automatic button (no shortcode)

Under Settings HTML to PDF Automatic Save as PDF button, enable the button and pick the post types, position, and label. The button is then added to that content automatically.

Examples

Hide parts of the page from the PDF. Add the html2pdf_hide class to any element (header, footer, sidebar, etc.) and it will be excluded from the generated PDF, while still showing normally to your visitors:

<div class="html2pdf_hide"> ... not included in the PDF ... </div>

No extra CSS or print media is required — the conversion button is hidden automatically too.

For full control, the page <body> receives a html2pdf-rendering class while it is being converted, so you can target anything from your theme’s stylesheet:

.html2pdf-rendering .site-header,
.html2pdf-rendering .site-footer {
    display: none !important;
}

You can also use the « media » parameter (or the Media setting) to activate your theme’s print styles: [html2pdf text="Save as PDF" media="print"].

Captures d’écran

Installation

  1. Upload the plugin files to /wp-content/plugins/html-to-pdf-converter, or install the plugin through the WordPress « Plugins » screen directly.
  2. Activate the plugin through the « Plugins » screen in WordPress.
  3. Go to Settings HTML to PDF and enter your html2pdf.app API key. You can register for a free API key at https://dash.html2pdf.app/registration.
  4. Click Test connection to confirm your key works.
  5. Add the [html2pdf text="Save as PDF"] shortcode to a page or post — or enable the automatic button under « Automatic Save as PDF button ».

FAQ

Do I need an API key?

Yes. The plugin uses the html2pdf.app API to render PDFs. Register for a free API key at https://dash.html2pdf.app/registration and paste it into the plugin settings.

My page won’t convert or the PDF is empty. Why?

The html2pdf.app API fetches your page over the internet, so the page must be publicly accessible. Conversions will not work on local development sites (e.g. localhost), staging behind HTTP authentication, or password-protected/private posts. Use a publicly reachable URL.

How do I check that my API key is correct?

On the settings page, click Test connection next to the API Key field. You’ll get an immediate success or error message.

Can I add the button without using a shortcode?

Yes. Enable the automatic button under Settings HTML to PDF, choose the post types and position, and the « Save as PDF » button is added to your content automatically.

How do I hide the header, footer, or other parts of the page in the PDF?

Add the html2pdf_hide class to any element you want to exclude — it stays visible to visitors but is removed from the PDF. For custom rules, the <body> gets a html2pdf-rendering class during conversion. See the Examples section.

Can I change the page size, margins, or orientation?

Yes — all of these are configurable on the settings page, including A4/Letter/Legal and other formats, landscape mode, custom margins, and a custom width/height.

Where is my content sent?

The URL of the page being converted and your conversion settings are sent to the html2pdf.app API. See the « External services » section above for details.

Avis

16 juin 2026
I’ve been using this plugin to add PDF downloads to a WordPress site and it has worked well so far. Setup was straightforward and I had it running within a few minutes. What I appreciate most is that it doesn’t try to do too much. You can simply add a shortcode and let visitors download pages as PDF files. The PDF output looks good and there are enough options to adjust page size, orientation, and margins when needed.
12 juin 2024 2 replies
Good try!But!The website is not taken over directly, but probably rebuilt by html2pdf on their server. This means that only static pages can be transferred. But I have a website where a query runs on the posts. These variables are lost and the PDF page second only scrap. Too bad, two hours invested for nothing. Zero Star!
Lire les 2 avis

Contributeurs & développeurs

« HTML to PDF Converter » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.

Contributeurs

Traduisez « HTML to PDF Converter » dans votre langue.

Le développement vous intéresse ?

Parcourir le code, consulter le SVN dépôt, ou s’inscrire au journal de développement par RSS.

Historique des changements

1.1.0

  • Confirm compatibility with WordPress 7.0
  • Add automatic « Save as PDF » button insertion on selected post types (no shortcode required), with position and button text options
  • Add a default Media (screen/print) setting, overridable per shortcode
  • Add a « Test connection » button on the settings page to validate the API key
  • Mask the API key field with a Show/Hide toggle
  • Add usage examples directly in the plugin settings page
  • Ship default button styling, and hide the conversion button in the generated PDF automatically (any media type)
  • Add an html2pdf_hide class and an html2pdf-rendering body class to exclude any element from the generated PDF
  • Redesign the settings page with grouped, card-style sections for clearer separation
  • Restrict conversions to pages on the same site to prevent misuse of the API key
  • Send API key via the X-API-Key header instead of a request body parameter
  • Identify plugin requests for monitoring with an X-Source header
  • Sanitize server-provided URL values

1.0.8

  • Use page URL instead of persisted one, add settings link in a plugins page

1.0.7

  • Update icon, increase compatibility with the latest wordpress version

1.0.6

  • Update readme file with examples

1.0.5

  • Add possibility to pass media parameter through the shortcode

1.0.4

  • Improve error reporting

1.0.3

  • Icon, author URI and support email added

1.0.2

  • Initial version