Logo

Adding a Download Button

Add a download button using the Gutenberg block or [pdfdraft_download_pdf] shortcode.

Last updated on May 18, 2026

Add a download button to your posts and pages to let visitors generate and download PDF versions of your content. You can add the button using either the Gutenberg block editor or a shortcode.

Prerequisites

At least one PDF template must be created and published

Adding the Button Using Gutenberg Block

Open the post or page where you want to add the download button

Click the Add Block button or press the forward slash key

Search for PDFDraft Download Button

Click the block to insert it into your content

In the block settings sidebar, select a PDF template from the Project dropdown

Optionally customize the button text in the Button Text field

Publish or update your post

Adding the Button Using Shortcode

You can add the download button anywhere in your content using the shortcode:

[pdfdraft_download_pdf]

The shortcode uses the default template configured in PDFDraft Settings. To specify a different template, add the template parameter:

[pdfdraft_download_pdf template_id="abc123" text="Download" class="my-btn"]

Expected Result

After adding the button, visitors will see a Download as PDF button on your post or page. When clicked, the button displays a loading spinner while generating the PDF, then automatically downloads the file to their device.

Validation

View the published post or page on the frontend

Verify the download button appears in the expected location

Click the button to test PDF generation

Confirm the PDF downloads successfully and contains your post content

Management

To edit the button after adding it:

For Gutenberg blocks: Click the block in the editor and modify settings in the sidebar

For shortcodes: Edit the shortcode parameters directly in the content editor

To remove the button, delete the block or remove the shortcode from your content.

Common Issues

Button not appearing: Ensure Posts to PDF is enabled in PDFDraft Settings and at least one template is published.

PDF generation fails: Verify the selected template exists and is properly configured. Check that the template ID in the shortcode matches an existing template.