document

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	A4     = &pdf.Rectangle{URx: 595.276, URy: 841.890}
	A4r    = &pdf.Rectangle{URx: 841.890, URy: 595.276}
	A5     = &pdf.Rectangle{URx: 420.945, URy: 595.276}
	A5r    = &pdf.Rectangle{URx: 595.276, URy: 420.945}
	Letter = &pdf.Rectangle{URx: 612, URy: 792}
)

Default paper sizes as PDF rectangles.

Functions

This section is empty.

Types

type MultiPage

type MultiPage struct {
	Out  pdf.Putter
	Tree *pagetree.Writer
	// contains filtered or unexported fields
}

func AddMultiPage added in v0.3.4

func AddMultiPage(out pdf.Putter, pageSize *pdf.Rectangle) (*MultiPage, error)

func CreateMultiPage

func CreateMultiPage(fileName string, pageSize *pdf.Rectangle, v pdf.Version, opt *pdf.WriterOptions) (*MultiPage, error)

func WriteMultiPage

func WriteMultiPage(w io.Writer, pageSize *pdf.Rectangle, v pdf.Version, opt *pdf.WriterOptions) (*MultiPage, error)

func (*MultiPage) AddPage

func (doc *MultiPage) AddPage() *Page

func (*MultiPage) Close

func (doc *MultiPage) Close() error

type Page

type Page struct {
	// Writer is used to draw the contents of the page.
	*graphics.Writer

	// PageDict is the PDF dictionary for this page.
	// This can be modified by the user.  The values at the time
	// when the page is closed will be written to the PDF file.
	//
	// See section 7.7.3.3. of PDF 32000-1:2008 for a list of
	// possible entries in this dictionary:
	// https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#page=85
	PageDict pdf.Dict

	// Out is the PDF file which contains this page.
	// This can be used to embed fonts, images, etc.
	Out pdf.Putter

	// Ref, if non-nil, is the pdf reference for this page.
	// This can be set by the user, to use a specific reference.
	// If Ref is nil when the page is closed, a new reference will
	// be allocated.
	Ref pdf.Reference
	// contains filtered or unexported fields
}

Page represents a page in a PDF document. The contents of the page can be drawn using the graphics.Writer methods.

func CreateSinglePage

func CreateSinglePage(fileName string, pageSize *pdf.Rectangle, v pdf.Version, opt *pdf.WriterOptions) (*Page, error)

func WriteSinglePage

func WriteSinglePage(w io.Writer, pageSize *pdf.Rectangle, v pdf.Version, opt *pdf.WriterOptions) (*Page, error)

func (*Page) Close

func (p *Page) Close() error

Close writes the page to the PDF file. The page contents can no longer be modified after this call.

func (*Page) GetPageSize added in v0.3.5

func (p *Page) GetPageSize() *pdf.Rectangle

func (*Page) SetPageSize added in v0.3.5

func (p *Page) SetPageSize(paper *pdf.Rectangle)

Jump to

Keyboard shortcuts

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