Documentation
¶
Overview ¶
Package psbdf writes BDF documents as PostScript (Level 3), for the printers that take PostScript and not PDF: office printers of the years before PDF was common, the PostScript of other makers (KPDL, BR-Script), and large-format PostScript printers.
The instructions of the objects (docs/spec.md §7) become the operators of PostScript, in the same order, as vector/pdfbdf writes them as those of a PDF: paths, transforms, clips, lines and dashes, colors, linear and radial gradients (the smooth shadings of Level 3), images (JPEG as it is, others as their pixels) and the objects they use. Text is drawn with Type 3 fonts made of the outlines of the glyphs in use, which every interpreter draws the same, and laid out as raster/imagebdf lays it out.
PostScript has no transparency. What it cannot draw (alpha, blend modes, groups with an alpha, a blend mode or a soft mask, shadows, filters, images with alpha, gradients with alpha, patterns and conic gradients) is found in a first pass over each page, and the rectangles where it is drawn are drawn as pictures (vector/internal/flatten): the rest of the page stays vectors, under a clip that leaves the rectangles out.
The file follows the Document Structuring Conventions, so that spoolers can count and reorder its pages, and asks the printer for the paper, the copies, the sides and the tray with setpagedevice, each as a feature that a printer without it skips. Images and pictures are written in ASCII85, so that the file is text that any connection passes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoPages = errors.New("psbdf: the document has no pages")
ErrNoPages is returned for a document without pages to write.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Views are the ids of the views to write. nil writes the views of
// pages (fixed and flow).
Views []string
// Pages selects the pages written, by their zero-based number among
// the pages of the views, in that order; -1 writes a blank page (the
// sheet between copies of a two-sided document). nil writes all of
// them.
Pages []int
// SkipRoles are the roles of the layers that are left out
// (bdf.RoleBackground …): for paper that has them printed already.
SkipRoles []string
// FontFS, FontDirs and NoSystemFonts find the fonts of text of fonts
// referred to by name, and of characters an embedded font lacks.
FontFS fs.FS
FontDirs []string
NoSystemFonts bool
// Place places a page of w × h points on a sheet: the size of the
// sheet in points, and the transform from the space of the page (its
// y axis down from its top left corner) to that of the sheet (y up
// from its bottom left corner). nil prints a page on a sheet of its
// size.
Place func(w, h float64) (sheetW, sheetH float64, m [6]float64)
// Copies, Collate, Sides ("one-sided", "two-sided-long-edge",
// "two-sided-short-edge"), MediaType ("stationery") and MediaPosition
// (the input tray) are asked of the printer; what is not set (0, "")
// is left to it.
Copies int
Collate bool
Sides string
MediaType string
MediaPosition int
// Gray writes colors as gray (luminance): for black and white
// printing.
Gray bool
// RasterDPI is the resolution of what is drawn as pictures: 300 when
// 0.
RasterDPI int
// Title is the %%Title of the file; the title of the document when "".
Title string
}
Options controls the writing of a file.