Documentation
¶
Overview ¶
This package implements the high level parts of the document generation, but is still backend independant. It is meant to be used together with a `backend.Drawer`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct { // A list of `Page` objects. Pages []Page // A `DocumentMetadata` object. // Contains information that does not belong to a specific page // but to the whole document. Metadata utils.DocumentMetadata // contains filtered or unexported fields }
Document is a rendered document ready to be painted on a drawing target.
It is obtained by calling the `Render()` function.
func Render ¶
func Render(html *tree.HTML, stylesheets []tree.CSS, presentationalHints bool, fontConfig *text.FontConfiguration) Document
Render performs the layout of the whole document and returns a document ready to be painted.
fontConfig is mandatory presentationalHints should default to `false`
func (*Document) Write ¶
Write paints the pages in the given `target`, with meta-data.
The zoom factor is in PDF units per CSS units, and should default to 1. Warning : all CSS units are affected, including physical units like `cm` and named sizes like `A4`. For values other than 1, the physical CSS units will thus be "wrong".
`attachments` is an optional list of additional file attachments for the generated PDF document, added to those collected from the metadata.
type Link ¶
type Link struct { // Type is one of three strings : // - "external": `target` is an absolute URL // - "internal": `target` is an anchor name // The anchor might be defined in another page, // in multiple pages (in which case the first occurence is used), // or not at all. // - "attachment": `target` is an absolute URL and points // to a resource to attach to the document. Type string Target string // [x_min, y_min, x_max, y_max] in CSS // pixels from the top-left of the page. Rectangle [4]fl }
Link is a positionned link in a page.
type Page ¶
type Page struct { // The page bleed widths with values in CSS pixels. Bleed Bleed // The page width, including margins, in CSS pixels. Width fl // The page height, including margins, in CSS pixels. Height fl // contains filtered or unexported fields }
Page represents a single rendered page.
func (Page) Paint ¶
Paint the page on `dst`. leftX is the X coordinate of the left of the page, in user units. topY is the Y coordinate of the top of the page, in user units. scale is the Zoom scale in user units per CSS pixel. clip : whether to clip/cut content outside the page. If false, content can overflow. (leftX=0, topY=0, scale=1, clip=false)
type StackingContext ¶
type StackingContext struct {
// contains filtered or unexported fields
}
Stacking contexts define the paint order of all pieces of a document. http://www.w3.org/TR/CSS21/visuren.html#x43 http://www.w3.org/TR/CSS21/zindex.html
func NewStackingContext ¶
func NewStackingContext(box Box, childContexts []StackingContext, blocks []bo.Box, floats []StackingContext, blocksAndCells []Box, page *bo.PageBox, ) StackingContext
func NewStackingContextFromBox ¶
func NewStackingContextFromBox(box Box, page *bo.PageBox, childContexts *[]StackingContext) StackingContext
func NewStackingContextFromPage ¶
func NewStackingContextFromPage(page *bo.PageBox) StackingContext
func (StackingContext) IsClassicalBox ¶
func (StackingContext) IsClassicalBox() bool