FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

afragen/embed-pdf-viewer: Embed a PDF from the Media Library or elsewhere via oEmbed or a Gutenberg block. A WordPress plugin. · GitHub

Repository files navigation

Embed PDF Viewer

  • Contributors: afragen, akirk, costdev
  • Tags: pdf, embed, oembed, viewer, block
  • Requires at least: 6.0
  • Requires PHP: 7.4
  • Stable tag: master
  • License: GPL v2+
  • License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed a PDF from the Media Library or elsewhere via oEmbed or as a block into an iframe tag.

Description

Embed a PDF from the Media Library or elsewhere via oEmbed or as a block into an iframe tag. The URL only has to be world reachable link. Chrome uses Google Doc Viewer as Chrome seems to automatically rendered embedded JS in PDFs automatically. Uses Google Doc Viewer with mobile.

Inspired by Embed PDF and RV Embed PDF.

Many thanks to Alex Kirk for making Embed PDF Viewer compatible with the new block editor.

Pull requests are welcome against the develop branch.

Development

The block is built from source in blocks/ with @wordpress/scripts (Node 20+). blocks/build/ is gitignored — a fresh checkout has no built assets, so build once locally before testing:

cd blocks
nvm use           # or: nvm use 20
npm ci
npm run build     # one-time build → blocks/build/
# or: npm start   # watch mode for development

Then symlink (or copy) the plugin into a local WordPress install, e.g. wp-content/plugins/embed-pdf-viewer → this checkout. CI rebuilds from source for releases, so build output is disposable locally.

Known Issues

Occasionally Google Doc Viewer will not correctly load the PDF. Reloading the page should correct the issue, though this may need to be done several times.

Screenshots

Embed PDF Viewer block

Select PDF

PDF block and attributes

About

Embed a PDF from the Media Library or elsewhere via oEmbed or a Gutenberg block. A WordPress plugin.

Resources

Stars

41 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL