Help us shape the future of Go! Take the 2026 Go Developer Survey

pdf

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Overview

Package pdf 为 converter 注册 PDF→OFD 导入器(输入格式 "pdf")。

该包依赖 internal/pdf2ofd(进而依赖 pdfcpu)。单独成包是为了让只做 OFD→X 的使用方不必链接这些依赖;需要 PDF→OFD 时按空白导入启用:

import _ "github.com/zc310/ofd/pkg/converter/import/pdf"

之后即可使用 converter.Convert("pdf", "ofd", ...),或直接调用本包的 Convert/ConvertFile。

Index

Constants

This section is empty.

Variables

Functions

func Convert

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

Convert 将 PDF 输入转换为 OFD 文档,input 支持 PDF 文件路径、[]byte 或 io.Reader。

func ConvertFile

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

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

func ConvertFileWithOptions added in v0.1.5

func ConvertFileWithOptions(ctx context.Context, pdfPath, ofdPath string, password string, options Options) error

ConvertFileWithOptions 在转换成功后原子替换输出文件。

func ConvertWithOptions added in v0.1.5

func ConvertWithOptions(ctx context.Context, input any, output io.Writer, password string, options Options) error

ConvertWithOptions 使用指定的资源预算、诊断回调和严格模式转换 PDF。

Types

type Diagnostic added in v0.1.5

type Diagnostic = converter.PDFImportDiagnostic

type LimitError added in v0.1.5

type LimitError = converter.PDFImportLimitError

type Limits added in v0.1.5

type Limits = converter.PDFImportLimits

func DefaultLimits added in v0.1.5

func DefaultLimits() Limits

DefaultLimits 返回 PDF 导入的默认预算。

type Options added in v0.1.5

type Options = converter.PDFImportOptions

Options 控制资源预算、诊断回调和严格模式;零值使用默认预算。

Jump to

Keyboard shortcuts

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