The Document Library Pro plugin lets you allow users to preview files before they download them - or even instead of downloading them. It does this by displaying a preview button or icon in the
If enabled, the preview option appears next to the link to download/access the document. If you have disabled links to the document then the preview option will appear on its own. When a user clicks on the preview button/icon, the document will option in a popup lightbox.
Document preview options
Choose whether or not to enable the preview option. Previews are disabled by default.
You can either configure this option globally on the plugin settings page, or directly in the shortcode as follows:
Choose a style for the preview buttons:
- Button with text - A button containing the preview text.
- Button with icon and text - A button containing the preview text and a magnifying glass icon.
- Button with icon (the default) - A button containing a magnifying glass icon only.
- Icon only - A magnifying glass only, not within a button.
- Text link - A text link only.
You can either configure the preview style globally on the plugin settings page, or directly in the shortcode as follows:
If you have selected a button or text preview style, then you can choose which text is displayed. The default is 'Preview'.
You can either configure the preview style globally on the plugin settings page, or directly in the shortcode.
[doc_library preview_text="Preview Document Online"]
Which file types are supported?
The preview option is only available for the following file types:
- Images (jpeg, gif, png, webp, svg)
- Videos (mp4, ogg*)
- Audio (mp3, mp4, mpeg, ogg*, aac*, aacp*, flac*)
For unsupported file types, no preview option will appear in the list of documents.
All compatible file types must be linked to documents via the WordPress Media Library and not the Custom URL option.
* These may require a browser plugin in certain browsers.
Other ways to preview documents
As well as the preview buttons described above, there are several other ways that you can allow users to preview documents on the page instead of downloading them.
Each document has an individual page, which users can access by clicking on a link to the document (e.g. on the document title). If you set the link destination option to 'Open single document page' then users can be forced to access the single document page before downloading the document.
The single document page is an excellent place to add an on-page preview of the document. The best way to do this depends on the file type, so here are some suggestions for different file types:
- PDF's and other document types - you can upload the file to Google Drive and embed it using a plugin like Google Drive Embedder. Alternatively, you can use a tool like Flipsnack to embed the document as an interactive page turning flip book.
- Audio and video - you can embed audio and video players directly into the single document page.
- Images - use the 'Add Media' button to insert the image into the single document page.
All of these document previews will appear in the main content area of the single document page. The document download link will appear on the right hand side of the page, so users can preview the document before downloading it.