xps

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

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 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