Module builder

Module builder 

Source
Expand description

Epub Builder

This module provides functionality for creating and building EPUB eBook files. The EpubBuilder structure implements the build logic of the EPUB 3.0 specification, allowing users to create standard-compliant EPUB files from scratch.

§Usage

use lib_epub::{
    builder::{EpubBuilder, EpubVersion3},
    types::{MetadataItem, ManifestItem, SpineItem},
};

let mut builder = EpubBuilder::<EpubVersion3>::new()?;
builder
    .add_rootfile("OEBPS/content.opf")
    .add_metadata(MetadataItem::new("title", "Test Book"))
    .add_manifest(
        "path/to/content",
        ManifestItem::new("content_id", "target/path")?,
    )?
    .add_spine(SpineItem::new("content.xhtml"));

builder.build("output.epub")?;

§Notes

  • Requires builder functionality to use this module.
  • Files will be manipulated in a temporary directory during the build process; automatic cleanup will occur upon completion
  • All resource files must exist on the local file system.

Structs§

EpubBuilder
EPUB Builder
EpubVersion3