We had a bunch of shortcodes included with older versions of PDF Viewer for WordPress. But we've streamlined the shortcodes and lowered the number of shortcodes to only 2 from version 10.
However, the previously generated shortcodes will still work, but there's no way to create those old shortcodes now.
Here are the new shortcodes that comes with PDF Viewer for WordPress version 10:
1. [pvfw-embed]
This shortcode allows you to embed already created PDF Viewers (Using PDF Viewer > Add New menu) on any post or page. It comes with a few parameters.
- viewer_id: This is the id of the viewer you want to embed.
- width: This is the width of the iframe that will be embedded on the page.
- height: This is the height of the iframe that will be embedded on the page.
- iframe_title: The title of the iframe.
- page: Page number to open on load.
- zoom: Default Zoom
- pagemode: Default pagemode.
an example of [pvfw-embed] shortcode:
[pvfw-embed viewer_id="6" width="100%" height="800" iframe_title="PDF Viewer" page="5" zoom="page-fit" pagemode="bookmarks"]
2. [pvfw-link]
[pvfw-link] shortcode allows you to insert a link to an already created PDF Viewer (Using PDF Viewer > Add New menu). It comes with a few parameters.
- viewer_id: This is the id of the viewer you want to link to.
- text: The anchor text that will be used as link.
- target: defines the target of the link. put _blank if you want to open the the link in new tab or use _parent if you want to open the link on the same tab.
- class: you can add a css class here to the link.
- page: Page number to open on load
- zoom: Default Zoom
- pagemode: Default pagemode.
an example of [pvfw-link] shortcode:
[pvfw-link viewer_id="6" text="Open PDF" target="_blank" class="pdf-viewer-link" page="5" zoom="page-fit" pagemode="bookmarks"]
3. [pvfw-image-link]
[pvfw-image-link] shortcode allows you to insert a link to an already created PDF Viewer (Using PDF Viewer > Add New menu) with an image. It comes with a few parameters.
- viewer_id: This is the id of the viewer you want to link to.
- img_url: The anchor text that will be used as link.
- target: defines the target of the link. put _blank if you want to open the the link in new tab or use _parent if you want to open the link on the same tab.
- class: you can add a css class here to the link.
- alt_text: ALT Text
- width: Image width
- height: Image Height.
- alignment: Image alignment (values: auto, left, center, right)
an example of [pvfw-image-link] shortcode:
[pvfw-image-link viewer_id="6" img_url="https://dev.local/wp-content/uploads/2023/01/image.png" target="_blank" class="pdf-viewer-link" alt_text="PDF Viewer" width="100%" height="200px" alignment="center"]