Kobo Post Processor: Complete Guide to Customizing Your eBook OutputA Kobo post processor is a script or set of instructions that runs after your eBook file (typically EPUB) is generated by your publishing toolchain. Its purpose is to fine-tune the EPUB so it meets Kobo’s rendering quirks, improves reader experience on Kobo devices and apps, and resolves issues that automated converters may not handle perfectly. This guide covers what a Kobo post processor does, when you need one, common adjustments, example scripts and workflows, testing, and best practices.
Why use a Kobo post processor?
- Fix Kobo-specific rendering issues: Kobo firmware and apps have small differences from other readers (Kindle, Apple Books) in how they handle CSS, navigation, fonts, and images. A post processor can apply targeted fixes.
- Enforce consistent output: Automated converters (Calibre, Pandoc, Sigil, or ebook-producing pipelines like Jutoh or Pandoc-with-templates) may leave artifacts or inconsistent markup. The post processor cleans and standardizes the EPUB.
- Automate repetitive fixes: Once you identify manual fixes you do repeatedly (renaming files, adjusting metadata, reflowable vs fixed layout tweaks), a post processor applies them automatically.
- Add or adjust Kobo-specific metadata: Kobo supports some metadata and features (such as specific display options) that can be embedded in the EPUB or in vendor-specific fields before upload.
When you need a post processor
- You publish regularly to Kobo and notice recurring formatting issues.
- Your source format is complex (large image-heavy books, many footnotes, custom CSS).
- You use an automated pipeline and want consistent Kobo-targeted output without changing the original build for other platforms.
- You’re distributing directly to Kobo via EPUB uploads and want to optimize the EPUB without relying on Kobo’s conversion.
Common Kobo-specific issues and fixes
Below are frequent problems encountered on Kobo devices and how a post processor can address them.
- CSS quirks
- Some Kobo firmware versions ignore certain CSS properties or apply default styles unpredictably. A post processor can inject a Kobo-specific CSS file or override problematic rules (e.g., font-size, hyphenation, page-break-avoidance).
- Fix: append a small CSS like:
html[Kobo] body { -webkit-text-size-adjust: 100%; } .no-break { break-inside: avoid; page-break-inside: avoid; }
- Navigation (TOC) issues
- Ensure the EPUB’s nav.xhtml is correctly structured and that the NCX (for older devices) matches. A post processor can rebuild or validate nav files.
- Cover and artwork problems
- Kobo sometimes prefers a specific cover image size or placement. The post processor can replace or resize the cover file and update the manifest.
- Font embedding and font-face rules
- Embed fonts correctly and add font-face declarations compatible with Kobo. Remove unsupported formats, fix paths in CSS.
- SVG handling
- Convert or rasterize SVGs that render poorly on some Kobo readers, or add fallback PNGs.
- Image sizing and density
- Ensure images use max-width: 100% and include high-DPI versions if targeting Kobo Aura/Eden devices with higher pixel density.
- Metadata adjustments
- Edit the EPUB OPF to set language, identifiers, publication date, and custom meta tags Kobo recognizes.
- Remove extraneous files
- Strip editor-specific files left by conversion tools (like .DS_Store, __MACOSX) to reduce EPUB size and avoid quirks.
Typical post processor tasks (checklist)
- Validate EPUB structure and fix broken references.
- Normalize manifest and spine order.
- Rebuild nav.xhtml and NCX if missing or malformed.
- Inject or override Kobo-targeted CSS.
- Resize or replace cover image; update manifest.
- Embed fonts and correct CSS font-face paths.
- Convert problematic SVGs to PNGs and update references.
- Optimize and compress images (lossless or controlled lossy).
- Remove unnecessary files and ZIP comments.
- Update OPF metadata (title, author, language, identifiers, dates).
- Re-sign or rezip EPUB with proper mimetype at the start (uncompressed) if needed.
Example workflows
- Simple shell-based post processing (Linux / macOS)
- Unzip EPUB to a temp folder.
- Run image optimization (ImageMagick or pngquant).
- Inject Kobo CSS and update manifest.
- Rebuild nav.xhtml using a small Python or XSLT script.
- Rezip with correct mimetype placement and validate.
- Python-based script (more control)
- Use zipfile and lxml to parse and modify OPF/nav files.
- Use Pillow to open/convert images and fonts handling libraries to check embedding.
- Run epubcheck (via subprocess) and report issues.
- Integrated into build tools (Pandoc/Make)
- Add a Makefile target “kobo-post” that runs after pandoc to produce EPUB and then invokes your post processor script.
Example: minimal Python post-processor (concept)
Below is a conceptual outline (not full production code) showing steps a Python post-processor might perform.
# kobo_postproc.py (concept) import zipfile, os, shutil, tempfile from lxml import etree from PIL import Image def unzip_epub(epub_path, outdir): with zipfile.ZipFile(epub_path) as z: z.extractall(outdir) def inject_kobo_css(outdir): css_path = os.path.join(outdir, 'OEBPS', 'styles', 'kobo.css') with open(css_path, 'w') as f: f.write('body { -webkit-text-size-adjust: 100%; }') def resize_cover(outdir): cover = os.path.join(outdir, 'OEBPS', 'images', 'cover.jpg') img = Image.open(cover) img.thumbnail((1400,2100)) img.save(cover, quality=90) def rezip_epub(outdir, new_epub): # write uncompressed mimetype first, then the rest with zipfile.ZipFile(new_epub, 'w') as z: z.write(os.path.join(outdir, 'mimetype'), 'mimetype', compress_type=zipfile.ZIP_STORED) for root, _, files in os.walk(outdir): for f in files: path = os.path.join(root, f) arcname = os.path.relpath(path, outdir) if arcname == 'mimetype': continue z.write(path, arcname)
Testing & validation
- Use epubcheck to validate output: epubcheck reports missing files, broken references, and OPF/nav issues.
- Test on real devices and apps: Kobo Desktop, Kobo mobile app, and actual Kobo readers (Clara, Libra, Aura models) if available.
- Check edge cases: large images, complex nested lists, footnotes, drop caps, and custom fonts.
- Maintain versioned backups so you can compare before/after and roll back if needed.
Best practices
- Keep post-processor changes idempotent: running it multiple times should not corrupt the EPUB.
- Log changes and generate a changelog for each processed EPUB.
- Keep separate profiles if you publish to multiple retailers (Kobo, Apple, Google, direct) — don’t bake Kobo-only fixes into the generic EPUB if they might harm other platforms.
- Preserve accessibility: ensure nav, alt text for images, semantic headings, and language tags remain correct.
- Automate tests: include epubcheck and a small set of smoke tests (open EPUB, verify toc entries, presence of cover).
- Keep a small, well-documented set of CSS overrides rather than wholesale overwriting of styles.
Troubleshooting tips
- Nav not showing: ensure nav.xhtml uses the EPUB5 nav element and that the OPF manifest references it correctly. For older devices include a generated NCX.
- Fonts not used: verify font-face paths, supported formats (TTF/OTF usually OK), and ensure fonts are listed in the manifest with correct media-type.
- Images blurry: provide higher-resolution images and use responsive CSS (max-width: 100%) and consider media queries for high-DPI devices.
- Metadata ignored: some retailers override certain OPF metadata on upload — ensure your primary identifiers (ISBN, uuid) are correct and unique.
When not to use a post processor
- If your EPUB output is already perfect across devices and retailers.
- When retailer pipelines will reprocess your EPUB in ways that negate your changes (then fix source templates instead).
- If changes required are better handled upstream in the conversion templates (Pandoc/Calibre templates) to avoid repeated work.
Resources & next steps
- Build a small test suite of a few representative books (text-only, image-heavy, complex layout).
- Start with a minimal script: inject one CSS fix, resize cover, and validate with epubcheck.
- Iterate: add more fixes as you discover recurring Kobo-specific problems.
- Keep changes reversible and document them so teammates can understand what the post processor does.
Kobo post processors let you automate retailer-specific tweaks without changing your canonical source or build for other platforms. Start small, validate often, and prefer targeted fixes that preserve accessibility and compatibility.
Leave a Reply