How do I add page numbers, a logo, or custom headers and footers to WordPress PDFs?
Use the Header HTML option and the Footer HTML option to add page numbers, a logo, source information, or other custom header and footer content to the output.
In the plugin settings, turn on Expert Settings, then choose
Header & Footer.
Add page numbers
Add this to Header HTML or Footer HTML:
Page <span class="pdfcrowd-page-number"></span> of <span class="pdfcrowd-page-count"></span>
The plugin fills in the current page number and total page count during conversion.
Add the page title or source URL
Use pdfcrowd-source-title to show the converted page title:
<span class="pdfcrowd-source-title"></span>
Use pdfcrowd-source-url to show or link to the original page URL:
<a class="pdfcrowd-source-url" data-pdfcrowd-placement="href-and-content"></a>
Add a logo or custom styling
Put the logo and CSS directly in Header HTML or Footer HTML. Header and
footer HTML does not automatically inherit your WordPress theme styles, so set
important spacing, font, and image sizes in the same field.
Use an image URL that can be opened without logging in.
<div style="display:flex; align-items:center; justify-content:space-between; font-size:10px;">
<img src="https://example.com/logo.png" style="height:24px; width:auto;" alt="">
<span>Page <span class="pdfcrowd-page-number"></span> of <span class="pdfcrowd-page-count"></span></span>
</div>
If the header or footer is maintained as a separate public HTML page, use the
Header URL option or the
Footer URL option instead.
Most sites should start with Header HTML or Footer HTML.
Fix spacing, clipping, or overlap
If the header or footer is cut off or overlaps the page content, increase the Header Height option or the Footer Height option.
If the header or footer should use the full paper width, enable the No Header Footer Horizontal Margins option.
If the header or footer content should not be printed on specific pages, use
the
Exclude Header On Pages
option or the
Exclude Footer On Pages
option. For example, use 1 to hide it on the first page.
Use WordPress values in a header or footer
The plugin settings are best for fixed content, page numbers, source title, and source URL. If the header or footer must include a value that WordPress calculates for the current page, build that value in PHP and pass it to the button function.
$user = wp_get_current_user();
echo create_save_as_pdf_pdfcrowd_button(array(
'footer_html' => 'Prepared for ' . esc_html($user->display_name),
));
This is useful for values such as the logged-in user's name or page-specific metadata.
If the HTML field is read-only
WordPress restricts custom HTML for security. If Header HTML or Footer HTML
is read-only, use an account with the unfiltered_html permission, or ask the
site owner to make the change.