WP Manifestindependent plugin directory
manifest / media / docuforge

DocuForge — PDF Viewer

Embed PDFs directly inside your WordPress posts and pages

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/gunjanjaswal/docuforge/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

📄 DocuForge

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. DocuForge 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 DocuForge block with a live preview while you set it up.
🔤 Shortcode [docuforge] 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

  1. Go to Plugins → Add New → Upload Plugin.
  2. Choose docuforge.zip and click Install Now.
  3. Click Activate.

From this repository

  1. Download the latest release, or clone the repo.
  2. Put the folder in wp-content/plugins/ as docuforge.
  3. Activate DocuForge 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

  1. Edit a post or page.
  2. Click the + block inserter and search for DocuForge.
  3. Add the block, then click Upload or Media Library and pick your PDF.
  4. In the block sidebar, set the viewer height, show or hide the toolbar, and add an accessible title if you want one.
  5. Use Replace PDF in the block toolbar any time you need to swap the file.
  6. 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:

[docuforge id="123"]

Embed any PDF by URL, taller and with the toolbar hidden:

[docuforge url="https://example.com/files/report.pdf" height="800" toolbar="0"]

Call it from a template:

<?php echo do_shortcode( '[docuforge id="123"]' ); ?>

The former [pdf-embed-forge] and [pdf-forge] shortcodes still work as aliases, 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/docuforge and start editing.

docuforge/
├── docuforge.php               # Plugin bootstrap
├── readme.txt                        # WordPress.org readme
├── includes/
│   └── class-docuforge.php     # Block + shortcode + shared renderer
├── block/
│   └── block.json                    # Block metadata
├── languages/
│   └── docuforge.pot           # Translation template
└── assets/
    ├── css/docuforge.css       # Front-end + editor styles
    └── js/block.js                   # Block editor (no build required)

💛 Support

If DocuForge saves you some time, a coffee is always appreciated.

Ko-fi

👤 Author

Gunjan Jaswal

📜 License

Released under the GPL-2.0-or-later license.