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

htmlbridge

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Overview

Package htmlbridge 将预处理为 HTML 的输入接入现有浏览器转换链,统一复用 纸张、临时目录、资源访问、取消处理以及 PDF 导入设置。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadInput

func ReadInput(ctx context.Context, input any, limit int64) ([]byte, error)

ReadInput 有界读取路径、字节或 Reader 输入,调用方传入格式专用的原始字节上限。

Types

type Document

type Document struct {
	HTML        []byte
	Attachments []creator.Attachment
}

Document 是预处理后的页面内容和需原样保留的上游附件。

type Importer

type Importer struct {
	Format, MIMEType string
	Prepare          func(input any, conv *converter.Converter) (Document, error)
}

Importer 对输入执行 Prepare,复用 HTML→PDF,然后在 OFD 写出时携带附件。

func (*Importer) Extensions

func (i *Importer) Extensions() []string

func (*Importer) Import

func (i *Importer) Import(input any, output io.Writer, conv *converter.Converter) error

func (*Importer) MIME

func (i *Importer) MIME() string

func (*Importer) Name

func (i *Importer) Name() string

type PDFTransformer

type PDFTransformer struct{ Importer *Importer }

PDFTransformer 直接输出浏览器 PDF,避免为 PDF 目标执行 OFD 往返转换。

func (PDFTransformer) From

func (t PDFTransformer) From() []string

func (PDFTransformer) To

func (t PDFTransformer) To() string

func (PDFTransformer) Transform

func (t PDFTransformer) Transform(input any, output io.Writer, conv *converter.Converter) error

Jump to

Keyboard shortcuts

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