PrintFriendly

Settings Reference

Everything the button script reads. The builder writes these for you, so you only need this page if you are editing the code by hand or working out what old code is doing.

Where the Options Live

All of them are one attribute on the hidden settings tag, written as name=value pairs separated by semicolons.

<printfriendly-options style="display:none;"
  data-content-features="disablePDF=0;hideImages=0;imageDisplayStyle=block;">
</printfriendly-options>

Content Features

On data-content-features.

OptionValuesWhat It Does
disablePrint
was pfDisablePrint
0 or 1Hides the Print action in the preview.
disablePDF
was pfDisablePDF
0 or 1Hides the PDF action.
disableEmail
was pfDisableEmail
0 or 1Hides the Email action.
disableClickToDel
was pfdisableClickToDel
0 or 1Stops readers removing parts of the page before printing.
hideImages
was pfHideImages
0 or 1Leaves images out of the printed page entirely.
imageDisplayStyle
was pfImageDisplayStyle
block, left, right, noneWhere images sit: centered on their own line, floated, or left alone.
headerImageUrl
was pfHeaderImgUrl
a URLYour logo at the top of the printed page.
headerTagline
was pfHeaderTagline
textA line of text under the header image.
customCSSURL
was pfCustomCSS
a URLA stylesheet to load into the printed page.
showHiddenContent
was pfShowHiddenContent
0 or 1Keeps content the page hides with CSS or script, such as closed tabs and accordions. Pro.
encodeImages
was pfEncodeImages
0 or 1Sends images from the reader's own browser instead of us fetching them from your server. Pro. Unset, this is on for http:// pages and off for https://.
primaryImageall, off, content-onlyChooses which image leads the article: off finds none, content-only skips the page's og:image/twitter:image meta tags and looks only inside the article. Only takes effect on Pro, where the page is read in the reader's browser; the free button ignores it.
keepStyleonKeeps the inline style attributes your page's elements already carry, instead of stripping them. Only takes effect on Pro, where the page is read in the reader's browser; the free button ignores it.
bgImageUrlSupportonTurns CSS background images into ordinary images so they show up in the printout. Only takes effect on Pro, where the page is read in the reader's browser; the free button ignores it.
Older code sometimes carries settings that are not on this list. It is left over from previous versions and no longer changes anything. Nothing breaks if you leave it, and nothing changes if you delete it.

Content Selectors

On data-selectors, for telling us where the article is when we pick the wrong part of the page.

OptionValuesWhat It Does
contentSelectorsCSS selectorsWhere the article lives, if we pick the wrong block.
titleSelectora CSS selectorWhere the title lives.
authorSelectora CSS selectorWhere the author's name lives.
dateSelectora CSS selectorWhere the published date lives.
primaryImageSelectora CSS selectorWhich image leads the article.
removeSelectorsCSS selectorsParts of the page to drop before printing.
We normally hold these for a domain on our side rather than asking you to set them. If PrintFriendly is picking up the wrong content on your site, send us a URL and we will look, rather than working through these by trial and error.

Common Questions

My old code uses pfDisablePDF and similar. Does it still work?#

Yes, and there is no deadline to change. Those globals were how settings were written before the settings tag existed, and the script still reads them. The table above lists the modern name for each one under "was".

The old form
<script>
  var pfHeaderImgUrl = 'https://example.com/logo.png';
  var pfDisableEmail = 1;
</script>

If you set the same thing both ways, the settings tag wins. Do not do that, as it is a confusing thing to leave for whoever reads the page next.

How do I move from the old code to the current one?#

Generate a new one in the builder and replace the whole block. That is faster and less error-prone than converting by hand, and it picks up the current button markup at the same time.

You can tell which you have by looking for pfBtVersion in your page source.

Are the values 0 and 1, or true and false?#

Use 0 and 1. Note that the switches are worded as negatives: disablePDF=1 removes the PDF action, and disablePDF=0 leaves it in place.