Book for Craft CMS

Free · no editions, no licensing code

A PDF should not be a link

“Download our brochure (PDF, 4.2 MB)” is not an embed — it is an invitation to leave the page and find out whether the document was worth opening. And a .docx is worse: no browser renders one at all, a private asset has no URL to hand a viewer, and a CSV needs no viewer in the first place, just a server willing to read it. Book is those four problems, solved together.

Book

Two commands, then one tag

Install it and add a document. From there it is one Twig call, or a reference tag an author can write inside CKEditor — and the tag renders because Craft parses reference tags, not because an editor plugin is installed.

composer require justinholtweb/craft-book
php craft plugin/install book

{# One call takes an asset, a URL, a handle, a document or a field value #}
{{ craft.book.embed(entry.brochure) }}
{{ craft.book.embed('annual-report', { viewer: 'google', height: 900 }) }}

{# And in any rich-text field, with no template change at all: #}
{book:annual-report:render}
{book:annual-report:render(click,wide,no-download)}

{# What would happen, asked before you publish: #}
{% set verdict = craft.book.resolve(entry.spec) %}
{% for warning in verdict.warnings %}<p>{{ warning }}</p>{% endfor %}

Features

Everything Embed Any Document does for WordPress, done as a Craft element — plus the two things it cannot do.

Five viewers, and a verdict

Native, Microsoft, Google, Book's own inline renderer, and a download card. Auto is not a sixth viewer — it is the answer to what will actually work on this site, this format, these settings.

  • Each format carries its own ordered preference
  • Ruled-out viewers come with the reason they were ruled out

It never phones anybody

Book makes no outbound HTTP request. Anywhere. Google's and Microsoft's viewers are iframe URLs the reader's browser loads; inline rendering reads bytes through your volume's own filesystem.

  • No SSRF surface, no host allowlist, no proxy settings
  • Turn both third-party viewers off and no URL ever leaves

Private assets stay private

An asset in a volume with no public URLs is served on Book's own route, with an HMAC-signed token Book minted. The token carries the access rule — read out of the token, never out of a query parameter.

  • No volume has to be made public for one brochure
  • access: login sends a guest to the login screen

Some files need no viewer

CSV becomes a table, Markdown becomes purified prose, JSON is pretty-printed, and text, logs and code become an escaped scrollable block. Rendered by Craft, with nobody else involved.

  • Delimiter sniffed, quoted commas kept, Windows-1252 repaired
  • Row limits are honoured and admitted to, not hidden

A reference tag, not a shortcode

A document has a handle, and {book:handle:render} renders in CKEditor, in Redactor and in any HTML field — because Craft parses reference tags, not because an editor plugin is installed.

  • Switch every editor integration off and nothing stops rendering
  • Paste a file link on its own line and it joins the library

Consent that actually defers

Click-to-load parks the frame in a template element, which is the only markup that genuinely defers the request. A hidden iframe still loads — which is the mistake most consent banners make.

  • Ask before a third party downloads your file, and mean it
  • A load timeout shows the file itself instead of a blank box

Frequently Asked Questions

The questions worth answering before you install it.

Put the document on the page

Free, for Craft CMS 5.3 and later. Install it, add a document, and embed it in Twig or in rich text — with private assets that stay private and no outbound request anywhere in the plugin.