pdf conversionflipbookdigital publishingtutorials

Embed PDF in Website: HTML Code, Free Options, and Flipbook Alternatives

Copy working HTML code to embed a PDF in your website, compare free viewers like Google Drive and PDF.js, see why mobile browsers break plain embeds, and find out when a flipbook is the smarter choice for catalogs, reports and brochures.

Embed PDF in Website: HTML Code, Free Options, and Flipbook Alternatives
Cristian Da Conceicao

You uploaded a PDF, pasted a link, and now visitors have to leave your page, wait for a download, and squint at a tiny preview. There is a better way. You can show the document right inside your page, and you can do it with a few lines of HTML or with a tool like Flipbooks AI that turns the same file into a page-turning reader. This article walks through both paths, with code you can copy, free options you can test today, and an honest look at where each one breaks.

💡 Quick answer: For a desktop-only audience, an <iframe> pointing at your PDF is the fastest fix. For anything that has to work on phones, use a viewer library or convert the PDF into a flipbook.

Why Embedding a PDF Gets Messy

PDF was built for print. It has fixed page sizes, embedded fonts and no idea what a 390-pixel-wide phone screen is. When you drop it into a web page, the browser has to decide how to render it, and every browser decides differently.

What Visitors Actually See

On desktop Chrome, Edge and Firefox, an embedded PDF usually appears in the browser's built-in viewer, complete with a toolbar, zoom and page counter. That toolbar is not yours, though. You cannot restyle it, you cannot hide the download button reliably, and you cannot track which pages people read.

Mobile Is the Real Problem

Open the same page on a phone and the story changes. iOS Safari often renders only the first page as a static image. Many Android browsers skip inline rendering and show a download prompt instead. Since most web traffic now comes from phones, a plain embed quietly fails for more than half of your visitors.

Person scrolling a document on a smartphone in a sunlit cafe

Here is a quick view of what to expect from the native browser approach:

Browser or deviceInline PDF displayTypical result
Chrome, Edge desktopYesFull viewer with toolbar
Firefox desktopYesBuilt-in PDF.js viewer
Safari desktopYesNative viewer, limited styling
iOS SafariPartialFirst page only, hard to scroll
Android ChromeRarelyDownload prompt or blank frame

The HTML Code That Works

HTML gives you three tags for embedding external documents. Each one has a place, and each one has limits.

Developer typing HTML code at a desk with two monitors

The iframe Method

This is the most common approach because it is simple and widely supported:

<iframe
  src="https://example.com/files/brochure.pdf#toolbar=0&navpanes=0"
  width="100%"
  height="700"
  style="border: 0;"
  title="Product brochure"
  loading="lazy">
</iframe>

The text after the # sign passes hints to the browser viewer. toolbar=0 hides the toolbar in Chrome and Edge, and page=3 opens the document on page three. These are hints, not guarantees, and Firefox and Safari ignore most of them.

⚠️ If your server sends the header X-Frame-Options: DENY or a restrictive Content-Security-Policy, the iframe will stay blank. Host the PDF on your own domain or adjust the headers.

The object Tag

The <object> tag lets you define a fallback, which is the one real advantage it has over iframe:

<object
  data="/files/brochure.pdf"
  type="application/pdf"
  width="100%"
  height="700">
  <p>Your browser cannot display this PDF.
  <a href="/files/brochure.pdf">Download it here</a>.</p>
</object>

When the browser cannot render the PDF, visitors see your fallback message and a download link instead of an empty rectangle. That small detail saves a lot of confused users.

The embed Tag

<embed
  src="/files/brochure.pdf"
  type="application/pdf"
  width="100%"
  height="700">

It works, but it has no fallback content and fewer accessibility options. Most developers pick iframe or object instead.

Making It Responsive

A fixed height of 700 pixels looks awkward on a phone. Wrap the frame in a container and use viewport units:

<div style="position: relative; width: 100%; height: 80vh; min-height: 480px;">
  <iframe src="/files/brochure.pdf"
          style="position:absolute; inset:0; width:100%; height:100%; border:0;"
          title="Product brochure"></iframe>
</div>

Here is how the three tags compare:

TagFallback contentAccessibilityBest for
<iframe>NoGood with a title attributeQuick embeds, third-party viewers
<object>YesGoodPages that need a download fallback
<embed>NoLimitedLegacy pages

Free Options Worth Trying

If you do not want to rely on the browser, several free tools wrap the PDF in a more predictable viewer.

Overhead view of a desk with a laptop, printed reports and a smartphone

Google Drive Preview

Upload the file to Google Drive, set sharing to "Anyone with the link," and use the preview URL in an iframe:

<iframe
  src="https://drive.google.com/file/d/YOUR_FILE_ID/preview"
  width="100%" height="600" allow="autoplay">
</iframe>

It is free, fast to set up and works on mobile. The downsides are Google branding, a pop-out button that sends visitors to Drive, and no control over the design.

PDF.js from Mozilla

PDF.js is the open-source library that powers Firefox's viewer. You can host the viewer files yourself and point it at your document:

<iframe
  src="/pdfjs/web/viewer.html?file=/files/brochure.pdf"
  width="100%" height="700">
</iframe>

You get consistent rendering across browsers and a viewer you can restyle. The price is setup time and ongoing maintenance, since you host and update the files.

Free Embed APIs and Plugins

Adobe offers a free PDF Embed API that needs a client ID tied to your domain, and WordPress has several free plugins that add a PDF block to the editor. These work well for small sites, though free tiers often add limits or branding.

OptionCostMobile supportCustom designSetup effort
Native iframeFreePoorNoneMinutes
Google Drive previewFreeGoodNoneMinutes
PDF.js self-hostedFreeGoodHighHours
WordPress PDF pluginFree or paidVariesMediumMinutes
Flipbook converterFree trial, paid plansExcellentHighMinutes

💡 Free is great for internal documents and quick tests. If the PDF is a sales tool, such as a catalog or a proposal, the free viewers leave money on the table.

Where Plain PDF Embeds Fall Short

Even a perfectly working embed has limits that matter for business content.

  • No analytics. You will not know whether anyone reached page four.
  • No branding. The viewer looks like a generic file reader, not your site.
  • Slow loading. A 40 MB catalog must download in full before page one appears.
  • No interactivity. Links, videos and audio inside the document are either dead or open in new tabs.
  • Easy to copy. Anyone can save the file and pass it around, and you have no control over access.

Small boutique owner arranging a printed catalog beside a laptop

Picture a boutique owner with a 60-page lookbook. She embeds it with an iframe, tests it on her laptop, and it looks fine. Then a customer opens it on a phone, sees a blank box and leaves. That single failure costs more than the hour she would have spent picking a better method.

Flipbook Alternatives That Feel Better

A flipbook takes the same PDF and rebuilds it as a web-native reader. Pages load one at a time, the layout adapts to the screen, and visitors turn pages with a swipe or a click. Because it is a web page rather than a file, you can add the features a PDF never had.

Publisher standing at a drafting table covered with glossy magazine spreads

Plain PDF vs Flipbook

FeatureEmbedded PDFFlipbook
Works on phonesInconsistentYes, mobile-responsive
Page-turn effectNoYes
Custom colors and logoNoYes
Password protectionServer-side onlyBuilt in
Reader analyticsNoYes, on higher plans
Video and audioNoYes
Loads first page quicklyNoYes
Offline downloadAlways possibleOptional, you decide

When a Flipbook Is the Better Pick

  • Catalogs and price lists where visitors browse before they buy
  • Magazines and newsletters where the reading experience is part of the product
  • Annual reports that need analytics on which sections people read
  • Lookbooks and portfolios where visual impact matters
  • Training manuals that need password protection

If you only need to show a one-page invoice, stay with an iframe. If the document is meant to impress or convert, a flipbook earns its place.

How to Embed a Flipbook in Minutes

Here is the full process using Flipbooks AI. It takes less time than setting up PDF.js.

Woman in a gray blazer working on a laptop in a coworking space

Step 1: Create Your Account

Head to Flipbooks AI and sign up. You can try it free before choosing a plan, and every flipbook is free of watermarks, always.

Step 2: Upload and Convert the PDF

Drag your file into the PDF to Flipbook Converter. The platform processes each page and builds the reader automatically. Large files are fine, because pages load progressively rather than all at once.

✅ Best practice: Export your PDF at 150 DPI for screens. Higher resolutions make the file heavy without a visible gain.

Step 3: Customize the Look

Hand on a laptop trackpad with a tablet showing a page layout

Open the design panel and adjust:

  1. Branding: upload your logo and choose brand colors
  2. Background: pick a solid color, gradient or image behind the book
  3. Page effects: set the flip animation and sound
  4. Multimedia: drop in videos, audio clips and clickable links
  5. Layout: switch between single-page and double-page views

Step 4: Copy the Embed Code

Open the share panel and choose the embed option. You get a snippet similar to this one (the URL below is a placeholder, so use the code from your own dashboard):

<iframe
  src="https://flipbooksai.com/your-flipbook-link"
  width="100%"
  height="650"
  style="border: 0;"
  allowfullscreen
  title="Product catalog">
</iframe>

Paste it into any page builder, CMS or hand-coded site. The Embed Flipbook on Website tool explains the placement options for WordPress, Wix, Squarespace and Shopify. Prefer not to embed at all? Share the direct link instead, or add a password so only invited readers can open it.

Step 5: Turn On the Professional Plan Extras

Marketing team reviewing results on a laptop around a table

The Professional plan adds the features that plain PDFs cannot match:

  • Analytics: see views, time on page and the pages that hold attention
  • Lead generation: ask readers for an email before they open the book
  • Offline downloads: let people save a copy when you choose to allow it
  • Unlimited flipbooks: available from the Standard plan and above

Real-World Use Cases

Different documents call for different tools. These examples show how teams put embeds to work.

A Restaurant Menu That Updates Itself

A restaurant owner keeps one flipbook on the website and swaps the PDF whenever the seasonal menu changes. The link and embed code stay the same, so no one touches the HTML. The Restaurant Menu Creator is built for exactly this.

A Product Catalog With Lead Capture

A furniture seller embeds a catalog on the category page and asks for an email at page three. Sales see who looked at which sofas. The Product Catalog Generator and Furniture Catalog Maker support this kind of setup.

Course Material for Students

Lecturer sharing course reading material with a student at a library table

A lecturer embeds weekly readings in the course site and protects them with a password. Students read on phones between classes without downloading anything. The Course Material Publisher fits this workflow well.

Other Common Setups

Use caseRecommended methodTool
Hotel or travel brochureFlipbookHotel Brochure Designer
Annual reportFlipbook with analyticsAnnual Report Creator
Photography portfolioFlipbookPhotography Portfolio
Single legal formiframe or objectPlain HTML
Internal team memoGoogle Drive previewFree

Common Mistakes to Avoid

  1. Skipping the mobile test. Always open the page on a real phone before you publish.
  2. Linking to a huge file. Compress images inside the PDF first.
  3. Forgetting alt text and titles. Screen readers need the title attribute on every iframe.
  4. Using a fixed pixel width. Use width="100%" so the frame fits any screen.
  5. Hosting on a domain that blocks framing. Check the X-Frame-Options header if the frame stays empty.

⚠️ Embedding a PDF you do not own can raise copyright questions. Confirm you have the right to publish the document before you put it on a public page.

Pick the Right Method

Use this table as a shortcut:

Your situationBest method
Quick internal share, desktop usersiframe with a direct PDF link
Need a fallback messageobject tag
Free and mobile friendly, no design needsGoogle Drive preview
Developer who wants full controlSelf-hosted PDF.js
Customer-facing, branded, trackedFlipbook

Ready to Embed Your PDF?

For a quick test, paste the iframe snippet from this article into your page and see how it behaves. For anything visitors will judge you by, build a flipbook instead. Create your free account on Flipbooks AI, upload your PDF, and have an embed code ready before your coffee cools. Browse all flipbook tools and templates to find one that matches your document, or compare pricing plans to see which features fit your project.

Share this article

Choose your language

FreeTurn any PDF into a flipbookFree, No Credit CardRealistic Page TurnsShare With One LinkCreate a Flipbook