pdf2ofd

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Package pdf2ofd 提供纯 Go 的 PDF 到 OFD 转换实现:解析 PDF 页面几何、文字、 路径和图像 XObject,并使用 pkg/creator 输出 OFD 包,不依赖原生 PDF 渲染器。

Index

Constants

This section is empty.

Variables

View Source
var ErrEncrypted = errors.New("文档已加密")

ErrEncrypted 表示输入 PDF 已加密但没有可用口令。

View Source
var ErrWrongPassword = errors.New("口令不正确")

ErrWrongPassword 表示提供的口令无法打开 PDF。

与 ErrEncrypted 分开是因为处置不同:前者调用方补个口令就能继续,后者 是口令给错了,重试同一份不会变。

Functions

func Convert

func Convert(gctx context.Context, input any, output io.Writer, password string) error

Convert 把 PDF 输入(文件路径、[]byte、io.Reader 或 io.ReadSeeker)转换为 OFD 包。转换保留基本页面几何、文字、路径和 JPEG/PNG 图像 XObject, 不使用原生 PDF 渲染器。

func ConvertFile

func ConvertFile(gctx context.Context, pdfPath, ofdPath string, password string) error

ConvertFile 是 Convert 的按路径便捷形式。

Types

This section is empty.

Jump to

Keyboard shortcuts

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