2

I need to programmatically identify the layout of an ePub file. The ePub file can be either in Fixed Layout or Reflowable Layout.

I tried to use Microsoft.WindowsAPICodePack with Microsoft.WindowsAPICodePack.Shell to pull the metadata of an ePub file.

However, I am not able to identify a property can tell me what the layout is.

Is there any hidden property in the metadata that should focus on?

-Alan-

Alan B
  • 2,219
  • 4
  • 32
  • 62

1 Answers1

3

You need to look for the <meta property="rendition:layout"> element in the <metadata> section of the OPF file:

  1. <meta property="rendition:layout">reflowable</meta> indicates a reflowable EPUB
  2. <meta property="rendition:layout">pre-paginated</meta> indicates a fixed layout EPUB

Specification: http://www.idpf.org/epub/301/spec/epub-publications.html#meta-properties-rendering

Note: EPUB 3 allows hybrid EPUBs (i.e., mixing reflowable and pre-paginated spine items), so the property might be attached to spine elements. See the rendition:layout* properties: http://www.idpf.org/epub/301/spec/epub-publications.html#sec-itemref-property-values

Alberto Pettarin
  • 894
  • 6
  • 12
  • Unfortunately most of our OPF file dont have the – Alan B Aug 22 '15 at 03:54
  • Per http://www.idpf.org/epub/301/spec/epub-publications.html#fxl-property-layout-usage , you should then assume that the EPUB is reflowable: "The default value reflowable must be assumed by EPUB Reading Systems as the global value if no meta element carrying this property occurs in the metadata section." – Alberto Pettarin Aug 23 '15 at 08:41
  • If you want an extra heuristic, since FXL requires you to specify a viewport meta element in the header of XHTML files, you can look for it. If you do not find it, the EPUB is reflowable, otherwise FXL. (See: http://www.idpf.org/epub/301/spec/epub-publications.html#fxl-property-layout-values ) – Alberto Pettarin Aug 23 '15 at 08:43