Documentation ¶
Overview ¶
Package pdf provides a wrapper around different PDF generation tools to provide single conversion process regardless of implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
Attachment is used to embed files inside the PDF when supported by the implementation.
type Config ¶
type Config func(any)
Config defines options used to configure the PDF convertor.
func WithAuthToken ¶
WithAuthToken defines an authentication token to use to connect to the remote server if required by the PDF service.
type Convertor ¶
type Convertor interface { // HTML is the default implementation that takes a raw HTML file and converts it // into a PDF. HTML(ctx context.Context, data []byte, opts ...Option) ([]byte, error) }
Convertor defines the interface expected to be able to convert sources into PDF
type Option ¶
type Option func(*options)
Option defines a functional option to configure the PDF conversion
func WithAttachment ¶
func WithAttachment(a *Attachment) Option
WithAttachment adds the attachment to the conversion request.
func WithMetadata ¶
WithMetadata adds the provided metadata to include in the conversion request.
func WithStylesheets ¶ added in v0.6.0
WithStylesheets prepares the stylesheets to be included in the PDF generation request.
type Stylesheet ¶ added in v0.6.0
Stylesheet descriptions a document to upload with the HTML for styles.