Skip to main content

PDF Embed Code Generator

Generate an <iframe> embed code that displays a PDF inline on your website — set the title, size, and toolbar visibility, then copy the ready-to-use HTML. Includes an accessible download-link fallback. No sign-up, no hosted viewer.

Input

Required for accessibility; a sensible default is used if left blank.

Settings

Any CSS width value, e.g. 100% or 800px.

Output

Your embedded PDF will appear here.

The real generated iframe, isolated in a Shadow DOM so the page's own styles can't affect it.

HTML
 
Was this helpful?

Guides

Paste the link to any PDF and this tool generates a ready-to-paste <iframe> embed code that displays the PDF inline on your page — no hosted viewer, no sign-up, no extra script to load.

How to use it

  1. Paste the PDF URL — a direct link to a hosted PDF file.
  2. Optionally set a Title (used as the iframe's accessible name; defaults to "PDF document" if left blank).
  3. Toggle Show PDF toolbar to control whether the browser's built-in download/print/zoom controls are visible.
  4. Set the Width (any CSS value, e.g. 100% or 800px) and Height in pixels.
  5. Copy the generated HTML and paste it into your page or CMS block.

How it works

The output is a plain <iframe src="your-pdf-url"> — modern browsers render PDFs natively inside an iframe using their built-in viewer, so nothing needs to be uploaded or converted. Hiding the toolbar uses the browser's own PDF open parameters (#toolbar=0), not a JavaScript hack, so it works the same way across Chrome, Edge, and Firefox. The generated code also includes a fallback: browsers or embedded contexts (like some in-app browsers) that don't support inline PDF rendering show a plain "Download the PDF" link instead of a blank box.

Privacy

Everything happens in your browser — the PDF URL and your settings never leave your device. The iframe simply points at the URL you provide; nothing is uploaded, hosted, or processed by us.

FAQ

Why doesn't the PDF show up when I paste this on my own site?

Some hosts serve PDFs with a Content-Disposition: attachment header (forcing a download instead of inline display) or block being framed via X-Frame-Options/CSP — that's a setting on the file's own server, not something this tool can control. Check that the PDF is served with Content-Disposition: inline and no framing restriction.

I just want a button that links to the PDF, not an inline viewer

Use the PDF Button Generator instead — it generates a styled open/download button rather than an embedded viewer.

Can I embed something other than a PDF this way?

For any other URL, the general-purpose HTML Iframe Generator covers the same fields (source, title, size, loading) without the PDF-specific toolbar option.

embed pdfpdf viewer embedpdf iframepdf widgetshow pdf on websitepdf embed codehtml embed generatorpdf viewer html

Use it from code

From 3 credits per call

REST API

curl -X POST https://api.iotools.cloud/v1/tool/pdf-embed-code-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pdfUrl": "https://example.com/document.pdf",
    "title": "",
    "showToolbar": "true",
    "width": "100%",
    "height": "600"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `pdf-embed-code-generator` tool (PDF Embed Code Generator) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.