Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Point an <iframe> at the PDF’s actual URL, set an intentional size, add a concise title, and place a normal link to the same file outside the frame. The browser can then use its built-in PDF viewer while visitors still have a reliable way to open or download the document if inline viewing is unavailable.

Basic PDF iframe markup

Use an absolute or site-relative URL that resolves directly to a PDF response:

<iframe
  src="/files/example.pdf"
  title="Example document PDF"
  width="100%"
  height="600"
></iframe>
<p><a href="/files/example.pdf">Open or download the PDF</a></p>

The separate link is essential. An iframe has no child-content fallback that browsers can reliably show when a PDF viewer cannot render the file. A visitor can use the link to open the document in a new tab, download it, or choose another application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use deliberate dimensions

If you omit dimensions, the iframe reference defaults to roughly 300 CSS pixels wide and 150 CSS pixels high. Those defaults are too small for a useful document preview. The width and height attributes above provide a predictable starting point; production layouts commonly use CSS for responsive width and a height appropriate to the surrounding page.

#1 Best Overall
IPEVO V4K Ultra High Definition 8MP USB Document Camera — Mac OS, Windows, Chromebook Compatible for Live Demo, Web Conferencing, Distance Learning, Remote Teaching, Green
  • Features an 8 Megapixel camera for capturing Ultra High Definition live images up to 3264 x 2448 pixels
  • High frame rate for lag-free live streaming – streams at up to 30 fps at full HD, and up to 15 fps at 3264 x 2448 pixel
  • Fast focusing speed helps minimize interruptions for frequent switching between different materials; features Sony CMOS Image Sensor for exceptional noise reduction and color Reproduction – great for capturing in dimly lit environments
  • Designed and made in Taiwan. Multi-jointed stand offers a simple fix for tightening loose joints caused by heavy daily use.Max Shooting Area:13.46 inch x 10.04 inch
  • Works with a variety of software and applications on Mac, PC and Chromebook that allows you to use it in different ways. System Requirements - Mac Intel Core i5 CPU 2.5 GHz or higher, OS X 10.10 or higher, Solid-state drive, and 200MB of free hard disk space, 256MB of dedicated video memory (For lag-free live streaming up to 1920 x 1080, and video recording of 1920 x 1080). Windows Recommended Requirements - Microsoft Windows 10,Intel Core i5 CPU 3.40 GHz or higher, 4 GB RAM, 200MB of free hard disk space, 256MB of dedicated video memory (For lag-free live streaming up to 1920 x 1080, and video recording of 1920 x 1080)
.pdf-frame {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 32rem;
  border: 0;
}
<iframe
  class="pdf-frame"
  src="/files/example.pdf"
  title="Example document PDF"
></iframe>

Choose a height that leaves enough room for the browser’s toolbar and several lines of the page. A very short frame forces constant scrolling; a very tall frame can dominate a page on a small screen. Test the surrounding layout at the narrowest viewport you support.

Make the frame accessible and usable

Write a meaningful title

The title identifies the embedded browsing context to screen-reader users before they enter it. “Example document PDF” is useful; “iframe” or “PDF viewer” alone is not. If the document has a version or purpose, include that information briefly, such as “2026 privacy policy PDF.”

Keep a visible direct link

Put the link immediately before or after the frame and use descriptive text. Do not rely on an icon or on the viewer’s controls. The link also helps users whose browser, device, assistive technology, or security policy does not provide an inline viewer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Consider an HTML alternative

Embedding does not repair accessibility problems inside a PDF, and a PDF can be difficult to read on a phone. For important or frequently consulted material, offer an equivalent HTML page as well as the file. The HTML version can provide reflowable text, headings, navigation, and search that a PDF viewer may not expose conveniently.

Rank #2
Sale
PAKOTOO 8MP USB Document Camera for Teachers and Classroom for A3 A4 Size with Dual Mic, 3-Level LED Light, Up and Down, Left and Right Image Inversion, for Distance Teaching & Learning
  • Document camera with Image reversal function: The image reversal function can be realized through the button (no need to pass the software). When video chatting or picture output, the picture can be freely reversed left and right, up and down; The PAKOTOO document camera connects the computer via USB 2.0 cable, it does not support zoom and HDMI features, nor it does compatible with iPad.
  • Document camera for teachers with 3 levels of brightness adjustment and 10 levels of exposure adjustment: The brightness function can be realized by buttons to ensure that you can get clearer images. It can also realize the Selfie fill light function in dark and bright environments
  • Document camera for classroom with Foldable: Embedded design, takes up little space after folding, and is easy to carry; multi-joint supports multi-angle free rotation, which can better capture 2D and 3D objects. Maximum coverage area: 16.5" x 11.6" in (A3 paper)
  • USB document camera with autofocus: 2448P high-definition document cameras, press the focus (AF) button once, and the document camera will automatically focus once. Move the object under the lens, the image will not be blurred. Macro captures objects as small as 3.94"
  • Important: PAKOTOO Document camera is not plug and play. You need to select "USB Camera" in the system that comes with your computer. The document camera is equipped with a USB-C cable, which can be directly used with devices with USB-C interface such as MacBook. Compatible with Windows PCS, Macs and Chromebooks, works with Tiktok, Google Meet, Skyp-Microsoft Teams, Zoom; If you encounter any problems during the use of the product, or the computer does not recognize the camera, please be sure to contact our friendly support team for a quick solution.

Iframe versus object and embed

All three elements can reference a PDF, but they solve different practical problems:

Element Best fit Fallback and controls Guidance
iframe Ordinary PDF preview using the browser viewer No dependable child fallback; supports iframe controls such as loading and referrerpolicy Preferred for most previews; provide an outside link
object Cases where fallback markup inside the element is required Can contain explanatory text and a link Use when embedded fallback content is a requirement
embed Generic browser-handled embedded content No child fallback and no iframe loading controls No documented advantage for PDF previews

Object with in-element fallback

<object data="/files/example.pdf" type="application/pdf" width="100%" height="600">
  <p>This browser cannot display the PDF inline.
    <a href="/files/example.pdf">Open or download the PDF</a>.
  </p>
</object>

This pattern is useful when the fallback message must be part of the embedded element. It does not remove the value of a separate, prominent link when you want a consistent escape route.

Optional iframe attributes

  • loading="lazy" can defer loading a PDF that is below the initial viewport.
  • referrerpolicy lets you control which referrer information is sent when the frame requests the file; select a policy that matches your privacy and server requirements.

Do not add attributes simply because they are available. Confirm that the chosen loading and referrer behavior works with your PDF host and analytics, and remember that lazy loading is unsuitable when the preview must be available immediately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a PDF downloads instead of displaying

Inspect the HTTP response for the PDF URL, not just the HTML source. The Content-Disposition header influences how browsers handle the response:

Rank #3
AlKOR Document Camera for Teaching, Manual Focus USB Webcam with Microphone
  • AIKOR 2MP 3-in-1 USB Webcam, Document Camera and Visualiser: It can be used as a webcam for video chats and teleconferences. The rotating lens allows for image clarity adjustment during live demonstrations. Featuring a flexible 0.47-inch diameter hose design, it can be adjusted to any angle.
  • Portable Document Camera: This lightweight document camera weighs only 1.1 pounds, extends up to 20.4 inches in height, and features a 360-degree adjustable and rotatable camera for capturing images and videos from multiple angles. It can present objects of varying sizes and positions, and the weighted base ensures excellent operational stability. This document camera combines portability with high performance, making it an ideal choice for educators and professionals.
  • Manual focus webcam: This document camera uses precise manual focus to avoid the repeated unclear focus caused by auto focus. It can achieve virtualized real-life effect shooting when needed, supports 1080P full HD resolution, and refresh rate up to 30 frames per second. Manual focus helps to stabilize the focus and restore the true color and texture.
  • Versatile Document Camera: Equipped with a CMOS image sensor and built-in sealed silicon microphone to reduce noise and improve sound quality, achieving excellent noise reduction and color reproduction. Suitable for education, home and office (video conferencing, online teaching, online tutoring, home office, video calls, making teaching videos, animations, games and live demonstrations).
  • High compatibility: The visualiser document camera comes with a USB-C cable and can be used directly with devices equipped with a USB-C port (such as MacBook). Compatible with Windows PC, Mac and Chromebook, and can be used with software such as TikTok, Google Meet, Skype, etc. It can be used with all major web conferencing software applications (Zoom, Google Meet, etc.).
  • inline indicates that the resource may be displayed in the page or viewer.
  • attachment tells the browser to treat it as a download and commonly opens a save prompt.

Also verify that the iframe’s src resolves to the actual PDF resource rather than an application route, login page, redirect, or HTML error document. The server must permit the browser to retrieve the response. If the file is hosted on another origin, check that the host allows the request and that authentication is available in the frame’s context.

Server checklist

  • Return the correct PDF media type, normally application/pdf.
  • Use a URL that remains valid for the visitor and does not require an unavailable session.
  • Review redirects and access-control rules in the browser’s network panel.
  • Check whether a security policy or frame-ancestors rule prevents your page from embedding the resource.

Content Security Policy and framing

If your site sends a Content Security Policy, frame-src controls the origins that may be loaded by iframe. Add the PDF origin (including your own origin where appropriate) to that directive. For object and embed, the relevant CSP directive is object-src. A policy that omits the PDF origin can produce a blank frame even when the URL works in a new tab.

Inspect the console for CSP violations and update the policy deliberately rather than disabling CSP broadly. If the PDF host sends framing restrictions, those headers may also need to permit your site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Security considerations for native PDF viewers

Browser PDF renderers sandbox executable content. It is tempting to add the iframe sandbox attribute for extra isolation, but the documented guidance warns that sandboxing can prevent the built-in PDF viewer from working. It is not a portable way to restrict a native PDF preview, so do not add it reflexively. If you need strict isolation, evaluate the viewer, browser support, and security policy as a complete design rather than assuming one attribute is sufficient.

Rank #4
INSWAN INS-1 Classic USB Document Camera/Webcam, 8MP, Built-in LED, Mic
  • [Crystal-Clear Imaging and Smooth Video Streaming] 8 Megapixel Ultra-High definition SONY camera captures live images at up to 3264 x 2448 pixels with lag-free video streaming at 30 fps across all resolutions.
  • [Your Space-Saving Multi-Joint Camera] Experience the durability of our multi-joint design while enjoying a generous viewing size of 14.72 x 11 inches. This compact camera is perfect for your desktop set up.
  • [Powerful Features, Crisp Image] Featuring LED light, and an anti-glare sheet for exposure challenges in varying lighting. 7-segment brightness control, image flip, and built-in mic ensure top-notch performance. Autofocus lens and macro capability (capturing objects as close as 3.9 inches).
  • [Feature-Packed INSWAN Documate Software] The bundled full-function INSWAN Documate software offers digital zoom, image annotation, hue adjustment, image rotation/flip, video recording, snapshots and other useful features. Download the latest version for free and access tutorial videos!
  • [Plug-n-Play & High Compatibility for Effortless Conferencing] The INS-1 comes with a USB-A cable for instant plug-and-play operation. Seamlessly works with Documate and other webinar software on PC (Windows 7/8/10/11), Mac (OS13.5 or higher), iPad (OS 17 or higher; must have a USB-C port) , Chromebook (38.0 or higher). Designed and made in Taiwan.

Only embed PDFs you trust or have permission to publish. Treat user-uploaded files as untrusted data, validate uploads on the server, and keep authorization checks on the PDF endpoint. Embedding a file does not make its contents safe or accessible.

Responsive and mobile-friendly patterns

A percentage width works well when the containing block is responsive, while height usually needs a viewport-based or breakpoint-specific value:

.pdf-frame {
  width: 100%;
  height: clamp(28rem, 75vh, 60rem);
  border: 1px solid #d0d7de;
}

@media (max-width:  fortyrem) {
  .pdf-frame {
    height: 70vh;
    min-height: 24rem;
  }
}

Replace the illustrative breakpoint with the valid CSS length you use in your design system (for example, 40rem); CSS does not accept words inside a length. Keep the link outside any horizontally scrolling container, use sufficient contrast, and avoid placing essential instructions only inside the PDF.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

The frame is blank

  • Open the src URL directly. If it is not a PDF, fix the route, redirect, authentication, or server response.
  • Check the developer console for CSP or framing violations and allow the origin with frame-src.
  • Confirm the response is not blocked by an expired signed URL or a permission check.

The browser downloads the file

  • Inspect Content-Disposition; change an intentional attachment response to an inline-capable response if previewing is desired.
  • Verify that the URL is the file endpoint, not a download handler that always forces saving.

The PDF works in a new tab but not in the frame

  • Compare response headers and request context between the two loads.
  • Look for CSP, frame-ancestors, cross-origin authentication, or referrer-dependent access rules.
  • Retain the direct link so users are not trapped when an embedded viewer is unavailable.

The frame is tiny or causes layout problems

  • Set explicit CSS width and height; do not rely on the 300-by-150 default.
  • Check that a parent element is not constraining width, and use a minimum height on desktop layouts.

The viewer fails after adding sandbox

Remove sandbox and retest. Native PDF viewers may not function inside a sandboxed iframe, and the attribute is not a portable restriction for this use case.

Best Value
4K USB Document Camera for Teacher, 8MP Webcam & Visualiser for A3 Size with Dual Microphones, 3-Level LED Light, Image Invert, Foldable for Live Demo, Work with Windows, macOS and Chrome OS
  • 8MP visualiser with adjustable image reversal: In video chat or image output, the image can be freely adjusted left/right and up/down; you can also manually adjust the reversed image that appears in the device to a normal image. The first usb camera that can manually adjust image reversal
  • Adjustable Image Brightness: the usb document camera has brightness buttons, you can manually adjust the image brightness with 10 degree, to make sure that you can get the clear image. 3 levels of brightness adjustable, which can eliminate shooting problems under difficult lighting conditions, allowing you to capture objects in dark and bright environments, and it can also achieve Selfie fill-in function
  • Foldable visualiser for teaching: embedded design, occupies a small space after folding, easy to carry; Multi-joint support with multi-angle rotate freely usb camera can capture 2D and 3D objects better and shooting high-definition images and videos. Maximum covering area: 16.5" x 116" in (A3 paper)
  • 8MP/2448P document camera for teachers with 30fps: using High-end image sensor, it output ultra-high-definition images and videos live transmission, up to 2448P megapixels. Press the focus button once to automatically focus the document camera once. Moving the object under the lens, the camera will not be arbitrary automatic focus and the image dance. Macro can capture objects as close as 3.94"
  • Plug-n-Play & High Compatibility: the Kitchbai Visualiser comes with a USB-C cable that allows for instant plug-and-play operation for distance education and web conferencing. It applicable to Windows PCS (Windows 7/8/10/11) , Macs (OS10.11 or higher), and Chromebooks(38.00 or higher), and work with Tiktok, Google Meet, Skyp-Microsoft Teams, Zoom; it has built-in dual silicon microphones, which can reduce noise and improve sound quality

Or skip the browser setup

If your actual goal is a clean image or PDF capture of a web page rather than an interactive PDF viewer, ScreenshotNeo provides a website screenshot API and MCP server. A single request can capture a URL as PNG, JPEG, WebP, or PDF. For example:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for the complete options and response headers. Before capture, it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Implementation checklist

  1. Use the PDF’s real, reachable URL in src.
  2. Set a useful title and intentional responsive dimensions.
  3. Place a descriptive direct link outside the iframe.
  4. Check Content-Disposition, media type, redirects, authentication, and CSP.
  5. Test desktop, mobile, keyboard, and screen-reader navigation.
  6. Offer HTML content when the PDF is essential or difficult to read.

Frequently Asked Questions

Can I put fallback text inside an iframe?

No reliable child fallback is available for an iframe PDF preview. Put the explanatory text or download link outside the iframe, or use an object element when in-element fallback is required.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does my PDF open in a new tab but not inside the iframe?

Compare the two requests for CSP, framing restrictions, authentication, redirects, and response headers such as Content-Disposition.

Should every PDF iframe use sandbox?

No. Sandboxing can stop the native PDF viewer from working and is not a portable restriction for this preview pattern.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.