pdf

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(ctx, "pdf", "ofd", ...),或直接调用本包的 Convert/ConvertFile。

Index

Constants

This section is empty.

Variables

Functions

func Convert

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

Convert 将 PDF 输入转换为 OFD 文档,input 支持 PDF 文件路径、[]byte 或 io.Reader。 失败时 output 可能含部分输出,调用方必须丢弃;取消原样返回 ctx.Err()。

func ConvertFile

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

ConvertFile 在转换成功后原子替换输出文件;失败或取消保留原有文件。

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 struct {
	// PDFImportOptions 复用预算、字体、图片、诊断回调和严格模式配置。
	converter.PDFImportOptions

	// Password 用于打开加密 PDF;空值表示不提供口令。
	Password string
}

Options 控制直接 PDF 导入的口令及转换策略;零值使用默认预算并保存原始字体。 通用 converter.Convert 入口仍通过 WithPassword 和 WithPDFImportOptions 配置。

Jump to

Keyboard shortcuts

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