If you’re producing ePub files, take the time to ask yourself two simple questions:
- Are all the files I listed in the OPF file actually in the ePub archive?
- Are all the files in the archive in the OPF file?
The OPF file is meant to be the canonical listing of all resources in your ePub. If it’s in the ZIP but not in the OPF, reading systems are required to ignore it. Likewise, including an entry in the OPF but not including the actual file (or putting it in the wrong folder) is also an error.
Bookworm used to reject ePubs which failed the first case, but I saw so many bad files (usually missing CSS or images) that it now simply ignores the error.
However, I sometimes also see case #2, where the OPF file is missing resources (again, frequently CSS and images). For example, these ePubs from Hindawi Publishing Company make admirable use of SVG, but none of their SVG files are in the OPF. Bookworm can’t find them and therefore can’t display them.
EpubCheck does flag both of these cases with the following errors:
- Case 1, where the file is declared in OPF but not in the archive: resource ‘XXXX.html’ is missing
- Case 2, where the file is in the archive but is missing from the OPF: referenced resource exists, but not declared in the OPF file
Other explanations for error messages from EpubCheck.