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

xps

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: 13 Imported by: 0

Documentation

Overview

Package xps 通过 xpstopdf 命令把 XPS 文档转换为 PDF。

Index

Constants

View Source
const (
	// EnvXpstopdf 是覆盖 xpstopdf 可执行文件路径的环境变量名。
	EnvXpstopdf = "OFD_XPSTOPDF"
	// DefaultTimeout 是单次 XPS 转换的默认超时时间。
	DefaultTimeout = 2 * time.Minute
)

Variables

This section is empty.

Functions

func ConvertToPDF

func ConvertToPDF(ctx context.Context, inputPath string, options Options) (data []byte, err error)

ConvertToPDF 把 XPS 文件转换为 PDF 并返回 PDF 字节。输入必须是可读的本地文件。

func FindXpstopdf

func FindXpstopdf(explicit string) (string, error)

FindXpstopdf 定位 xpstopdf。查找顺序为显式路径、OFD_XPSTOPDF 和 PATH。

Types

type Options

type Options struct {
	// Xpstopdf 是 xpstopdf 可执行文件路径;为空时自动查找。
	Xpstopdf string
	// Timeout 是转换超时时间;为 0 时使用 DefaultTimeout。
	Timeout time.Duration
	// TempDir 是临时文件根目录;为空时使用系统临时目录。
	TempDir string
}

Options 控制 XPS 转换行为。

Jump to

Keyboard shortcuts

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