Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/gunjanjaswal/pdf-embed-forge/releases/download/v1.0.5/pdf-embed-forge.zip📄 PDF Embed Forge
Embed PDFs directly inside your WordPress posts and pages
A lightweight PDF embed plugin with a Gutenberg block and a shortcode. It uses the browser's own PDF viewer, so there's no bulky library to load and nothing ever leaves your server.
✨ What it does
Most PDF embeds either drop a plain download link, or pull in a megabyte of JavaScript to render something the browser already renders perfectly well. PDF Embed Forge takes the lighter road: it points the browser at your file and lets its built-in viewer do the work. You pick a PDF, set a height, and your readers scroll through it without ever leaving the page.
No account, no API key, no external request. The file stays on your own site.
🎯 Features
| 🧱 Block editor | A PDF Embed Forge block with a live preview while you set it up. |
| 🔤 Shortcode | [pdf-embed-forge] for the classic editor, widgets, or template files. |
| 📐 Adjustable height | Set the viewer to any pixel height you like. |
| 🛠️ Toolbar toggle | Show or hide the viewer's built-in toolbar. |
| 🖥️ Full-width read | Fits the page to the viewer width and hides the thumbnail sidebar. |
| 📱 Responsive | Fits phones and wide desktop layouts out of the box. |
| 🌍 Translation ready | All strings are wrapped, with a translation template included. |
| 🔒 Safe output | Everything is escaped and sanitised the WordPress way. |
📦 Installation
From your dashboard
- Go to Plugins → Add New → Upload Plugin.
- Choose
pdf-embed-forge.zipand click Install Now. - Click Activate.
From this repository
- Download the latest release, or clone the repo.
- Put the folder in
wp-content/plugins/aspdf-embed-forge. - Activate PDF Embed Forge on the Plugins screen.
There is no settings page, so you can start embedding right away.
🚀 How to use
Embed a PDF with the block
- Edit a post or page.
- Click the + block inserter and search for PDF Embed Forge.
- Add the block, then click Upload or Media Library and pick your PDF.
- In the block sidebar, set the viewer height, show or hide the toolbar, and add an accessible title if you want one.
- Use Replace PDF in the block toolbar any time you need to swap the file.
- Publish. The PDF appears inline, fitted to your content width.
Tip: To run the viewer edge to edge, select the block and choose Wide width or Full width from the block toolbar.
Embed a PDF with the shortcode
Reach for the shortcode in the classic editor, a widget, or a template file.
Embed a file from the Media Library by its attachment ID:
[pdf-embed-forge id="123"]
Embed any PDF by URL, taller and with the toolbar hidden:
[pdf-embed-forge url="https://example.com/files/report.pdf" height="800" toolbar="0"]
Call it from a template:
<?php echo do_shortcode( '[pdf-embed-forge id="123"]' ); ?>
The older
[pdf-forge]shortcode still works as an alias, so anything built before the rename keeps running.
Shortcode attributes
| Attribute | Description | Default |
|---|---|---|
id |
Media Library attachment ID of the PDF. | — |
url |
Direct URL to a PDF (used when no id is given). |
— |
height |
Viewer height in pixels. | 600 |
toolbar |
1 shows the viewer toolbar, 0 hides it. |
1 |
title |
Accessible title for the viewer, read out by screen readers. | — |
Finding a PDF's attachment ID
Open Media → Library, click the PDF, and read the item= number in the address bar. Or copy the file URL and use the url attribute instead.
❓ FAQ
Does it work on mobile? Yes. On phones, where inline PDF frames are cramped (and unreliable in iOS Safari), the embed shows the PDF's first page with a "View full screen" button that opens it in the device's native viewer. The preview image is the one WordPress generates on upload; where the host can't make one, a document icon is shown instead. Larger screens get the inline viewer.
Can I hide the toolbar or the pages sidebar?
The thumbnail sidebar is hidden automatically. To hide the toolbar too, set toolbar="0" or flip the toggle in the block sidebar. Chromium-based browsers honour it; others show their own controls.
Can I embed a PDF hosted somewhere else?
Yes, pass its full URL to the url attribute. Bear in mind some hosts block being embedded in a frame, which is their setting, not the plugin's.
Where do my PDFs go? Nowhere new. The browser loads the file straight from your site. Nothing is uploaded to or routed through any outside service.
🧩 WordPress.org ready
Built to the WordPress.org plugin guidelines: a proper readme.txt, a unique prefix, escaped output, sanitised input, a bundled translation template, and GPL-2.0-or-later licensing, with no external calls. It passes the official Plugin Check plugin.
🛠️ Development
The block is written in plain wp.element calls with no build step, so the source in assets/js/block.js is exactly what runs. Clone the repo into wp-content/plugins/pdf-embed-forge and start editing.
pdf-embed-forge/
├── pdf-embed-forge.php # Plugin bootstrap
├── readme.txt # WordPress.org readme
├── includes/
│ └── class-pdf-embed-forge.php # Block + shortcode + shared renderer
├── block/
│ └── block.json # Block metadata
├── languages/
│ └── pdf-embed-forge.pot # Translation template
└── assets/
├── css/pdf-embed-forge.css # Front-end + editor styles
└── js/block.js # Block editor (no build required)
💛 Support
If PDF Embed Forge saves you some time, a coffee is always appreciated.
👤 Author
Gunjan Jaswal
📜 License
Released under the GPL-2.0-or-later license.
Releases
5 releases. Each count is every asset in that release; expand a row for the breakdown.