Are you looking to use PDF Embedder with a shortcode? The PDF Embedder shortcode lets you embed PDFs and even override defaults for any individual embed by adding attributes directly to the shortcode.
This guide covers available shortcode attributes for our PDF Embedder plugin, including sizing, toolbar behavior, navigation, watermarks, and more.
Shortcode
Inserting a PDF is as easy as uploading an image into a WordPress page.
You can use the PDF Embedder shortcode without any attributes to embed your PDFs. This will use the global options set in the PDF Embedder settings.
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf"]Code language: JSON / JSON with Comments (json)
If any attributes are added to this shortcode, they override the corresponding global setting for that embed only.
Size and shape
Using the width or height attributes with their values in pixels, you can set a custom size for your embed.
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>width="500"</strong>]Code language: JSON / JSON with Comments (json)
The default for both width and height is max, which fills the parent container. Setting a fixed height may cut off the document vertically. The viewer shrinks to fit if the parent container is narrower than the specified width.
Toolbar
Define the placement of the toolbar on the viewer using the toolbar attributes. The values can be "top", "bottom", "both", or "none".
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>toolbar="top"</strong>]Code language: JSON / JSON with Comments (json)
You can also modify the toolbar visibility using the toolbarfixed attribute. For example, use toolbarfixed="on" to keep the toolbar open at all times rather than only when the user hovers over the document.
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>toolbarfixed="on"</strong>]Code language: JSON / JSON with Comments (json)
PDF title
The title attribute sets the link text displayed before the interactive viewer loads (useful for search engine crawlers and visitors with JavaScript disabled):
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>title="Plan Summary"</strong>]
Code language: JSON / JSON with Comments (json)
Scrollbars
To enable or disable the scroll bars, use the scrollbar attribute. The options for this are "vertical", "horizontal", "both", or "none"
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>scrollbar="vertical"</strong>]
Code language: JSON / JSON with Comments (json)
Continuous scrolling
Add continousscroll="on" to the shortcode to enable mouse/touch scrolling between pages. Or you can set the value to “off” to disable this.
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>continousscroll="on"</strong>]
Code language: JSON / JSON with Comments (json)
When disabled, viewers are limited to navigating the pages only using the toolbar “Prev” (arrow up) and “Next” (arrow down) buttons.
Download button
This allows you to enable or disable the download button. The options include download="on" or "off".
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>download="on"</strong>]Code language: JSON / JSON with Comments (json)
Mobile friendly
By default, if the embed area is narrower than 500 pixels, the document will appear as a thumbnail with a large ‘View in Full Screen’ button. This is designed especially for mobile devices, where it can be difficult to interact with a small area, but the same 500-pixel logic applies to any web browser.
You can change the cut-off width (or eliminate it entirely) by adding a mobilewidth parameter: e.g. mobilewidth="200", or "0" to always display the interactive document at any screen size. A ‘Full Screen’ button is always available on the toolbar, regardless.
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>mobilewidth="200"</strong>]Code language: JSON / JSON with Comments (json)
Starting page
You can optionally start on any page number in the PDF. For example, to open up on page 5:
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>page="5"</strong>]Code language: JSON / JSON with Comments (json)
Page number text box
You can ensure the ‘page number’ text box is always visible for the user to enter a page number to jump to by using pagetextbox="on". If omitted or "off", the user needs to click on the page number displayed in order for it to change into a text box.
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>pagetextbox="on"</strong>]Code language: JSON / JSON with Comments (json)
Zoom level
Optionally specify the percentage zoom to start off the display. For example, for 50% zoom
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>zoom="50"</strong>]Code language: JSON / JSON with Comments (json)
To set a different zoom level for the full-screen view, add fpzoom:
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>zoom="50" fpzoom="75"</strong>]Code language: JSON / JSON with Comments (json)
You can also use other non-percentage values, for example:
zoom="page-width"zoom="auto"zoom="page-actual"zoom="page-fit"
External links
Links to external websites will open up in a new window if the option is checked in the PDF Embedder settings. You can override this behavior for an individual embed by adding the newwindow="on|off" parameter to the shortcode
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>newwindow="off"</strong>]Code language: JSON / JSON with Comments (json)
Scroll to top
We also have the scrolltotop attribute that when set to "on" scrolls the browser window to the top of the embed area when the user changes pages.
[pdf-embedder url="https://example.com/wp-content/uploads/2015/01/Plan-Summary.pdf" <strong>scrolltotop="on"</strong>]Code language: JSON / JSON with Comments (json)
Watermark attributes
We have watermark attributes to use with the shortcode, which you can use to set or override watermark behavior for a specific embed.
wm_halign— horizontal alignment:"left","center", or"right"wm_hoffset— horizontal offset percentage (0–100)wm_voffset— vertical offset percentage (0–100)wm_fontsize— font size in pointswm_fontcolor— color in hex format (e.g."#444444")wm_opacity— opacity percentage (0–100)wm_rotate— rotation in degreeswm_evenpages—trueto display the watermark on even pages only
Frequently asked questions
Below are some common questions about shortcode attributes.
Do shortcode attributes work with the free version?
Only a subset of attributes work with the Free version: url, width, height, toolbar, and toolbarfixed. All other attributes require our PDF Embedder Premium plugin.
Can I use these attributes in the Block Editor?
When using the PDF Embedder block, the most common attributes are accessible through the block sidebar when using the Premium version. To use these attributes, switch to a Shortcode block and enter the PDF Embedder shortcode with attributes manually.