=== BrilliantMinds PDF Embed ===
Contributors: brilliantminds
Tags: pdf, pdf viewer, embed pdf, document, gutenberg
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed PDF files with a fast, beautiful, responsive viewer. Includes a block, shortcode, dark mode, zoom, fullscreen and many options.

== Description ==

BrilliantMinds PDF Embed turns any PDF into a clean, modern reading experience inside your content. Visitors read the document right on your page, with no plugins to install and no third-party services involved. Everything runs from your own server.

**Highlights**

* **PDF Viewer block** for the block editor: upload or choose a PDF, adjust options in the sidebar.
* **Shortcode** for the classic editor, page builders and widgets: `[bmpdf url="https://example.com/file.pdf"]`
* **Continuous scroll or one page at a time**, with swipe navigation on touch screens.
* **Zoom, fit to width, fit to page, rotate** and a page number field.
* **Light, dark or automatic color scheme**, plus a toggle so visitors can choose.
* **Fullscreen mode**, download, print and open-in-new-tab buttons. Each one can be turned off.
* **Selectable, copyable text.**
* **Your accent color, corner radius, shadow, width, height and alignment.**
* **Top or bottom toolbar**, as a full-width bar or a floating pill.
* **Load on click** option so pages with several PDFs stay fast.
* **Auto-embed** option: paste a PDF link on its own line and it becomes a viewer.
* **Lazy rendering**: only the pages near the screen are drawn, so large documents stay smooth.
* **Accessible**: keyboard shortcuts, labeled controls, visible focus and reduced-motion support.
* **Privacy friendly**: no tracking, no cookies, no external requests. The theme toggle remembers a visitor's choice in their own browser.
* **Translation ready.**

**Shortcode options**

All options are optional and override the defaults from Settings > PDF Viewer.

* `url` - link to the PDF file.
* `id` - Media Library attachment ID (use instead of `url`).
* `title` - title shown in the toolbar.
* `width`, `height` - for example `width="80%" height="600"`.
* `align` - `left`, `center` or `right`.
* `mode` - `scroll` or `single`.
* `zoom` - `width`, `page` or a percentage such as `125`.
* `page` - page to open first.
* `theme` - `auto`, `light` or `dark`.
* `accent` - hex color, for example `#0f766e`.
* `radius` - corner radius in pixels.
* `toolbar_position` - `top` or `bottom`. `toolbar_style` - `bar` or `floating`.
* On/off options (use `1` or `0`): `shadow`, `show_title`, `page_input`, `zoom_controls`, `rotate`, `theme_toggle`, `fullscreen`, `download`, `print`, `open_new`, `text_select`, `disable_context`, `load_on_click`.

Example: `[bmpdf id="123" height="600" theme="dark" mode="single" download="0"]`

**Developers**

Use the `bmpdf_viewer_config` filter to change the configuration passed to the viewer.

== Installation ==

1. Upload the `brilliantminds-pdf-embed` folder to `/wp-content/plugins/`, or install the plugin from the Plugins screen.
2. Activate the plugin.
3. Go to Settings > PDF Viewer to choose your defaults.
4. Edit a post or page, add the **PDF Viewer** block, and choose a PDF. Or use the shortcode.

== Frequently Asked Questions ==

= Does it work with PDFs hosted on another website? =

Only if that website allows cross-origin requests (CORS). If it does not, the viewer shows a button that opens the file directly. PDFs in your own Media Library always work.

= Can I stop people from downloading the PDF? =

You can hide the download and print buttons and disable right-click. This keeps casual visitors from saving the file, but a PDF that is publicly viewable can always be saved by a determined visitor. For truly private documents, use a membership or access-control plugin.

= Are password-protected PDFs supported? =

Yes. The viewer asks the visitor for the password.

= Does it send data to any external service? =

No. The viewer library is bundled with the plugin and all files are loaded from your own site.

= Why is my PDF shown as a link instead of a viewer? =

The link is shown while the viewer loads, or when JavaScript is disabled, or when the file cannot be read (for example because of missing CORS headers).

= Does it work with page builders? =

Yes, any builder with a shortcode or shortcode widget element works. If you add a viewer dynamically after the page loads, call `window.BMPDF.init()`.

== Screenshots ==

1. The viewer in dark mode with the full toolbar.
2. The PDF Viewer block in the block editor.
3. Settings: layout.
4. Settings: appearance.
5. Settings: toolbar buttons.
6. Settings: behavior.

== Third-party libraries ==

This plugin bundles **PDF.js** by Mozilla, version 4.10.38, licensed under the Apache License 2.0 (compatible with GPLv2 or later).

* Source code and project page: https://github.com/mozilla/pdf.js
* Package: https://www.npmjs.com/package/pdfjs-dist (version 4.10.38, `legacy/build` files)
* Files in `assets/vendor/pdfjs/`: `pdf.min.js` and `pdf.worker.min.js` are the unmodified `legacy/build/pdf.min.mjs` and `pdf.worker.min.mjs` files from that package, renamed to `.js` (so that every web server sends the correct content type) and with the trailing source-map comment removed. `cmaps/` and `standard_fonts/` are copied unchanged from the same package. The license is in `assets/vendor/pdfjs/LICENSE.txt`.
* To rebuild the minified files from source, follow the build instructions in the PDF.js repository at the tag `v4.10.38`.

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
