EpubDisplay

epubDisplay macro

  • inline
    • no
  • content
    • none
  • parameters
    •  filename — the name of the attached EPUB file to show
      • mandatory
    •  document — the page the EPUB is attached to
      • default: the current page
    •  width — CSS width of the reader
      • default: 100% 
    •  height — CSS height of the reader
      • default: 75vh , three quarters of the window, so it grows with it

No browser displays an EPUB by itself, so the reading is done in the page by epub.js, attached here rather than loaded from a content delivery network. A restricted EPUB stays restricted: the file is fetched with the reader's own rights, exactly as a direct download would be.

Examples

The examples read demo.epub, a two-page book attached to this page for the purpose.

{{epubDisplay filename="demo.epub" height="300px"/}}


{{epubDisplay document="Macros.Presentation.EpubDisplay" filename="demo.epub" width="60%" height="300px"/}}


Counterexamples

{{epubDisplay filename="nosuch.epub"/}}


Errorno such attachment: nosuch.epub

{{epubDisplay document="Publication.NoSuchPage" filename="demo.epub"/}}


Errorno such attachment: demo.epub

Libraries attached here

fileversionlicencesource
epub.min.js0.3.93BSD-2-Clauseepubjs
jszip.min.js3.10.2MIT / GPL-3.0-or-laterjszip

That table is the record of what this page carries, and has to be kept in step with the attachments. /bin/apc/apice-epub-check.zsh reads it, asks the npm registry for the current releases and reports: it changes nothing. Updating is deliberate — attach the new file under the same name, so the previous one stays in the attachment history, check a publication with an EPUB still reads, then bring the table in step.