Setup guide · 2 minutes

Setting up Demfilz Flipbook

Add a flipbook from a PDF, build its pages and show it on any page. This guide covers how pages are built, the block and shortcode options, the preview, developer hooks and what to check when something does not look right.

1. Install and activate

Upload demfilz-flipbook.zip under Plugins → Add New Plugin → Upload Plugin and activate it (WordPress 6.3 or later, PHP 7.4 or later). A Flipbooks menu appears in the dashboard. Flipbooks can be added and edited by Editors and Administrators.

2. Add a flipbook and choose the PDF

Go to Flipbooks → Add New Flipbook and enter a title. In the PDF and pages box:

OptionWhat it does
Source PDFChoose PDF opens the media library, filtered to PDFs; upload a new one or pick an existing one.
Or a PDF addressThe address of a PDF in this site's uploads folder, used when no PDF is chosen above. Addresses outside the uploads folder, or files that are not PDFs, are refused.
Download buttonShows a button that downloads the PDF. Untick it to keep the PDF out of the viewer.

3. Build the pages

Click Build pages. Each PDF page becomes a JPEG about 1,000 pixels wide (capped at 1,600) plus a small thumbnail, stored in wp-content/uploads/dflb/<flipbook id>/. The line under the button says which method your site uses:

MethodHow it works
GhostscriptRendered on the server a few pages per request, so large PDFs do not time out. Needs the exec() function and the gs program.
ImagickRendered on the server with the Imagick PHP extension, one page at a time. Some hosts block PDFs in the ImageMagick security policy; the build then switches to the browser.
BrowserNo server renderer: PDF.js renders each page in your browser and uploads it as a JPEG. Keep the tab open until the status says Done; the tab may be in the background.

A rebuild writes into a separate folder and replaces the live pages only when every page is in place. The default limit is 500 pages per flipbook.

4. Show it on a page

In the block editor, add the Flipbook block and choose the flipbook; the editor shows its cover and page count, and the viewer appears on the published page. The block can be wide or full width. Anywhere shortcodes work, paste the shortcode from the Show this flipbook box:

Shortcode attributeWhat it does
idThe flipbook id (required), for example [dflb id="123"].
heightA minimum height for the viewer, for example height="80vh" or height="700px". Numbers, px, em, rem and vh are accepted.
downloaddownload="no" hides the download button, download="yes" shows it even when the flipbook setting is off.

The block has the same settings in its sidebar. A flipbook that is still a draft, or has no pages yet, shows nothing to visitors; editors see a short notice instead.

5. Preview and list

Once built, Preview flipbook opens the flipbook on a page of its own, visible only to people who can edit it. The Flipbooks list shows each cover, page count and shortcode, with a Preview link on hover.

6. For developers

Hook or commandWhat it does
dflb_server_rendererReturn an empty string to always render in the browser, or force ghostscript / imagick.
dflb_gs_candidatesThe Ghostscript programs tried, in order, for example an absolute path such as /usr/local/bin/gs.
dflb_max_pagesThe page limit per flipbook (default 500).
dflb_pages_per_requestPages rendered per server request (default 4).
wp dflb create --title="Catalogue" --pdf=123 --buildWP-CLI: create a flipbook from an attachment id or an uploads address, and build it. Also wp dflb build <id> and wp dflb build-all [--force] (servers with Ghostscript or Imagick).

Troubleshooting

"Your browser could not open the PDF": the PDF is served from another domain (a CDN or offloaded media) that does not allow it to be read from your dashboard. Use the copy in your uploads folder, or allow your site's domain in the CDN's CORS settings.

"Page 3 could not be saved": the server refused the upload. Check the upload size limit (PHP upload_max_filesize and post_max_size) and any security plugin that blocks uploads to admin-ajax.php.

The flipbook shows the old PDF: click Rebuild pages after replacing the PDF.

The viewer shows one page on a wide screen: the content column is narrower than two pages. Use the block's wide or full width alignment.

Deleting and uninstalling: permanently deleting a flipbook deletes its page images. Uninstalling the plugin deletes all flipbooks and their images, but never the PDFs in your media library.

Stuck, or want it customised?

We build and customise WordPress plugins for a living. If your catalogue needs product hotspots, lead capture or a searchable library, tell us what and we'll quote it.