One-line Save as PDF link — drop into any web page.
Paste a single <a> tag into your HTML and visitors get a one-click PDF of the
page they're on. The free service is hosted by SelectPdf — no API key, no server-side install,
no SDK. 15 query-string parameters tune page size, margins, filename, security and
rendering.
Paste this anywhere on your page.
Works on any HTML page — no JavaScript framework required. The onclick handler
appends the current URL once and lets the anchor follow through to SelectPdf, which streams the
PDF back as a download.
<a href="https://selectpdf.com/export-to-pdf/?" onclick="if(!this.urlAdded)this.href+='&url='+encodeURIComponent(location.href);this.urlAdded=1">Save as Pdf</a>
That's the whole product. The anchor points to /export-to-pdf/; the click handler
URL-encodes location.href and appends it as the url parameter so the
server can validate it against the Referer header. Customize the PDF by adding
the 15 query-string parameters from the reference below.
Four steps from click to PDF download.
- The visitor clicks the Save as Pdf link on your page.
- The inline
onclickappends&url=+ the URL-encoded value oflocation.hrefto the anchor'shref. The flagthis.urlAddedstops it from being appended twice if the user clicks the link a second time. - The browser follows the link to
/export-to-pdf/. SelectPdf reads the URL fromRequest.UrlReferrerand verifies theurlquery parameter contains the same host. - The conversion runs server-side and the PDF streams back as a download with
Content-Type: application/pdfand the filename set frompdf_name.
url + Referer round-trip?
It's an anti-abuse check. /export-to-pdf/ can only convert the page the visitor
is on — not an arbitrary third-party URL. Calling the endpoint directly without a
Referer header redirects to the homepage. This keeps the free service from being
turned into a generic URL-to-PDF gateway.
Three drop-in presets — copy and ship.
Each preset is a complete anchor tag with the query string already filled in. The
Try this preset → button on each card uses the same onclick trick
to convert this page so you can see exactly what comes back before you wire it into
your own HTML.
US Letter, landscape orientation
Render the page on US Letter paper turned sideways — useful for wide tables or dashboards that don't fit Portrait.
<a href="https://selectpdf.com/export-to-pdf/?page_size=Letter&page_orientation=Landscape" onclick="if(!this.urlAdded)this.href+='&url='+encodeURIComponent(location.href);this.urlAdded=1">Save as Pdf</a>
Edge-to-edge, no page numbers
Strip all four margins and the footer page-number stamp. The page content occupies the entire PDF surface — useful when capturing a print-styled page that already has its own padding.
<a href="https://selectpdf.com/export-to-pdf/?margin_top=0&margin_right=0&margin_bottom=0&margin_left=0&page_numbers=false" onclick="if(!this.urlAdded)this.href+='&url='+encodeURIComponent(location.href);this.urlAdded=1">Save as Pdf</a>
Custom filename, user password
Save the PDF as Report.pdf and require the password "Test" to open it. Combine with owner_password to lock down printing, copying and editing.
<a href="https://selectpdf.com/export-to-pdf/?pdf_name=Report&user_password=Test" onclick="if(!this.urlAdded)this.href+='&url='+encodeURIComponent(location.href);this.urlAdded=1">Save as Pdf</a>
15 query-string parameters, in one place.
Append any combination to the anchor's href — they are read by the
/export-to-pdf/ endpoint and applied to the conversion. All are optional;
defaults are used when omitted.
Page size, orientation, numbering and filename
How the generated PDF is laid out and named. All optional — sensible defaults apply when omitted.
page_size
A1
A2
A3
A4
A5
Letter
HalfLetter
Ledger
Legal
page_orientation
Portrait
Landscape
page_numbers
True
False
pdf_name
All four page margins
Measured in points (1pt = 1/72in). Default 5pt on every side. Set to 0 for an edge-to-edge PDF.
margin_top
margin_right
margin_bottom
margin_left
Password-protect the PDF
Either or both can be set. The user password gates opening; the owner password gates printing, copying and editing inside a PDF reader.
user_password
owner_password
Browser window, CSS media type, load timing
Tune how the page is rendered before it is captured. Larger min_load_time helps pages with deferred JavaScript or lazy-loaded images.
use_css_print
True
False
web_page_width
web_page_height
min_load_time
max_load_time
Free, with four conditions.
- Keep the link visible. The conversion link must stay rendered on your page and point directly to selectpdf.com. Hidden links, link cloaking and CSS tricks that conceal the anchor are not permitted.
- 1,000 conversions per month per site. The free service is intended for sites that need up to 1,000 conversions per month. Past that, please use the paid HTML to PDF API — same engine, no per-page cap, no link requirement.
- 10 pages per PDF maximum. The generated PDF is capped at 10 pages. Pages that render longer than that are truncated. For longer PDFs, use the HTML to PDF API or the .NET PDF library.
- HTTPS pages must link to the HTTPS endpoint. If your page is served over HTTPS, the anchor's
hrefmust point tohttps://selectpdf.com/export-to-pdf/. Mixed-content rules block plain-HTTP links from a secure page.
The paid HTML to PDF API uses the same rendering engines (WebKit · WebKit Restricted · Blink · Chromium), exposes 90 parameters instead of 15, removes the page cap and the link-visibility requirement, and converts any URL — not just the visitor's current page. Plans start at $19 / month and include a 7-day free trial with 200 conversions, no credit card.
Save as PDF link, answered.
Six quick answers about the free Save-as-PDF link. For the full parameter surface, see the 15-parameter reference above.
onclick handler reads location.href and sends it as the url parameter; the server then checks it against the Referer header. You cannot point the link at an arbitrary third-party URL.href must point to the HTTPS version of selectpdf.com (https://selectpdf.com/export-to-pdf/). Mixed-content rules in the browser will block the request if an HTTPS page links to an HTTP endpoint.href — 15 options cover page size, orientation, filename, all four margins, page numbers, owner/user passwords, the CSS Print media type and the rendering window size and load timing. See the parameter reference.