printer

package
v0.0.0-...-5a98790 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2021 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package printer helps converting a specific file type to PDF.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChromePrinterOptions

type ChromePrinterOptions struct {
	WaitTimeout       float64
	WaitDelay         float64
	HeaderHTML        string
	FooterHTML        string
	PaperWidth        float64
	PaperHeight       float64
	MarginTop         float64
	MarginBottom      float64
	MarginLeft        float64
	MarginRight       float64
	Landscape         bool
	PageRanges        string
	RpccBufferSize    int64
	CustomHTTPHeaders map[string]string
	Scale             float64
}

ChromePrinterOptions helps customizing the Google Chrome Printer behaviour.

func DefaultChromePrinterOptions

func DefaultChromePrinterOptions(config conf.Config) ChromePrinterOptions

DefaultChromePrinterOptions returns the default Google Chrome Printer options.

type MergePrinterOptions

type MergePrinterOptions struct {
	WaitTimeout float64
}

MergePrinterOptions helps customizing the merge Printer behaviour.

func DefaultMergePrinterOptions

func DefaultMergePrinterOptions(config conf.Config) MergePrinterOptions

DefaultMergePrinterOptions returns the default merge Printer options.

type OfficePrinterOptions

type OfficePrinterOptions struct {
	WaitTimeout float64
	Landscape   bool
	PageRanges  string
}

OfficePrinterOptions helps customizing the Office Printer behaviour.

func DefaultOfficePrinterOptions

func DefaultOfficePrinterOptions(config conf.Config) OfficePrinterOptions

DefaultOfficePrinterOptions returns the default Office Printer options.

type Printer

type Printer interface {
	Print(destination string) error
}

Printer is a type that can create a PDF file from a source. The source is defined in the underlying implementation.

func NewHTMLPrinter

func NewHTMLPrinter(logger xlog.Logger, fpath string, opts ChromePrinterOptions) Printer

NewHTMLPrinter returns a Printer which is able to convert an HTML file to PDF.

func NewMarkdownPrinter

func NewMarkdownPrinter(logger xlog.Logger, fpath string, opts ChromePrinterOptions) (Printer, error)

NewMarkdownPrinter returns a Printer which is able to convert Markdown files to PDF.

func NewMergePrinter

func NewMergePrinter(logger xlog.Logger, fpaths []string, opts MergePrinterOptions) Printer

NewMergePrinter returns a Printer which is able to merge PDFs.

func NewOfficePrinter

func NewOfficePrinter(logger xlog.Logger, fpaths []string, opts OfficePrinterOptions) Printer

NewOfficePrinter returns a Printer which is able to convert Office documents to PDF.

func NewURLPrinter

func NewURLPrinter(logger xlog.Logger, url string, opts ChromePrinterOptions) Printer

NewURLPrinter returns a Printer which is able to convert a URL to PDF.

Jump to

Keyboard shortcuts

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