| 开发者 |
strands
LordFren |
|---|---|
| 更新时间 | 2026年10月13日 19:23 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
prefers-color-scheme)[pdf_embed] shortcode[pdf_embed id="123" sizing="responsive" download="yes" navigation="yes" zoom="yes"]
All attributes are optional except id. Per-embed attrs override the global defaults on the Sizing and Appearance tabs.
pdf-embed/ folder to wp-content/plugins/Yes. Copy wp-content/plugins/pdf-embed/templates/viewer.php to wp-content/themes/your-theme/pdf-embed/viewer.php and edit.
It mirrors WordPress's own permission model. The viewer only renders for visitors who have permission to read the underlying post (current_user_can('read_post', $id)). In practice that means:
Drop a .po / .mo / .l10n.php file into the plugin's languages/ folder using the pdf-embed text domain.
Yes. Activation seeds defaults per site, and uninstall cleans options on each site (including the legacy pdfembed_source from older versions). No network-wide tables, no add_site_option use; per-site settings stay independent.
In Enfold's Advanced Layout Builder, look for PDF Embed under the Media Elements tab. If your Enfold runs in a non-English language, Enfold groups elements by localized tab name and ours stays in English — so PDF Embed may show up in its own auto-created group instead. The element itself works identically either way.
The viewer renders PDFs safely via PDF.js (canvas pixels, no PDF-side JS executes). The Print button, however, hands the raw PDF to the browser's native PDF renderer; that's the only way to get a browser's print dialog. Don't rely on Print for security-sensitive documents.
Yes. PDF Embed ships PDF.js 6.4.299, well past the 4.2.67 patch.
download="no", can visitors still save the PDF?Yes, technically. The Download button is removed from the toolbar, but the PDF bytes are loaded into the browser by PDF.js to render the document, so a visitor with browser developer tools can still extract them. Use download="no" to remove the button as a UX choice (e.g. on pages where you don't want to encourage downloads), not as a security boundary. The same applies to navigation="no" and zoom="no": they remove buttons; they don't prevent a determined visitor from re-enabling those interactions in their browser. To actually keep a PDF private, restrict the post that embeds it (private/draft, role-restricted, members-only plugin).
PDFDocumentProxy.destroy(), so the viewer now tears down through the loading task instead. Bonus: a viewer removed while its PDF is still loading now shuts its worker down properly too.
PDF.js 6 raised its minimum supported browsers; very old browsers that are no longer supported upstream may not render PDFs.
1.0.5
Welcome to the WordPress.org plugin directory!
Tested with WordPress 7.0 — no code changes needed, the viewer and all integrations continue to work cleanly.
*Plugin directory listing assets prepared: banners, icons, and 5 screenshots covering the frontend viewer, Appearance/Sizing settings, the Gutenberg block, and the Enfold ALB element (Elementor and WPBakery work the same way).
1.0.4
Got feedback from reviews, and time to fix them!
Readme link issues resolved.
Readme adjustments to highlight changes across the board.
Remote file calling is a nono, so I added them to the plugin itself. Removed the capability of externally calling CDN js files entirely now.
Integrating seamlessly into AVIA / Enfold is not gonna be doable as it would require hijacking the namespace which is a nono. So I made our own, the downside is: non english enfold will have our own little category - for now.
Every variable was sanitized, but there were a few phpcs ignore annotations that should not have been left there. All integrations, markup, icons, run through a WP escape function.
Plugin check came back with an extra issue: unprefixed globals. Elementor widget class (and its file) renamed to Spdfembed_Elementor_Widget so Plugin Check stops yelling at me (And this time I am not just commenting the issue out :D).
Missed Phosphor icons attribution.
Revised UX
The light and dark mode selector and configuratior was a bit messy. Improved for clarity and functionality YAY For UX!
Settings page now caps at 1440px instead of stretching the full window; previews live next to their own colour pickers (Light next to Light, Dark next to Dark), no more "Preview as" toggle.
1.0.3
*Welp, I am old. Last time, I checked we always used the CDN versions of included libraries. I was wrong. Swapped the default options. Thank you WP Plugin guidelines reading for the 5th time.
1.0.2
*Readme missed links to the PDF js and WP Color picker projects. Duhhh...
1.0.1