Documentation ¶
Overview ¶
Package pdpf is an opionated package around the jung-kurt/gofpdf package.
Index ¶
Constants ¶
const MM2INCH float64 = 25.4
MM2INCH defines the number if millimeters in an inch.
Variables ¶
This section is empty.
Functions ¶
func AppendFlags ¶
Types ¶
type Borders ¶
type Borders struct { // The size of any border to add to the top of each image. Top float64 // The size of any border to add to the bottom of each image. Bottom float64 // The size of any border to add to the left-hand side of each image. Left float64 // The size of any border to add to the right-hand side of each image. Right float64 }
type Borders defines a struct for storing borders to be applied to a images in a PDF document.
type Canvas ¶
type Canvas struct { // The width of the internal canvas. Width float64 // The height of the internal canvas. Height float64 }
type Canvas defines a struct for storing canvas information for a PDF document.
type Document ¶
type Document struct { // A `gofpdf.Fpdf` instance used to produce the picturebook PDF file. PDF *gofpdf.Fpdf // A `sync.Mutex` instance used to add images in an orderly fashion. Mutex *sync.Mutex // The `PictureBookBorders` definition to use for this picturebook Borders *Borders // The `PictureBookMargins` definition to use for this picturebook Margins *Margins // The `PictureBookCanvas` definition to use for this picturebook Canvas Canvas // The `PictureBookText` definition to use for this picturebook Text Text // The `PictureBookOptions` used to create this picturebook Options *Options // contains filtered or unexported fields }
type Document provides a struct for creating a PDF file from a folder of images (a picturebook).
func NewDocument ¶
New returns a new “ instances configured according to the settings in 'opts'.
type Margins ¶
type Margins struct { // The size of any margin to add to the top of each page. Top float64 // The size of any margin to add to the bottom of each page. Bottom float64 // The size of any margin to add to the left-hand side of each page. Left float64 // The size of any margin to add to the right-hand side of each page. Right float64 }
type Margins defines a struct for storing margins to be applied to a PDF document.
type Options ¶
type Options struct { // The orientation of the final . Valid options are "P" and "L" for portrait and landscape respectively. Orientation string // A string label corresponding to known size. Valid options are "a1", "a2", "a3", "a4", "a5", "a6", "a7", "letter", "legal" and "tabloid". Size string // The width of the final document. Width float64 // The height of the final document. Height float64 // The unit of measurement to use for the `Width` and `Height` options. Units string // The number dots per inch to use when calculating the size of the final . Valid options are "inches", "centimeters", "millimeters". DPI float64 // The size of any border to apply to each image in the final document. Border float64 // The size of any additional bleed to apply to the final document. Bleed float64 // The size of any margin to add to the top of each page. MarginTop float64 // The size of any margin to add to the bottom of each page. MarginBottom float64 // The size of any margin to add to the left-hand side of each page. MarginLeft float64 // The size of any margin to add to the right-hand side of each page. MarginRight float64 // A boolean value to enable to use of an OCRA font for writing captions. OCRAFont bool }
Options defines a struct containing configuration information for a given PDF document.
func DefaultOptions ¶
NewDefaultOptions returns an `Options` instance with default settings.
type Text ¶
type Text struct { // The name of the font to use for text strings. Font string // The style of the font to use for text strings. Style string // The size of the font to use for text strings. Size float64 // The margin to apply to text strings. Margin float64 // The colour of the font to use for text strings. Colour []int }
type Text defines a struct for storing information for how text should be displayed in a .