epub

package
v1.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookData

type BookData struct {
	BookID       string     // 书籍唯一标识
	Title        string     // 书名
	Author       string     // 作者
	Language     string     // 语言
	ModifiedTime string     // 修改时间
	Pages        []PageData // 所有页面
}

BookData EPUB 书籍数据

func CreateBookData

func CreateBookData(bookID, title, author string, imageFiles []ImageFile) BookData

CreateBookData 从书籍信息创建 BookData

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator EPUB 生成器

func NewGenerator

func NewGenerator() (*Generator, error)

NewGenerator 创建新的 EPUB 生成器

func (*Generator) Generate

func (g *Generator) Generate(w io.Writer, bookData BookData, images []ImageFile) error

Generate 生成 EPUB 文件,写入到 writer

type ImageFile

type ImageFile struct {
	Name string // 文件名
	Data []byte // 文件数据
	Path string // 原始文件路径(用于从磁盘读取)
}

ImageFile 图片文件信息

type PageData

type PageData struct {
	Index     int    // 页码
	FileName  string // 文件名
	MediaType string // MIME 类型
	Width     int    // 图片宽度(用于 viewport)
	Height    int    // 图片高度(用于 viewport)
}

PageData 单个页面的数据

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL