How It Works
[pdf_viewer] shortcodeServer-Side Preview Generation
When a PDF is uploaded to the Media Library:
Preview generation runs automatically on upload. For existing PDFs, use Settings → PDF Viewer → Tools → Process Unprocessed PDFs.
Zero Layout Shift (CLS)
The viewer container uses CSS aspect-ratio calculated from the PDF's actual page dimensions. The browser reserves the exact space before any content renders, with no reflow and no jump.
This is measured at the page level: your Lighthouse CLS score is unaffected by PDF embeds.
Three Load Behaviors
Click (Default)
Preview image shown with "View Document" activation button. Full viewer loads only when clicked. Best for:
Visible (IntersectionObserver)
Full viewer loads automatically when the embed scrolls into the viewport. Best for:
Immediate
Full viewer loads on page load. Best for:
Gutenberg Block
The native block provides:
Block name: maxtdesign/pdf-viewer
Shortcode
[pdf_viewer id="123" width="100%" load="click" toolbar="true"]
Works in classic editor, text widgets, and any page builder that processes shortcodes.
Toolbar
The interactive viewer toolbar includes:
Each button can be toggled globally in settings or per-embed in block/shortcode attributes.
Accessibility
Bulk Processing
Go to Settings → PDF Viewer → Tools to:
REST API
The plugin registers endpoints under /wp-json/mdpv/v1/:
GET /pdf/{id}: Get PDF info (page count, dimensions, preview URL)POST /pdf/{id}/process: Trigger preview generation for a specific PDFBoth endpoints require upload_files capability.