types

package
v1.0.44 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorSpace_DeviceGray = ColorSpaceFamily("DeviceGray")
	ColorSpace_DeviceRGB  = ColorSpaceFamily("DeviceRGB")
	ColorSpace_DeviceCMYK = ColorSpaceFamily("DeviceCMYK")

	ColorSpace_CalGray  = ColorSpaceFamily("CalGray")
	ColorSpace_CalRGB   = ColorSpaceFamily("CalRGB")
	ColorSpace_Lab      = ColorSpaceFamily("Lab")
	ColorSpace_ICCBased = ColorSpaceFamily("ICCBased")

	ColorSpace_Indexed    = ColorSpaceFamily("Indexed")
	ColorSpace_Pattern    = ColorSpaceFamily("Pattern")
	ColorSpace_Separation = ColorSpaceFamily("Separation")
	ColorSpace_DeviceN    = ColorSpaceFamily("DeviceN")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array []Object

func (Array) Copy added in v1.0.5

func (q Array) Copy(copyRef func(reference Reference) Reference) Object

func (Array) ToRawBytes

func (q Array) ToRawBytes() []byte

type Boolean

type Boolean bool

func (Boolean) Copy added in v1.0.5

func (q Boolean) Copy(_ func(reference Reference) Reference) Object

func (Boolean) ToRawBytes

func (q Boolean) ToRawBytes() []byte

type CIDFont

type CIDFont struct {

	// (Required) The type of CIDFont; CIDFontType0 or CIDFontType2.
	Subtype FontSubType

	// (Required) The PostScript name of the CIDFont. For Type 0 CIDFonts, this
	// is usually the value of the CIDFontName entry in the CIDFont program. For
	// Type 2 CIDFonts, it is derived the same way as for a simple TrueType font;
	// see Section 5.5.2, “TrueType Fonts.” In either case, the name can have a sub-
	// set prefix if appropriate; see Section 5.5.3, “Font Subsets.”
	BaseFont Name

	// (Required) A dictionary containing entries that define the character collec-
	// tion of the CIDFont. See Table 5.12 on page 337.
	CIDSystemInfo Object

	// (Required; must be an indirect reference) A font descriptor describing the
	// CIDFont’s default metrics other than its glyph widths (see Section 5.7,
	// “Font Descriptors”).
	FontDescriptor Reference

	// (Optional) The default width for glyphs in the CIDFont (see “Glyph Met-
	// rics in CIDFonts” on page 340). Default value: 1000.
	DW Object

	// (Optional) A description of the widths for the glyphs in the CIDFont. The
	// array’s elements have a variable format that can specify individual widths
	// for consecutive CIDs or one width for a range of CIDs (see “Glyph Metrics
	// in CIDFonts” on page 340). Default value: none (the DW value is used for
	// all glyphs).
	W Object

	// (Optional; applies only to CIDFonts used for vertical writing) An array of two
	// numbers specifying the default metrics for vertical writing (see “Glyph
	// Metrics in CIDFonts” on page 340). Default value: [880 −1000].
	DW2 Object

	// (Optional; applies only to CIDFonts used for vertical writing) A description of
	// the metrics for vertical writing for the glyphs in the CIDFont (see “Glyph
	// Metrics in CIDFonts” on page 340). Default value: none (the DW2 value is
	// used for all glyphs).
	W2 Object

	// (Optional; Type 2 CIDFonts only) A specification of the mapping from CIDs
	// to glyph indices. If the value is a stream, the bytes in the stream contain the
	// mapping from CIDs to glyph indices: the glyph index for a particular CID
	// value c is a 2-byte value stored in bytes 2 ◊ c and 2 ◊ c + 1, where the first
	// byte is the high-order byte. If the value of CIDToGIDMap is a name, it must
	// be Identity, indicating that the mapping between CIDs and glyph indices is
	// the identity mapping. Default value: Identity.
	// This entry may appear only in a Type 2 CIDFont whose associated True-
	// Type font program is embedded in the PDF file (see the next section).
	CIDToGIDMap Object
}

func (CIDFont) Copy added in v1.0.5

func (q CIDFont) Copy(copyRef func(reference Reference) Reference) Object

func (*CIDFont) Read added in v1.0.5

func (q *CIDFont) Read(dict Dictionary) error

func (CIDFont) ToRawBytes

func (q CIDFont) ToRawBytes() []byte

type CIDSystemInfoDictionary

type CIDSystemInfoDictionary struct {
	// (Required) A string identifying the issuer of the character collection—for exam-
	// ple, Adobe. For information about assigning a registry identifier, consult the ASN
	// Developer Program Web site or contact the Adobe Solutions Network (see the
	// Bibliography).
	Registry String

	// (Required) A string that uniquely names the character collection within the speci-
	// fied registry—for example, Japan1.
	Ordering String

	// (Required) The supplement number of the character collection. An original charac-
	// ter collection has a supplement number of 0. Whenever additional CIDs are
	// assigned in a character collection, the supplement number is increased. Supple-
	// ments do not alter the ordering of existing CIDs in the character collection. This
	// value is not used in determining compatibility between character collections.
	Supplement Int
}

func (CIDSystemInfoDictionary) Copy added in v1.0.5

func (q CIDSystemInfoDictionary) Copy(copyRef func(reference Reference) Reference) Object

func (CIDSystemInfoDictionary) ToRawBytes

func (q CIDSystemInfoDictionary) ToRawBytes() []byte

type ColorSpaceFamily

type ColorSpaceFamily Name

func (ColorSpaceFamily) Copy added in v1.0.5

func (q ColorSpaceFamily) Copy(_ func(reference Reference) Reference) Object

func (ColorSpaceFamily) ToRawBytes

func (q ColorSpaceFamily) ToRawBytes() []byte

type Date

type Date time.Time

func (Date) Copy added in v1.0.5

func (q Date) Copy(_ func(reference Reference) Reference) Object

func (Date) IsZero

func (q Date) IsZero() bool

func (Date) ToRawBytes

func (q Date) ToRawBytes() []byte

type Dictionary

type Dictionary map[Name]Object

func (Dictionary) Copy added in v1.0.5

func (q Dictionary) Copy(copyRef func(reference Reference) Reference) Object

func (Dictionary) ToRawBytes

func (q Dictionary) ToRawBytes() []byte

type DocumentCatalog

type DocumentCatalog struct {

	// (Optional; PDF 1.4) The version of the PDF specification to which the
	// document conforms (for example, 1.4), if later than the version specified
	// in the file’s header (see Section 3.4.1, “File Header”). If the header speci-
	// fies a later version, or if this entry is absent, the document conforms to
	// the version specified in the header. This entry enables a PDF producer
	// application to update the version using an incremental update; see Sec-
	// tion 3.4.5, “Incremental Updates.” (See implementation note 18 in Ap-
	// pendix H.)
	// Note: The value of this entry is a name object, not a number, and so must
	// be preceded by a slash character (/) when written in the PDF file (for ex-
	// ample, /1.4).
	Version Name

	// (Required; must be an indirect reference) The page tree node that is the
	// root of the document’s page tree (see Section 3.6.2, “Page Tree”).
	Pages Reference

	// (Optional; PDF 1.3) A number tree (see Section 3.8.5, “Number Trees”)
	// defining the page labeling for the document. The keys in this tree are
	// page indices; the corresponding values are page label dictionaries (see
	// Section 8.3.1, “Page Labels”). Each page index denotes the first page in a
	// labeling range to which the specified page label dictionary applies. The
	// tree must include a value for page index 0.
	PageLabels Object

	// (Optional; PDF 1.2) The document’s name dictionary (see Section 3.6.3,
	// “Name Dictionary”).
	Names Object

	// (Optional; PDF 1.1; must be an indirect reference) A dictionary of names
	// and corresponding destinations (see “Named Destinations” on page
	// 476).
	Dests Reference

	// (Optional; PDF 1.2) A viewer preferences dictionary (see Section 8.1,
	// “Viewer Preferences”) specifying the way the document is to be dis-
	// played on the screen. If this entry is absent, viewer applications should
	// use their own current user preference settings.
	ViewerPreferences Object

	// (Optional) A name object specifying the page layout to be used when the
	// document is opened:
	// SinglePage Display one page at a time.
	// OneColumn Display the pages in one column.
	// TwoColumnLeft Display the pages in two columns, with odd-
	// numbered pages on the left.
	// TwoColumnRight Display the pages in two columns, with odd-
	// numbered pages on the right.
	// (See implementation note 19 in Appendix H.) Default value: SinglePage.
	PageLayout Name

	// (Optional) A name object specifying how the document should be dis-
	// played when opened:
	// UseNone Neither document outline nor thumbnail im-
	// ages visible
	// UseOutlines Document outline visible
	// UseThumbs Thumbnail images visible
	// FullScreen Full-screen mode, with no menu bar, window
	// controls, or any other window visible
	// Default value: UseNone.
	PageMode Name

	// (Optional; must be an indirect reference) The outline dictionary that is the
	// root of the document’s outline hierarchy (see Section 8.2.2, “Document
	// Outline”).
	Outlines Reference

	// (Optional; PDF 1.1; must be an indirect reference) An array of thread
	// dictionaries representing the document’s article threads (see Section
	// 8.3.2, “Articles”).
	Threads Array

	// (Optional; PDF 1.1) A value specifying a destination to be displayed or
	// an action to be performed when the document is opened. The value is
	// either an array defining a destination (see Section 8.2.1, “Destinations”)
	// or an action dictionary representing an action (Section 8.5, “Actions”). If
	// this entry is absent, the document should be opened to the top of the
	// first page at the default magnification factor.
	OpenAction Object // can be reference as well

	// (Optional; PDF 1.1) A value specifying a destination to be displayed or
	// dictionary an action to be performed when the document is opened. The value is
	// either an array defining a destination (see Section 8.2.1, “Destinations”)
	// or an action dictionary representing an action (Section 8.5, “Actions”). If
	// this entry is absent, the document should be opened to the top of the
	// first page at the default magnification factor.
	AdditionalActions Object

	// (Optional) A URI dictionary containing document-level information for
	// URI (uniform resource identifier) actions (see “URI Actions” on page
	// 523).
	URI Object

	// (Optional; PDF 1.2) The document’s interactive form (AcroForm) dic-
	// tionary (see Section 8.6.1, “Interactive Form Dictionary”).
	AcroForm Object

	// (Optional; PDF 1.4; must be an indirect reference) A metadata stream
	// containing metadata for the document (see Section 9.2.2, “Metadata
	// Streams”).
	Metadata Reference

	// (Optional; PDF 1.3) The document’s structure tree root dictionary (see
	// Section 9.6.1, “Structure Hierarchy”).
	StructTreeRoot Object

	// (Optional; PDF 1.4) A mark information dictionary containing informa-
	// tion about the document’s usage of Tagged PDF conventions (see Sec-
	// tion 9.7.1, “Mark Information Dictionary”).
	MarkInfo Object

	// (Optional; PDF 1.4) A language identifier specifying the natural language
	// for all text in the document except where overridden by language speci-
	// fications for structure elements or marked content (see Section 9.8.1,
	// “Natural Language Specification”). If this entry is absent, the language is
	// considered unknown.
	Lang String

	// (Optional; PDF 1.3) A Web Capture information dictionary containing
	// state information used by the Acrobat Web Capture (AcroSpider) plug-
	// in extension (see Section 9.9.1, “Web Capture Information Dictionary”).
	SpiderInfo Object

	// (Optional; PDF 1.4) An array of output intent dictionaries describing the
	// color characteristics of output devices on which the document might be
	// rendered (see “Output Intents” on page 684).
	OutputIntents Object // seems that it can also be a refernece
}

func (DocumentCatalog) Copy added in v1.0.5

func (q DocumentCatalog) Copy(copyRef func(reference Reference) Reference) Object

func (*DocumentCatalog) Read added in v1.0.5

func (q *DocumentCatalog) Read(dict Dictionary) error

func (DocumentCatalog) ToRawBytes

func (q DocumentCatalog) ToRawBytes() []byte

type Encoding

type Encoding Name
const (
	EncodingStandard  Encoding = "StandardEncoding"
	EncodingMacRoman  Encoding = "MacRomanEncoding"
	EncodingWinAnsi   Encoding = "WinAnsiEncoding"
	EncodingPDFDoc    Encoding = "PDFDocEncoding"
	EncodingMacExpert Encoding = "MacExpertEncoding"
)

func (Encoding) Copy added in v1.0.5

func (q Encoding) Copy(_ func(reference Reference) Reference) Object

func (Encoding) Encode

func (q Encoding) Encode(s string) string

func (Encoding) ToRawBytes

func (q Encoding) ToRawBytes() []byte

type EncryptionDictionary

type EncryptionDictionary struct {
	// (Required) The name of the security handler for this document; see below. Default value:
	// Standard, for the built-in security handler. (Names for other security handlers can be
	// registered using the procedure described in Appendix E.)
	Filter Name

	// (Optional but strongly recommended) A code specifying the algorithm to be used in en-
	// crypting and decrypting the document:
	// 0 An algorithm that is undocumented and no longer supported, and whose use is
	// strongly discouraged.
	// 1 Algorithm 3.1 on page 73, with an encryption key length of 40 bits; see below.
	// 2 (PDF 1.4) Algorithm 3.1 on page 73, but allowing encryption key lengths greater
	// than 40 bits.
	// 3 (PDF 1.4) An unpublished algorithm allowing encryption key lengths ranging
	// from 40 to 128 bits. (This algorithm is unpublished as an export requirement of
	// the U.S. Department of Commerce.)
	// The default value if this entry is omitted is 0, but a value of 1 or greater is strongly rec-
	// ommended. (See implementation note 15 in Appendix H.)
	V Number

	// (Optional; PDF 1.4; only if V is 2 or 3) The length of the encryption key, in bits. The value
	// must be a multiple of 8, in the range 40 to 128. Default value: 40.
	Length Int
}

func (EncryptionDictionary) ToRawBytes

func (q EncryptionDictionary) ToRawBytes() []byte

type FileSpecification

type FileSpecification struct{}

type Filter

type Filter Name
const (
	Filter_NoFilter        Filter = ""
	Filter_ASCIIHexDecode  Filter = "ASCIIHexDecode"
	Filter_ASCII85Decode   Filter = "ASCII85Decode"
	Filter_LZWDecode       Filter = "LZWDecode"
	Filter_FlateDecode     Filter = "FlateDecode"
	Filter_RunLengthDecode Filter = "RunLengthDecode"
	Filter_CCITTFaxDecode  Filter = "CCITTFaxDecode"
	Filter_JBIG2Decode     Filter = "JBIG2Decode"
	Filter_DCTDecode       Filter = "DCTDecode"
)

func (Filter) Copy added in v1.0.5

func (q Filter) Copy(_ func(reference Reference) Reference) Object

func (Filter) ToRawBytes

func (q Filter) ToRawBytes() []byte

type Font

type Font struct {

	// (Required) The type of font; must be Type1 for a Type 1 font.
	Subtype FontSubType

	// (Required in PDF 1.0; optional otherwise) The name by which this font is ref-
	// erenced in the Font subdictionary of the current resource dictionary.
	// Note: This entry is obsolescent and its use is no longer recommended. (See
	// implementation note 42 in Appendix H.)
	Name Name

	// (Required) The PostScript name of the font. For Type 1 fonts, this is usually
	// the value of the FontName entry in the font program; for more information,
	// see Section 5.2 of the PostScript Language Reference, Third Edition. The Post-
	// Script name of the font can be used to find the font’s definition in the viewer
	// application or its environment. It is also the name that will be used when
	// printing to a PostScript output device.
	BaseFont Name

	// (Required except for the standard 14 fonts) The first character code defined in
	// the font’s Widths array.
	FirstChar Int

	// (Required except for the standard 14 fonts) The last character code defined in
	// the font’s Widths array.
	LastChar Int

	// (Required except for the standard 14 fonts; indirect reference preferred) An array
	// of (LastChar − FirstChar + 1) widths, each element being the glyph width for
	// the character whose code is FirstChar plus the array index. For character
	// codes outside the range FirstChar to LastChar, the value of MissingWidth from
	// the FontDescriptor entry for this font is used. The glyph widths are measured
	// in units in which 1000 units corresponds to 1 unit in text space. These widths
	// must be consistent with the actual widths given in the font program itself.
	// (See implementation note 43 in Appendix H.) For more information on
	// glyph widths and other glyph metrics, see Section 5.1.3, “Glyph Positioning
	// and Metrics.”
	Widths Array

	// (Required except for the standard 14 fonts; must be an indirect reference) A font
	//descriptor describing the font’s metrics other than its glyph widths (see Sec-
	//tion 5.7, “Font Descriptors”).
	FontDescriptor Reference

	// (Optional) A specification of the font’s character encoding, if different from
	// its built-in encoding. The value of Encoding may be either the name of a pre-
	// defined encoding (MacRomanEncoding, MacExpertEncoding, or WinAnsi-
	// Encoding, as described in Appendix D) or an encoding dictionary that
	// specifies differences from the font’s built-in encoding or from a specified pre-
	// defined encoding (see Section 5.5.5, “Character Encoding”).
	Encoding Object

	// (Optional; PDF 1.2) A stream containing a CMap file that maps character
	// codes to Unicode values (see Section 5.9, “ToUnicode CMaps”).
	ToUnicode Object
}

func (Font) Copy added in v1.0.5

func (q Font) Copy(copyRef func(reference Reference) Reference) Object

func (*Font) Read added in v1.0.5

func (q *Font) Read(dict Dictionary) error

func (Font) ToRawBytes

func (q Font) ToRawBytes() []byte

type FontDescriptor

type FontDescriptor struct {
	// Type // Required
	FontName     Name      // Required
	Flags        Int       // Required
	FontBBox     Rectangle // Required
	ItalicAngle  Number    // Required
	Ascent       Number    // Required
	Descent      Number    // Required
	Leading      Number    // optional
	CapHeight    Number    // Required
	XHeight      Number    // optional
	StemV        Number    // Required
	StemH        Number    // optional
	AvgWidth     Number    // optional
	MaxWidth     Number    // optional
	MissingWidth Number    // optional
	FontFile     Reference // for Type 1 font
	FontFile2    Reference // for TrueType font
	FontFile3    Reference // for other font types
	CharSet      String    // optional
}

func (FontDescriptor) Copy added in v1.0.5

func (q FontDescriptor) Copy(copyRef func(reference Reference) Reference) Object

func (*FontDescriptor) Read added in v1.0.5

func (q *FontDescriptor) Read(dict Dictionary) error

func (FontDescriptor) ToRawBytes

func (q FontDescriptor) ToRawBytes() []byte

type FontSubType

type FontSubType Name
const (
	FontSub_Type0        FontSubType = "Type0"
	FontSub_Type1        FontSubType = "Type1"
	FontSub_MMType1      FontSubType = "MMType1"
	FontSub_Type3        FontSubType = "Type3"
	FontSub_TrueType     FontSubType = "TrueType"
	FontSub_CIDFontType0 FontSubType = "CIDFontType0"
	FontSub_CIDFontType2 FontSubType = "CIDFontType2"
)

func (FontSubType) Copy added in v1.0.5

func (q FontSubType) Copy(_ func(reference Reference) Reference) Object

func (FontSubType) ToRawBytes

func (q FontSubType) ToRawBytes() []byte

type FontType

type FontType Name
const (
	FontType_Type0    FontType = "Type0"
	FontType_Type1    FontType = "Type1"
	FontType_Type3    FontType = "Type3"
	FontType_TrueType FontType = "TrueType"
	FontType_CIDFont  FontType = "CIDFont"
)

func (FontType) ToRawBytes

func (q FontType) ToRawBytes() []byte

type Form added in v1.0.25

type Form struct {
	Dictionary StreamDictionary
	Stream     []byte

	// (Optional) A code identifying the type of form XObject that this dictionary
	// describes. The only valid value defined at the time of publication is 1. Default
	// value: 1.
	FormType Int

	// (Required in PDF 1.0; optional otherwise) The name by which this form
	// XObject is referenced in the XObject subdictionary of the current resource
	// dictionary (see Section 3.7.2, “Resource Dictionaries”).
	// Note: This entry is obsolescent and its use is no longer recommended. (See
	// implementation note 38 in Appendix H.)
	Name Name

	// (Required if PieceInfo is present; optional otherwise; PDF 1.3) The date and
	// time (see Section 3.8.2, “Dates”) when the form XObject’s contents were
	// most recently modified. If a page-piece dictionary (PieceInfo) is present, the
	// modification date is used to ascertain which of the application data diction-
	// aries it contains correspond to the current content of the form (see Section
	// 9.4, “Page-Piece Dictionaries”).
	LastModified Date

	// (Required) An array of four numbers in the form coordinate system (see
	// below), giving the coordinates of the left, bottom, right, and top edges,
	// respectively, of the form XObject’s bounding box. These boundaries are used
	// to clip the form XObject and to determine its size for caching.
	BBox Rectangle

	// (Optional) An array of six numbers specifying the form matrix, which maps
	// form space into user space (see Section 4.2.3, “Transformation Matrices”).
	// Default value: the identity matrix [1 0 0 1 0 0].
	Matrix Array

	// (Optional but strongly recommended; PDF 1.2) A dictionary specifying any
	// resources (such as fonts and images) required by the form XObject (see Sec-
	// tion 3.7, “Content Streams and Resources”).
	// In PDF 1.1 and earlier, all named resources used in the form XObject must be
	// included in the resource dictionary of each page object on which the form
	// XObject appears, whether or not they also appear in the resource dictionary
	// of the form XObject itself. It can be useful to specify these resources in the
	// form XObject’s own resource dictionary as well, in order to determine which
	// resources are used inside the form XObject. If a resource is included in both
	// dictionaries, it should have the same name in both locations.In PDF 1.2 and later versions, form XObjects can be independent of the
	// content streams in which they appear, and this is strongly recommended
	// although not required. In an independent form XObject, the resource dic-
	// tionary of the form XObject is required and contains all named resources
	// used by the form XObject. These resources are not “promoted” to the outer
	// content stream’s resource dictionary, although that stream’s resource diction-
	// ary will refer to the form XObject itself.
	Resources Object

	// (Optional; PDF 1.4) A group attributes dictionary indicating that the contents
	// of the form XObject are to be treated as a group and specifying the attributes
	// of that group (see Section 4.9.2, “Group XObjects”).
	// Note: If a Ref entry (see below) is present, the group attributes also apply to the
	// external page imported by that entry. This allows such an imported page to be
	// treated as a group without further modification.
	// Ref dictionary (Optional; PDF 1.4) A reference dictionary identifying a page to be imported
	// from another PDF file, and for which the form XObject serves as a proxy (see
	// Section 4.9.3, “Reference XObjects”).
	Group Object

	// (Optional; PDF 1.4) A metadata stream containing metadata for the form
	// XObject (see Section 9.2.2, “Metadata Streams”).
	Metadata Object

	// (Optional; PDF 1.3) A page-piece dictionary associated with the form
	// XObject (see Section 9.4, “Page-Piece Dictionaries”).
	PieceInfo Object

	// (Required if the form XObject is a structural content item; PDF 1.3) The integer
	// key of the form XObject’s entry in the structural parent tree (see “Finding
	// Structure Elements from Content Items” on page 600).
	StructParent Int

	// (Required if the form XObject contains marked-content sequences that are struc-
	// tural content items; PDF 1.3) The integer key of the form XObject’s entry in
	// the structural parent tree (see “Finding Structure Elements from Content
	// Items” on page 600).
	// Note: At most one of the entries StructParent or StructParents may be present. A
	// form XObject can be either a content item in its entirety or a container for
	// marked-content sequences that are content items, but not both.
	StructParents Int

	// (Optional; PDF 1.2) An OPI version dictionary for the form XObject (see
	//Section 9.10.6, “Open Prepress Interface (OPI)”).
	OPI Object
}

func (Form) ToRawBytes added in v1.0.25

func (q Form) ToRawBytes() []byte

type Function

type Function struct{}

type GraphicsState

type GraphicsState struct {

	// (Optional; PDF 1.3) The line width (see “Line Width” on page 152).
	W Number

	// (Optional; PDF 1.3) The line cap style (see “Line Cap Style” on page 153).
	LC Int

	// (Optional; PDF 1.3) The line join style (see “Line Join Style” on page 153).
	LJ Int

	// (Optional; PDF 1.3) The miter limit (see “Miter Limit” on page 153).
	ML Number

	// (Optional; PDF 1.3) The line dash pattern, expressed as an array of the form
	// [dashArray dashPhase], where dashArray is itself an array and dashPhase is an
	// 	integer (see “Line Dash Pattern” on page 155).
	D Array

	// (Optional; PDF 1.3) The name of the rendering intent (see “Rendering
	// Intents” on page 197).
	RI Number

	// (Optional) A flag specifying whether to apply overprint (see Section 4.5.6,
	// “Overprint Control”). In PDF 1.2 and earlier, there is a single overprint
	// parameter that applies to all painting operations. Beginning with PDF 1.3,
	// there are two separate overprint parameters: one for stroking and one for all
	// other painting operations. Specifying an OP entry sets both parameters un-
	// less there is also an op entry in the same graphics state parameter dictionary,
	// in which case the OP entry sets only the overprint parameter for stroking.
	OP Boolean

	// (Optional; PDF 1.3) A flag specifying whether to apply overprint (see Section
	// 4.5.6, “Overprint Control”) for painting operations other than stroking. If
	// this entry is absent, the OP entry, if any, sets this parameter.
	Op Boolean

	// (Optional; PDF 1.3) The overprint mode (see Section 4.5.6, “Overprint Control”).
	OPM Int

	// (Optional; PDF 1.3) An array of the form [font size], where font is an indirect
	// reference to a font dictionary and size is a number expressed in text space
	// units. These two objects correspond to the operands of the Tf operator (see
	// Section 5.2, “Text State Parameters and Operators”); however, the first oper-
	// and is an indirect object reference instead of a resource name.
	// BG function (Optional) The black-generation function, which maps the interval [0.0 1.0]
	// to the interval [0.0 1.0] (see Section 6.2.3, “Conversion from DeviceRGB to
	// DeviceCMYK”).
	Font Array

	// (Optional; PDF 1.3) Same as BG except that the value may also be the name
	// Default, denoting the black-generation function that was in effect at the start
	// of the page. If both BG and BG2 are present in the same graphics state param-
	// eter dictionary, BG2 takes precedence.
	BG2 Object

	// (Optional) The undercolor-removal function, which maps the interval
	// [0.0 1.0] to the interval [−1.0 1.0] (see Section 6.2.3, “Conversion from
	// DeviceRGB to DeviceCMYK”).
	UCR Function

	// (Optional; PDF 1.3) Same as UCR except that the value may also be the name
	// Default, denoting the undercolor-removal function that was in effect at the
	// start of the page. If both UCR and UCR2 are present in the same graphics state
	// parameter dictionary, UCR2 takes precedence.
	UCR2 Object

	// (Optional) The transfer function, which maps the interval [0.0 1.0] to the
	// or name interval [0.0 1.0] (see Section 6.3, “Transfer Functions”). The value is either
	// a single function (which applies to all process colorants) or an array of four
	// functions (which apply to the process colorants individually). The name
	// Identity may be used to represent the identity function.
	// Graphics StateS E C T I O N 4 . 3 159
	TR Object

	// (Optional; PDF 1.3) Same as TR except that the value may also be the name
	// or name Default, denoting the transfer function that was in effect at the start of the
	// page. If both TR and TR2 are present in the same graphics state parameter dic-
	// tionary, TR2 takes precedence.
	TR2 Object

	// (Optional) The halftone dictionary or stream (see Section 6.4, “Halftones”)
	// 	stream, or name or the name Default, denoting the halftone that was in effect at the start of the
	// 	page.
	HT Dictionary

	// (Optional; PDF 1.3) The flatness tolerance (see Section 6.5.1, “Flatness Tolerance”).
	FL Number

	// (Optional; PDF 1.3) The smoothness tolerance (see Section 6.5.2, “Smooth-
	// ness Tolerance”).
	SM Number

	// (Optional) A flag specifying whether to apply automatic stroke adjustment
	// (see Section 6.5.4, “Automatic Stroke Adjustment”).
	SA Boolean

	// (Optional; PDF 1.4) The current blend mode to be used in the transparent
	// imaging model (see Sections 7.2.4, “Blend Mode,” and 7.5.2, “Specifying
	// Blending Color Space and Blend Mode”).
	BM Object

	// (Optional; PDF 1.4) The current soft mask, specifying the mask shape or
	// mask opacity values to be used in the transparent imaging model (see
	// “Source Shape and Opacity” on page 421 and “Mask Shape and Opacity” on
	// page 443).
	// Note: Although the current soft mask is sometimes referred to as a “soft clip,”
	// altering it with the gs operator completely replaces the old value with the new
	// one, rather than intersecting the two as is done with the current clipping path
	// parameter (see Section 4.4.3, “Clipping Path Operators”).
	SMask Object

	// (Optional; PDF 1.4) The current stroking alpha constant, specifying the con-
	// stant shape or constant opacity value to be used for stroking operations in the
	// transparent imaging model (see “Source Shape and Opacity” on page 421
	// and “Constant Shape and Opacity” on page 444).
	CA Number

	// (Optional; PDF 1.4) Same as CA, but for nonstroking operations.
	Ca Number

	// (Optional; PDF 1.4) The alpha source flag (“alpha is shape”), specifying
	// whether the current soft mask and alpha constant are to be interpreted as
	// shape values (true) or opacity values (false).
	AIS Boolean

	// (Optional; PDF 1.4) The text knockout flag, which determines the behavior
	// of overlapping glyphs within a text object in the transparent imaging model
	// (see Section 5.2.7, “Text Knockout”
	TK Boolean
}

func (GraphicsState) ToRawBytes

func (q GraphicsState) ToRawBytes() []byte

type Image

type Image struct {
	Dictionary StreamDictionary
	Stream     []byte

	// (Required) The width of the image, in samples.
	Width Int

	// (Required) The height of the image, in samples.
	Height Int

	// (Required except for image masks; not allowed for image masks) The color
	// space in which image samples are specified. This may be any type of color
	// space except Pattern.
	ColorSpace Object

	// (Required except for image masks; optional for image masks) The number of
	// bits used to represent each color component. Only a single value may be
	// specified; the number of bits is the same for all color components. Valid
	// values are 1, 2, 4, and 8. If ImageMask is true, this entry is optional, and if
	// specified, its value must be 1.
	// If the image stream uses a filter, the value of BitsPerComponent must be
	// consistent with the size of the data samples that the filter delivers. In par-
	// ticular, a CCITTFaxDecode or JBIG2Decode filter always delivers 1-bit sam-
	// ples, a RunLengthDecode or DCTDecode filter delivers 8-bit samples, and
	// an LZWDecode or FlateDecode filter delivers samples of a specified size if
	// a predictor function is used.
	BitsPerComponent Int

	// (Optional; PDF 1.1) The name of a color rendering intent to be used in
	//rendering the image (see “Rendering Intents” on page 197). Default value:
	//the current rendering intent in the graphics state.
	Intent Name

	// (Optional) A flag indicating whether the image is to be treated as an image
	//mask (see Section 4.8.5, “Masked Images”). If this flag is true, the value of
	//BitsPerComponent must be 1 and Mask and ColorSpace should not be
	//specified; unmasked areas will be painted using the current nonstroking
	//color. Default value: false.
	ImageMask Boolean

	// (Optional except for image masks; not allowed for image masks; PDF 1.3) An
	// image XObject defining an image mask to be applied to this image (see
	// “Explicit Masking” on page 277), or an array specifying a range of colors
	// to be applied to it as a color key mask (see “Color Key Masking” on page
	// 277). If ImageMask is true, this entry must not be present. (See
	// implementation note 35 in Appendix H.)
	Mask Object

	// (Optional; PDF 1.4) A subsidiary image XObject defining a soft-mask
	// image (see “Soft-Mask Images” on page 447) to be used as a source of
	// mask shape or mask opacity values in the transparent imaging model. The
	// alpha source parameter in the graphics state determines whether the mask
	// values are interpreted as shape or opacity.
	// If present, this entry overrides the current soft mask in the graphics state,
	// as well as the image’s Mask entry, if any. (However, the other transparency-
	// related graphics state parameters—blend mode and alpha constant—
	// remain in effect.) If SMask is absent, the image has no associated soft mask
	// (although the current soft mask in the graphics state may still apply).
	SMask Object

	// (Optional) An array of numbers describing how to map image samples
	// into the range of values appropriate for the image’s color space (see
	// “Decode Arrays” on page 271). If ImageMask is true, the array must be
	// either [0 1] or [1 0]; otherwise, its length must be twice the number of
	// color components required by ColorSpace. Default value: see “Decode
	// Arrays” on page 271.
	Decode Array

	// (Optional) A flag indicating whether image interpolation is to be per-
	//formed (see “Image Interpolation” on page 273). Default value: false.
	Interpolate Boolean

	// (Optional; PDF 1.3) An array of alternate image dictionaries for this image
	// (see “Alternate Images” on page 273). The order of elements within the
	// array has no significance. This entry may not be present in an image
	// XObject that is itself an alternate image.
	Alternates Array

	// (Required in PDF 1.0; optional otherwise) The name by which this image
	// XObject is referenced in the XObject subdictionary of the current resource
	// dictionary (see Section 3.7.2, “Resource Dictionaries”).
	// Note: This entry is obsolescent and its use is no longer recommended. (See
	// implementation note 36 in Appendix H.)
	Name Name

	// (Required if the image is a structural content item; PDF 1.3) The integer key
	// of the image’s entry in the structural parent tree (see “Finding Structure
	// Elements from Content Items” on page 600).
	StructParent Int

	// (Optional; PDF 1.3; indirect reference preferred) The digital identifier of the
	//image’s parent Web Capture content set (see Section 9.9.5, “Object At-
	//tributes Related to Web Capture”).
	ID String

	// (Optional; PDF 1.2) An OPI version dictionary for the image (see Section
	// 9.10.6, “Open Prepress Interface (OPI)”). If ImageMask is true, this entry
	// is ignored.
	OPI Object

	// (Optional; PDF 1.4) A metadata stream containing metadata for the image
	// (see Section 9.2.2, “Metadata Streams”).
	Metadata Object
}

func (Image) Copy added in v1.0.5

func (q Image) Copy(copyRef func(reference Reference) Reference) Object

func (*Image) Read added in v1.0.5

func (q *Image) Read(dict Dictionary) error

func (Image) ToRawBytes

func (q Image) ToRawBytes() []byte

type IndirectObject

type IndirectObject struct {
	Number     int
	Generation int
	Data       Object
}

type InformationDictionary

type InformationDictionary struct {
	// (Optional; PDF 1.1) The document’s title.
	Title String

	// (Optional) The name of the person who created the document.
	Author String

	// (Optional; PDF 1.1) The subject of the document.
	Subject String

	// (Optional; PDF 1.1) Keywords associated with the document.
	Keywords String

	// (Optional) If the document was converted to PDF from another format, the
	// name of the application (for example, Adobe FrameMaker®) that created the
	// original document from which it was converted.
	Creator String

	// (Optional) If the document was converted to PDF from another format, the
	// name of the application (for example, Acrobat Distiller) that converted it to
	// PDF.
	Producer String

	// (Optional) The date and time the document was created, in human-readable
	// form (see Section 3.8.2, “Dates”).
	CreationDate Date

	// (Optional; PDF 1.1) The date and time the document was most recently
	// modified, in human-readable form (see Section 3.8.2, “Dates”).
	ModDate Date

	// (Optional; PDF 1.3) A name object indicating whether the document has
	// been modified to include trapping information (see Section 9.10.5, “Trap-
	// ping Support”):
	Trapped Name
}

func (*InformationDictionary) Read added in v1.0.7

func (q *InformationDictionary) Read(dict Dictionary) error

func (InformationDictionary) ToRawBytes

func (q InformationDictionary) ToRawBytes() []byte

type Int

type Int int

func (Int) Copy added in v1.0.5

func (q Int) Copy(_ func(reference Reference) Reference) Object

func (Int) ToRawBytes

func (q Int) ToRawBytes() []byte

type Name

type Name string

func (Name) Copy added in v1.0.5

func (q Name) Copy(_ func(reference Reference) Reference) Object

func (Name) ToRawBytes

func (q Name) ToRawBytes() []byte

type NameDictionary

type NameDictionary struct {
	// (Optional; PDF 1.2) A name tree mapping name strings to destinations (see
	// “Named Destinations” on page 476).
	Dests Object

	// (Optional; PDF 1.3) A name tree mapping name strings to annotation
	// appearance streams (see Section 8.4.4, “Appearance Streams”).
	AP Object

	// (Optional; PDF 1.3) A name tree mapping name strings to document-level
	// JavaScript® actions (see “JavaScript Actions” on page 556).
	JavaScript Object

	// (Optional; PDF 1.3) A name tree mapping name strings to visible pages for
	// use in interactive forms (see Section 8.6.5, “Named Pages”).
	Pages Object

	// (Optional; PDF 1.3) A name tree mapping name strings to invisible (tem-
	// plate) pages for use in interactive forms (see Section 8.6.5, “Named Pages”).
	Templates Object

	// (Optional; PDF 1.3) A name tree mapping digital identifiers to Web Capture
	// content sets (see Section 9.9.3, “Content Sets”).
	IDS Object

	// (Optional; PDF 1.3) A name tree mapping uniform resource locators (URLs)
	// to Web Capture content sets (see Section 9.9.3, “Content Sets”).
	URLS Object

	// (Optional; PDF 1.4) A name tree mapping name strings to embedded file
	// streams (see Section 3.10.3, “Embedded File Streams”).
	EmbeddedFiles Object
}

func (NameDictionary) Copy added in v1.0.5

func (q NameDictionary) Copy(copyRef func(reference Reference) Reference) Object

func (NameDictionary) ToRawBytes

func (q NameDictionary) ToRawBytes() []byte

type NameTree

type NameTree struct {
	// (Root and intermediate nodes only; required in intermediate nodes; present in the root node
	// if and only if Names is not present) An array of indirect references to the immediate chil-
	// dren of this node. The children may be intermediate or leaf nodes.
	Kids Array

	// (Root and leaf nodes only; required in leaf nodes; present in the root node if and only if Kids
	// is not present) An array of the form
	// [key1 value1 key2 value2 ... keyn valuen]
	// where each keyi is a string and the corresponding valuei is an indirect reference to the
	// object associated with that key. The keys are sorted in lexical order, as described below.
	Names Array

	// (Intermediate and leaf nodes only; required) An array of two strings, specifying the (lexi-
	// cally) least and greatest keys included in the Names array of a leaf node or in the Names
	// arrays of any leaf nodes that are descendants of an intermediate node.
	Limits Array
}

func (NameTree) Copy added in v1.0.5

func (q NameTree) Copy(copyRef func(reference Reference) Reference) Object

func (NameTree) ToRawBytes

func (q NameTree) ToRawBytes() []byte

type Null

type Null struct{}

func (Null) Copy added in v1.0.5

func (q Null) Copy(_ func(reference Reference) Reference) Object

func (Null) ToRawBytes

func (q Null) ToRawBytes() []byte

type Number

type Number float64

func (Number) Copy added in v1.0.5

func (q Number) Copy(_ func(reference Reference) Reference) Object

func (Number) ToRawBytes

func (q Number) ToRawBytes() []byte

type NumberTree

type NumberTree struct {
	// (Root and intermediate nodes only; required in intermediate nodes; present in the root node
	// if and only if Names is not present) An array of indirect references to the immediate chil-
	// dren of this node. The children may be intermediate or leaf nodes.
	Kids Array

	// (Root and leaf nodes only; required in leaf nodes; present in the root node if and only if Kids
	// is not present) An array of the form
	// [key1 value1 key2 value2 ... keyn valuen]
	// where each keyi is a string and the corresponding valuei is an indirect reference to the
	// object associated with that key. The keys are sorted in lexical order, as described below.
	Names Array

	// (Intermediate and leaf nodes only; required) An array of two strings, specifying the (lexi-
	// cally) least and greatest keys included in the Names array of a leaf node or in the Names
	// arrays of any leaf nodes that are descendants of an intermediate node.
	Limits Array
}

func (NumberTree) Copy added in v1.0.5

func (q NumberTree) Copy(copyRef func(reference Reference) Reference) Object

func (NumberTree) ToRawBytes

func (q NumberTree) ToRawBytes() []byte

type Object

type Object interface {
	ToRawBytes() []byte
}

func Copy added in v1.0.5

func Copy(obj Object, copyRef func(reference Reference) Reference) Object

type PDFFile added in v1.0.5

type PDFFile interface {
	AddObject(obj Object) Reference
	GetObject(ref Reference) (Object, error)
}

type Page

type Page struct {

	// (Required; must be an indirect reference) The page tree node that is the im-
	// mediate parent of this page object.
	Parent Reference

	// Required if PieceInfo is present; optional otherwise; PDF 1.3) The date and
	// time (see Section 3.8.2, “Dates”) when the page’s contents were most re-
	// cently modified. If a page-piece dictionary (PieceInfo) is present, the
	// modification date is used to ascertain which of the application data dic-
	// tionaries that it contains correspond to the current content of the page
	// (see Section 9.4, “Page-Piece Dictionaries”).
	LastModified Date

	// (Required; inheritable) A dictionary containing any resources required by
	// the page (see Section 3.7.2, “Resource Dictionaries”). If the page requires
	// no resources, the value of this entry should be an empty dictionary; omit-
	// ting the entry entirely indicates that the resources are to be inherited from
	// an ancestor node in the page tree.
	Resources Object

	// (Required; inheritable) A rectangle (see Section 3.8.3, “Rectangles”), ex-
	// pressed in default user space units, defining the boundaries of the physical
	// medium on which the page is intended to be displayed or printed (see
	// Section 9.10.1, “Page Boundaries”).
	MediaBox Rectangle

	// (Optional; inheritable) A rectangle, expressed in default user space units,
	// defining the visible region of default user space. When the page is dis-
	// played or printed, its contents are to be clipped (cropped) to this rectangle
	// and then imposed on the output medium in some implementation-
	// defined manner (see Section 9.10.1, “Page Boundaries”). Default value:
	// the value of MediaBox.
	CropBox *Rectangle

	// (Optional; PDF 1.3) A rectangle, expressed in default user space units, de-
	// fining the region to which the contents of the page should be clipped
	// when output in a production environment (see Section 9.10.1, “Page
	// Boundaries”). Default value: the value of CropBox.
	BleedBox *Rectangle

	// (Optional; PDF 1.3) A rectangle, expressed in default user space units, de-
	// fining the intended dimensions of the finished page after trimming (see
	// Section 9.10.1, “Page Boundaries”). Default value: the value of CropBox.
	TrimBox *Rectangle

	// (Optional; PDF 1.3) A rectangle, expressed in default user space units, de-
	// fining the extent of the page’s meaningful content (including potential
	// white space) as intended by the page’s creator (see Section 9.10.1, “Page
	// Boundaries”). Default value: the value of CropBox.
	ArtBox *Rectangle

	// (Optional) A box color information dictionary specifying the colors and
	// other visual characteristics to be used in displaying guidelines on the
	// screen for the various page boundaries (see “Display of Page Boundaries”
	// on page 679). If this entry is absent, the viewer application should use its
	// own current default settings.
	BoxColorInfo Object

	// (Optional) A content stream (see Section 3.7.1, “Content Streams”) de-
	// scribing the contents of this page. If this entry is absent, the page is empty.
	// The value may be either a single stream or an array of streams. If it is an
	// array, the effect is as if all of the streams in the array were concatenated, in
	// order, to form a single stream. This allows a program generating a PDF
	// file to create image objects and other resources as they occur, even though
	// they interrupt the content stream. The division between streams may
	// occur only at the boundaries between lexical tokens (see Section 3.1, “Lex-
	// ical Conventions”), but is unrelated to the page’s logical content or orga-
	// nization. Applications that consume or produce PDF files are not required
	// to preserve the existing structure of the Contents array. (See implementa-
	// tion note 22 in Appendix H.)
	Contents Object

	// (Optional; inheritable) The number of degrees by which the page should
	// be rotated clockwise when displayed or printed. The value must be a mul-
	// tiple of 90. Default value: 0.
	Rotate Int

	// (Optional; PDF 1.4) A group attributes dictionary specifying the attributes
	//of the page’s page group for use in the transparent imaging model (see
	//Sections 7.3.6, “Page Group,” and 7.5.5, “Transparency Group XObjects”).
	Group Object

	// (Optional) A stream object defining the page’s thumbnail image (see Sec-
	// tion 8.2.3, “Thumbnail Images”).
	Thumb Object

	// (Optional; PDF 1.1; recommended if the page contains article beads) An ar-
	// ray of indirect references to article beads appearing on the page (see Sec-
	// tion 8.3.2, “Articles”; see also implementation note 23 in Appendix H).
	// The beads are listed in the array in natural reading order.
	B Array

	// (Optional; PDF 1.1) The page’s display duration (also called its advance
	// timing): the maximum length of time, in seconds, that the page will be
	// displayed during presentations before the viewer application automati-
	// cally advances to the next page (see Section 8.3.3, “Presentations”). By
	// default, the viewer does not advance automatically.
	Dur Number

	// (Optional; PDF 1.1) A transition dictionary describing the transition effect
	// to be used when displaying the page during presentations (see Section
	// 8.3.3, “Presentations”).
	Trans Object

	// (Optional) An array of annotation dictionaries representing annotations
	// associated with the page (see Section 8.4, “Annotations”).
	Annots Array

	// (Optional; PDF 1.2) An additional-actions dictionary defining actions to
	// be performed when the page is opened or closed (see Section 8.5.2, “Trig-
	// ger Events”; see also implementation note 24 in Appendix H).
	AA Object

	// (Optional; PDF 1.4) A metadata stream containing metadata for the page
	// (see Section 9.2.2, “Metadata Streams”).
	Metadata Object

	// (Optional; PDF 1.3) A page-piece dictionary associated with the page (see
	// Section 9.4, “Page-Piece Dictionaries”).
	PieceInfo Object

	// (Required if the page contains structural content items; PDF 1.3) The inte-
	// ger key of the page’s entry in the structural parent tree (see “Finding Struc-
	// ture Elements from Content Items” on page 600).
	StructParents Int

	// (Optional; PDF 1.3; indirect reference preferred) The digital identifier of the
	// page’s parent Web Capture content set (see Section 9.9.5, “Object At-
	// tributes Related to Web Capture”).
	ID String

	// (Optional; PDF 1.3) The page’s preferred zoom (magnification) factor: the
	// factor by which it should be scaled to achieve the “natural” display magni-
	// fication (see Section 9.9.5, “Object Attributes Related to Web Capture”).
	PZ Number

	// (Optional; PDF 1.3) A separation dictionary containing information need-
	// ed to generate color separations for the page (see Section 9.10.3, “Separa-
	// tion Dictionaries”).
	SeparationInfo Object
}

func (*Page) Read added in v1.0.5

func (q *Page) Read(dict Dictionary) error

func (Page) ToRawBytes

func (q Page) ToRawBytes() []byte

type PageTreeNode

type PageTreeNode struct {

	// (Required except in root node; must be an indirect reference) The page tree node that
	// is the immediate parent of this one.
	Parent Reference

	// (Required) An array of indirect references to the immediate children of this node.
	// The children may be page objects or other page tree nodes.
	Kids []Reference

	// (Required) The number of leaf nodes (page objects) that are descendants of this
	// node within the page tree.
	Count Int
}

func (*PageTreeNode) Read added in v1.0.5

func (q *PageTreeNode) Read(dict Dictionary) error

func (PageTreeNode) ToRawBytes

func (q PageTreeNode) ToRawBytes() []byte

type ProcedureSet

type ProcedureSet Name
const (
	ProcSetPDF    ProcedureSet = "PDF"
	ProcSetText   ProcedureSet = "Text"
	ProcSetImageB ProcedureSet = "ImageB"
	ProcSetImageC ProcedureSet = "ImageC"
	ProcSetImageI ProcedureSet = "ImageI"
)

func (ProcedureSet) Copy added in v1.0.5

func (q ProcedureSet) Copy(_ func(reference Reference) Reference) Object

func (ProcedureSet) ToRawBytes

func (q ProcedureSet) ToRawBytes() []byte

type RawIndirectObject

type RawIndirectObject struct {
	Number     int
	Generation int
	Data       []byte
}

func (RawIndirectObject) ToRawBytes

func (q RawIndirectObject) ToRawBytes() []byte

type Rectangle

type Rectangle struct {
	LLX Number
	LLY Number
	URX Number
	URY Number
}

func (Rectangle) Copy added in v1.0.5

func (q Rectangle) Copy(copyRef func(reference Reference) Reference) Object

func (*Rectangle) Read added in v1.0.5

func (q *Rectangle) Read(arr Array) error

func (Rectangle) ToRawBytes

func (q Rectangle) ToRawBytes() []byte

type Reference

type Reference struct {
	Number     int
	Generation int
}

func (Reference) Copy added in v1.0.5

func (q Reference) Copy(copyRef func(reference Reference) Reference) Object

func (Reference) ToRawBytes

func (q Reference) ToRawBytes() []byte

type RenderingMode

type RenderingMode int
const (
	RenderingModeFill                 RenderingMode = 0
	RenderingModeStroke               RenderingMode = 1
	RenderingModeFillAndStroke        RenderingMode = 2
	RenderingModeNeither              RenderingMode = 3
	RenderingModeFillAndClip          RenderingMode = 4
	RenderingModeStrokeAndClip        RenderingMode = 5
	RenderingModeFillAndStrokeAndClip RenderingMode = 6
	RenderingModeClip                 RenderingMode = 7
)

type ResourceDictionary

type ResourceDictionary struct {
	// (Optional) A dictionary mapping resource names to graphics state parameter
	// dictionaries (see Section 4.3.4, “Graphics State Parameter Dictionaries”).
	ExtGState Object

	// (Optional) A dictionary mapping each resource name to either the name of a
	// device-dependent color space or an array describing a color space (see Sec-
	// tion 4.5, “Color Spaces”).
	ColorSpace Object

	// (Optional) A dictionary mapping resource names to pattern objects (see Sec-
	// tion 4.6, “Patterns”).
	Pattern Object

	// (Optional; PDF 1.3) A dictionary mapping resource names to shading dic-
	// tionaries (see “Shading Dictionaries” on page 233).
	Shading Object

	// (Optional) A dictionary mapping resource names to external objects (see Sec-
	// tion 4.7, “External Objects”)
	XObject Object

	// (Optional) A dictionary mapping resource names to font dictionaries (see
	// Chapter 5).
	Font Object

	// (Optional) An array of predefined procedure set names (see Section 9.1,
	// “Procedure Sets”).
	ProcSet Object

	// (Optional; PDF 1.2) A dictionary mapping resource names to property list
	// dictionaries for marked content (see Section 9.5.1, “Property Lists”).
	Properties Object
}

func (ResourceDictionary) Copy added in v1.0.25

func (q ResourceDictionary) Copy(copyRef func(reference Reference) Reference) Object

func (*ResourceDictionary) Read added in v1.0.5

func (q *ResourceDictionary) Read(dict Dictionary) error

func (ResourceDictionary) ToRawBytes

func (q ResourceDictionary) ToRawBytes() []byte

type StandardFont

type StandardFont struct {
	// Type
	// Subtype   FontSubType  // Required
	BaseFont StandardFontName // Required
	Encoding Encoding         // Name or dictionary, Optional
}

func (StandardFont) Copy added in v1.0.5

func (q StandardFont) Copy(copyRef func(reference Reference) Reference) Object

func (StandardFont) Metrics

func (q StandardFont) Metrics() (*afm.Font, error)

Metrics returns font metrics from the embedded afm files

func (*StandardFont) Read added in v1.0.13

func (q *StandardFont) Read(dict Dictionary) error

func (StandardFont) ToRawBytes

func (q StandardFont) ToRawBytes() []byte

type StandardFontName

type StandardFontName Name
const (
	StandardFont_Helvetica            StandardFontName = "Helvetica"
	StandardFont_HelveticaBold        StandardFontName = "Helvetica-Bold"
	StandardFont_HelveticaOblique     StandardFontName = "Helvetica-Oblique"
	StandardFont_HelveticaBoldOblique StandardFontName = "Helvetica-BoldOblique"
	StandardFont_TimesRoman           StandardFontName = "Times-Roman"
	StandardFont_TimesBold            StandardFontName = "Times-Bold"
	StandardFont_TimesItalic          StandardFontName = "Times-Italic"
	StandardFont_TimesBoldItalic      StandardFontName = "Times-BoldItalic"
	StandardFont_Courier              StandardFontName = "Courier"
	StandardFont_CourierBold          StandardFontName = "Courier-Bold"
	StandardFont_CourierOblique       StandardFontName = "Courier-Oblique"
	StandardFont_CourierBoldOblique   StandardFontName = "Courier-BoldOblique"
	StandardFont_Symbol               StandardFontName = "Symbol"
	StandardFont_ZapfDingbats         StandardFontName = "ZapfDingbats"
)

func (StandardFontName) Copy added in v1.0.5

func (q StandardFontName) Copy(_ func(reference Reference) Reference) Object

func (StandardFontName) ToRawBytes

func (q StandardFontName) ToRawBytes() []byte

type StandardSecurityHandler

type StandardSecurityHandler struct {
	EncryptionDictionary

	// (Required) A number specifying which revision of the standard security handler should
	// be used to interpret this dictionary. The revision number should be 2 if the document is
	// encrypted with a V value less than 2 (see Table 3.13) and does not have any of the access
	// permissions set (via the P entry, below) that are designated “Revision 3” in Table 3.15;
	// otherwise (that is, if the document is encrypted with a V value greater than 2 or has any
	// “Revision 3” access permissions set), this value should be 3.
	R Number

	// (Required) A 32-byte string, based on both the owner and user passwords, that is used in
	// computing the encryption key and in determining whether a valid owner password was
	// entered. For more information, see “Encryption Key Algorithm” on page 78 and “Pass-
	// word Algorithms” on page 79.
	O String

	// (Required) A 32-byte string, based on the user password, that is used in determining
	// whether to prompt the user for a password and, if so, whether a valid user or owner pass-
	// word was entered. For more information, see “Password Algorithms” on page 79.
	U String

	// (Required) A set of flags specifying which operations are permitted when the document is
	// opened with user access (see Table 3.15).
	P Int
}

func (StandardSecurityHandler) ToRawBytes

func (q StandardSecurityHandler) ToRawBytes() []byte

type StreamDictionary added in v1.0.5

type StreamDictionary struct {
	// (Required) The number of bytes from the beginning of the line fol-
	// lowing the keyword stream to the last byte just before the keyword
	// endstream. (There may be an additional EOL marker, preceding
	// endstream, that is not included in the count and is not logically part
	// of the stream data.) See “Stream Extent,” above, for further discus-
	// sion.
	Length int

	// (Optional) The name of a filter to be applied in processing the stream
	// data found between the keywords stream and endstream, or an array
	// of such names. Multiple filters should be specified in the order in
	// which they are to be applied.
	Filter []Filter // name or array

	// (Optional) A parameter dictionary, or an array of such dictionaries,
	// used by the filters specified by Filter. If there is only one filter and that
	// filter has parameters, DecodeParms must be set to the filter’s parame-
	// ter dictionary unless all the filter’s parameters have their default
	// values, in which case the DecodeParms entry may be omitted. If there
	// are multiple filters and any of the filters has parameters set to non-
	// default values, DecodeParms must be an array with one entry for
	// each filter: either the parameter dictionary for that filter, or the null
	// object if that filter has no parameters (or if all of its parameters have
	// their default values). If none of the filters have parameters, or if all
	// their parameters have default values, the DecodeParms entry may be
	// omitted. (See implementation note 7 in Appendix H.)
	DecodeParms Object // dictionary or array

	// (Optional; PDF 1.2) The file containing the stream data. If this entry
	// is present, the bytes between stream and endstream are ignored, the
	// filters are specified by FFilter rather than Filter, and the filter parame-
	// ters are specified by FDecodeParms rather than DecodeParms. How-
	// ever, the Length entry should still specify the number of those bytes.
	// (Usually there are no bytes and Length is 0.)
	F Object // file specification

	// (Optional; PDF 1.2) The name of a filter to be applied in processing
	// the data found in the stream’s external file, or an array of such names.
	// The same rules apply as for Filter.
	FFilter []Filter // name or array

	// (Optional; PDF 1.2) A parameter dictionary, or an array of such dic-
	// tionaries, used by the filters specified by FFilter. The same rules apply
	// as for DecodeParms.
	FDecodeParms Object // dictionary or array
}

func (StreamDictionary) Copy added in v1.0.5

func (q StreamDictionary) Copy(copyRef func(reference Reference) Reference) Object

func (*StreamDictionary) Read added in v1.0.5

func (q *StreamDictionary) Read(dict Dictionary) error

func (StreamDictionary) ToRawBytes added in v1.0.5

func (q StreamDictionary) ToRawBytes() []byte

type StreamFont

type StreamFont struct {
	Dictionary Dictionary
	Stream     []byte

	// (Required for Type 1 and TrueType fonts) The length in bytes of the clear-text portion
	// of the Type 1 font program (see below), or the entire TrueType font program, after it
	// has been decoded using the filters specified by the stream’s Filter entry, if any.
	Length1 Int

	// (Required for Type 1 fonts) The length in bytes of the encrypted portion of the Type 1
	// font program (see below) after it has been decoded using the filters specified by the
	// stream’s Filter entry.
	Length2 Int

	// (Required for Type 1 fonts) The length in bytes of the fixed-content portion of the
	// Type 1 font program (see below), after it has been decoded using the filters specified
	// by the stream’s Filter entry. If Length3 is 0, it indicates that the 512 zeros and clearto-
	// mark have not been included in the FontFile font program and must be added.
	Length3 Int

	// (Required if referenced from FontFile3; PDF 1.2) A name specifying the format of the
	// embedded font program. The name must be Type1C for Type 1 compact fonts or CID-
	// FontType0C for Type 0 compact CIDFonts. When additional font formats are added
	// to PDF, more values will be defined for Subtype.
	Subtype Name

	// (Optional; PDF 1.4) A metadata stream containing metadata for the embedded font
	// program (see Section 9.2.2, “Metadata Streams”).
	Metadata Object
}

func (StreamFont) Copy added in v1.0.5

func (q StreamFont) Copy(copyRef func(reference Reference) Reference) Object

func (StreamFont) ToRawBytes

func (q StreamFont) ToRawBytes() []byte

type StreamObject added in v1.0.5

type StreamObject struct {
	Dictionary Object
	Stream     []byte
}

func NewStream

func NewStream(data []byte, filters ...Filter) (StreamObject, error)

func (StreamObject) Copy added in v1.0.5

func (q StreamObject) Copy(copyRef func(reference Reference) Reference) Object

func (*StreamObject) Decode added in v1.0.25

func (q *StreamObject) Decode() ([]byte, error)

func (StreamObject) ToRawBytes added in v1.0.5

func (q StreamObject) ToRawBytes() []byte

type String

type String string

func (String) Copy added in v1.0.5

func (q String) Copy(_ func(reference Reference) Reference) Object

func (String) ToRawBytes

func (q String) ToRawBytes() []byte

type TextState

type TextState struct {
	Tc    float64       // Character spacing
	Tw    float64       // Word spacing
	Th    float64       // Horizontal scaling
	Tl    float64       // Leading
	Tf    Name          // Text font
	Tfs   float64       // Text font size
	Tmode RenderingMode // Text rendering mode
	Trise float64       // Text rise
	Tk    float64       // Text knockout
}

func NewTextState

func NewTextState() *TextState

type TextString

type TextString string

func (TextString) Copy added in v1.0.5

func (q TextString) Copy(_ func(reference Reference) Reference) Object

func (TextString) ToRawBytes

func (q TextString) ToRawBytes() []byte

type Trailer

type Trailer struct {
	// (Required) The total number of entries in the file’s cross-reference table, as defined
	// by the combination of the original section and all update sections. Equivalently, this
	// value is 1 greater than the highest object number used in the file.
	Size int

	// (Present only if the file has more than one cross-reference section) The byte offset from
	// the beginning of the file to the beginning of the previous cross-reference section
	Prev Int // todo: unclear: (Present only if the pdffile has more than one cross-reference section) The byte offset from the beginning of the pdffile to the beginning of the previous cross-reference section.

	// (Required; must be an indirect reference) The catalog dictionary for the PDF docu-
	// ment contained in the file (see Section 3.6.1, “Document Catalog”).
	Root Reference

	// (Required if document is encrypted; PDF 1.1) The document’s encryption dictionary
	// (see Section 3.5, “Encryption”).
	Encrypt Object

	// (Optional; must be an indirect reference) The document’s information dictionary
	// (see Section 9.2.1, “Document Information Dictionary”).
	Info Reference

	// (Optional; PDF 1.1) An array of two strings constituting a file identifier (see Section
	// 9.3, “File Identifiers”) for the file.
	ID [2]String
}

func (*Trailer) Read added in v1.0.5

func (q *Trailer) Read(dict Dictionary) error

func (*Trailer) ToRawBytes

func (q *Trailer) ToRawBytes() []byte

type Type0Font

type Type0Font struct {

	// (Required) The PostScript name of the font. In principle, this is an arbitrary
	// name, since there is no font program associated directly with a Type 0 font
	// dictionary. The conventions described here ensure maximum compatibility
	// with existing Acrobat products.
	// If the descendant is a Type 0 CIDFont, this name should be the concatenation
	// of the CIDFont’s BaseFont name, a hyphen, and the CMap name given in the
	// Encoding entry (or the CMapName entry in the CMap program itself). If the
	// descendant is a Type 2 CIDFont, this name should be the same as the
	// CIDFont’s BaseFont name.
	BaseFont Name

	// (Required) The name of a predefined CMap, or a stream containing a CMap
	// stream program, that maps character codes to font numbers and CIDs. If the descen-
	// dant is a Type 2 CIDFont whose associated TrueType font program is not em-
	// bedded in the PDF file, the Encoding entry must be a predefined CMap name
	// (see “Glyph Selection in CIDFonts” on page 339).
	Encoding Object // name or dictionary

	// (Required) An array specifying one or more fonts or CIDFonts that are
	// descendants of this composite font. This array is indexed by the font number
	// that is obtained by mapping a character code through the CMap specified in
	// the Encoding entry.
	// Note: In all PDF versions up to and including PDF 1.4, DescendantFonts must
	// be a one-element array containing a CIDFont dictionary.
	DescendantFonts Object // Array or Reference

	// (Optional) A stream containing a CMap file that maps character codes to
	// Unicode values (see Section 5.9, “ToUnicode CMaps”).
	ToUnicode Reference
}

func (Type0Font) Copy added in v1.0.5

func (q Type0Font) Copy(copyRef func(reference Reference) Reference) Object

func (*Type0Font) Read added in v1.0.5

func (q *Type0Font) Read(dict Dictionary) error

func (Type0Font) ToRawBytes

func (q Type0Font) ToRawBytes() []byte

type Type3Font added in v1.0.5

type Type3Font struct {

	//	(Required in PDF 1.0; optional otherwise) See Table 5.8 on page 317.
	Name Name

	//	(Required) A rectangle (see Section 3.8.3, “Rectangles”), expressed in the
	//	glyph coordinate system, specifying the font bounding box. This is the small-
	//	est rectangle enclosing the shape that would result if all of the glyphs of the
	//	font were placed with their origins coincident and then filled.
	//	If all four elements of the rectangle are zero, no assumptions are made based
	//	on the font bounding box. If any element is nonzero, it is essential that the
	//	font bounding box be accurate; if any glyph’s marks fall outside this bound-
	//	ing box, incorrect behavior may result.
	FontBBox Rectangle

	//	(Required) An array of six numbers specifying the font matrix, mapping
	//	glyph space to text space (see Section 5.1.3, “Glyph Positioning and
	//	Metrics”). A common practice is to define glyphs in terms of a 1000-unit
	//	glyph coordinate system, in which case the font matrix is
	// [0.001 0 0 0.001 0 0].
	FontMatrix Array

	//	(Required) A dictionary in which each key is a character name and the value
	//	associated with that key is a content stream that constructs and paints the
	//	glyph for that character. The stream must include as its first operator either
	//	d0 or d1. This is followed by operators describing one or more graphics
	//	objects, which may include path, text, or image objects. See below for more
	//	details about Type 3 glyph descriptions.
	CharProcs Object

	//	(Required) An encoding dictionary whose Differences array specifies the
	//	complete character encoding for this font (see Section 5.5.5, “Character
	//	Encoding”; also see implementation note 46 in Appendix H).
	Encoding Object

	//	(Required) The first character code defined in the font’s Widths array.
	FirstChar Int

	//	(Required) The last character code defined in the font’s Widths array.
	LastChar Int

	//	(Required; indirect reference preferred) An array of (LastChar − FirstChar + 1)
	//	widths, each element being the glyph width for the character whose code is
	//	FirstChar plus the array index. For character codes outside the range FirstChar
	//	to LastChar, the width is 0. These widths are interpreted in glyph space as
	//	specified by FontMatrix (unlike the widths of a Type 1 font, which are in
	//	thousandths of a unit of text space).
	//	Note: If FontMatrix specifies a rotation, only the horizontal component of the
	//	transformed width is used. That is, the resulting displacement is always horizon-
	//	tal in text space, as is the case for all simple fonts.
	Widths Object

	//	(Optional but strongly recommended; PDF 1.2) A list of the named resources,
	//	such as fonts and images, required by the glyph descriptions in this font (see
	//	Section 3.7.2, “Resource Dictionaries”). If any glyph descriptions refer to
	//	named resources but this dictionary is absent, the names are looked up in the
	//	resource dictionary of the page on which the font is used. (See implementa-
	//	tion note 47 in Appendix H.)
	Resources Object

	//	(Optional; PDF 1.2) A stream containing a CMap file that maps character
	//	codes to Unicode values (see Section 5.9, “ToUnicode CMaps”).
	ToUnicode Reference
}

func (Type3Font) Copy added in v1.0.5

func (q Type3Font) Copy(copyRef func(reference Reference) Reference) Object

func (*Type3Font) Read added in v1.0.5

func (q *Type3Font) Read(dict Dictionary) error

func (Type3Font) ToRawBytes added in v1.0.5

func (q Type3Font) ToRawBytes() []byte

Directories

Path Synopsis
standardfont
afm
Package afm implements a decoder for AFM (Adobe Font Metrics) files.
Package afm implements a decoder for AFM (Adobe Font Metrics) files.
fixed
Package fixed provides types to work with fixed-point numbers.
Package fixed provides types to work with fixed-point numbers.

Jump to

Keyboard shortcuts

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