Documentation ¶
Overview ¶
Implements the in-memory structure of a PDF document, using static types. The structure is not exactly the one found or written in a PDF, but it serves as an intermediate representation to facilitate PDF construction and modification. Still, this library supports the majority of the PDF specification.
This package aims at being used without having to think (to much) of the PDF implementations details. In particular, unless stated otherwise, all the strings should be UTF-8 encoded. The library will take care to encode them when needed. They are a few exceptions, where ASCII strings are required: it is then up to the user to make sure the given string is ASCII.
The entry point of the package is the type `Document`.
Index ¶
- Constants
- Variables
- func DateTimeString(t time.Time) string
- func EscapeByteString(sb []byte) string
- func EspaceHexString(sb []byte) string
- func FmtFloat(f Fl) string
- func FunctionEncodeRepeat(k int) [][2]Fl
- func IsString(o Object) (string, bool)
- func PdfDocEncodingToString(b []byte) string
- type AESSecurityHandler
- type AcroForm
- type Action
- type ActionEmbeddedGoTo
- type ActionGoTo
- type ActionHide
- type ActionHideTarget
- type ActionJavaScript
- type ActionNamed
- type ActionRemoteGoTo
- type ActionRendition
- type ActionType
- type ActionURI
- type AlternateImage
- type Annotation
- type AnnotationAdditionalActions
- type AnnotationCircle
- type AnnotationDict
- type AnnotationFileAttachment
- type AnnotationFlag
- type AnnotationFreeText
- type AnnotationLine
- type AnnotationLink
- type AnnotationMarkup
- type AnnotationPopup
- type AnnotationScreen
- type AnnotationSquare
- type AnnotationText
- type AnnotationWidget
- type AppearanceCharacteristics
- type AppearanceDict
- type AppearanceEntry
- type AppearanceTree
- type AttributeObject
- type AttributeUserProperties
- type BaseAnnotation
- type BaseGradient
- type Border
- type BorderEffect
- type BorderStyle
- type CID
- type CIDFontDictionary
- type CIDSystemInfo
- type CIDToGIDMap
- type CIDToGIDMapIdentity
- type CIDToGIDMapStream
- type CIDVerticalMetric
- type CIDVerticalMetricArray
- type CIDVerticalMetricRange
- type CIDWidth
- type CIDWidthArray
- type CIDWidthRange
- type CMapEncoding
- type CMapEncodingEmbedded
- type CMapEncodingPredefined
- type Catalog
- type CertDict
- type CertFlag
- type ClassName
- type Color
- type ColorSpace
- type ColorSpaceCalGray
- type ColorSpaceCalRGB
- type ColorSpaceDeviceN
- type ColorSpaceDeviceNAttributes
- type ColorSpaceDeviceNMixingHints
- type ColorSpaceDeviceNProcess
- type ColorSpaceICCBased
- type ColorSpaceIndexed
- type ColorSpaceLab
- type ColorSpaceName
- type ColorSpaceSeparation
- type ColorSpaceUncoloredPattern
- type ColorTable
- type ColorTableBytes
- type ColorTableStream
- type ContentItem
- type ContentItemMarkedReference
- type ContentItemObjectReference
- type ContentMarkedContainer
- type ContentStream
- type CrypFilter
- type DashPattern
- type DestTree
- type Destination
- type DestinationExplicit
- type DestinationExplicitExtern
- type DestinationExplicitIntern
- type DestinationLocation
- type DestinationLocationFit
- type DestinationLocationFitDim
- type DestinationLocationFitR
- type DestinationLocationXYZ
- type DestinationName
- type DestinationString
- type Differences
- type Document
- func (doc *Document) Clone() Document
- func (d Document) UseStandardEncryptionHandler(enc Encrypt, ownerPassword, userPassword string, encryptMetadata bool) Encrypt
- func (doc *Document) Write(output io.Writer, encryption *Encrypt) error
- func (doc *Document) WriteFile(filename string, encryption *Encrypt) error
- type EmbeddedFileParams
- type EmbeddedFileStream
- type EmbeddedFileTree
- type EmbeddedTarget
- type EmbeddedTargetAnnot
- type EmbeddedTargetAnnotIndex
- type EmbeddedTargetAnnotNamed
- type EmbeddedTargetDest
- type EmbeddedTargetDestNamed
- type EmbeddedTargetDestPage
- type Encrypt
- type EncryptionAlgorithm
- type EncryptionHandler
- type EncryptionPublicKey
- type EncryptionStandard
- type Extensions
- type FileSpec
- type Filter
- type Filters
- type Fl
- type Font
- type FontDescriptor
- type FontDict
- type FontFile
- type FontFlag
- type FontSimple
- type FontStyle
- type FontTrueType
- type FontType0
- type FontType1
- type FontType3
- type FormFielAdditionalActions
- type FormField
- type FormFieldButton
- type FormFieldChoice
- type FormFieldDict
- type FormFieldInheritable
- type FormFieldInherited
- type FormFieldSignature
- type FormFieldText
- type FormFieldWidget
- type FormFlag
- type Function
- type FunctionDict
- type FunctionExpInterpolation
- type FunctionPostScriptCalculator
- type FunctionSampled
- type FunctionStitching
- type GraphicState
- type HideTargetFormName
- type Highlighting
- type IDTree
- type IconFit
- type Image
- type ImageSMask
- type Info
- type LanguageArray
- type LockDict
- type MarkDict
- type Mask
- type MaskColor
- type Matrix
- type MaybeBool
- type MaybeFloat
- type MaybeInt
- type MediaBitDepth
- type MediaClip
- type MediaClipData
- type MediaClipDataContent
- type MediaClipDict
- type MediaClipPermission
- type MediaClipSection
- type MediaClipSectionLimits
- type MediaCriteria
- type MediaDuration
- type MediaOffset
- type MediaPlayer
- type MediaPlayerParameters
- type MediaScreen
- type MediaScreenFloatingWindow
- type MediaScreenParams
- type MediaScreenSize
- type MetadataStream
- type Name
- type NameDictionary
- type NameToAppearance
- type NameToDest
- type NameToFile
- type NameToPage
- type NameToStructureElement
- type NumToPageLabel
- type NumToParent
- type ObjArray
- type ObjBool
- type ObjCommand
- type ObjDict
- type ObjFloat
- type ObjHexLiteral
- type ObjIndirectRef
- type ObjInt
- type ObjName
- type ObjNull
- type ObjStream
- type ObjStringLiteral
- type Object
- type Option
- type Outline
- type OutlineFlag
- type OutlineItem
- type OutlineNode
- type PDFStringEncoding
- type PDFWritter
- type PageLabel
- type PageLabelsTree
- type PageNode
- type PageObject
- type PageTree
- type ParentTree
- type Pattern
- type PatternShading
- type PatternTiling
- type PropertyList
- type Quadding
- type RC4SecurityHandler
- type Range
- type Rectangle
- type Reference
- type Referenceable
- type Rendition
- type RenditionDict
- type RenditionMedia
- type RenditionSelector
- type ResourcesColorSpace
- type ResourcesDict
- type Rotation
- type SecuriyHandler
- type SeedDict
- type SeedFlag
- type Shading
- type ShadingAxial
- type ShadingCoons
- type ShadingDict
- type ShadingFreeForm
- type ShadingFunctionBased
- type ShadingLattice
- type ShadingRadial
- type ShadingStream
- type ShadingTensorProduct
- type SignatureDict
- type SignatureFlag
- type SignatureRefDict
- type SimpleEncoding
- type SimpleEncodingDict
- type SimpleEncodingPredefined
- type SoftMaskDict
- type SoftwareIdentifier
- type Stream
- type StreamHeader
- type StructParentObject
- type StructureElement
- type StructureTree
- type TemplateTree
- type TimeStampDict
- type Trailer
- type Transform
- type TransformDocMDP
- type TransformFieldMDP
- type TransformUR
- type UnicodeCMap
- type UnicodeCMapBase
- type UnicodeCMapBasePredefined
- type UserPermissions
- type UserProperty
- type VerticalMetric
- type ViewerPreferences
- type XObject
- type XObjectForm
- type XObjectImage
- type XObjectTransparencyGroup
Constants ¶
const ( RenditionPlay = iota RenditionStop RenditionPause RenditionResume RenditionPlayWithAN )
Variables ¶
var PDFDocEncoding = [256]rune{}/* 256 elements not displayed */
PDFDocEncoding maps the PDFDocEncoding bytes (used to represent text values such as document metadata or annotation text) to Unicode codepoints. Not all 8-bit values in PDFDocEncoding are defined; undefined bytes are mapped to 0
Functions ¶
func DateTimeString ¶
DateTimeString returns a valid PDF string representation of `t`. Note that the string is not encoded (or crypted).
func EscapeByteString ¶
EscapeByteString return a pdf compatible litteral string, by escaping special characters and adding parenthesis.
PDFStringEncoder.EncodeString provides a more general approach, and should be used when implementing custom types.
func EspaceHexString ¶
EspaceHexString return a pdf compatible hex string, by hex encoding it and adding brackets.
PDFStringEncoder.EncodeString provides a more general approach, and should be used when implementing custom types.
func FunctionEncodeRepeat ¶
FunctionEncodeRepeat return a slice of k [0,1] encode domains.
func PdfDocEncodingToString ¶
PdfDocEncodingToString decodes a PDFDocEncoded byte slice `b` to a UTF-8 string.
Types ¶
type AESSecurityHandler ¶
type AESSecurityHandler struct {
// contains filtered or unexported fields
}
AESSecurityHandler stores the various data needed to crypt/decryt a PDF file. It is obtained from user provided passwords and data found in Encrypt dictionnary and file trailer.
func (*AESSecurityHandler) AuthenticatePasswords ¶
func (s *AESSecurityHandler) AuthenticatePasswords(ownerPassword, userPassword string, enc EncryptionStandard) ([]byte, bool)
AuthenticatePasswords compare the given passwords to the hash found in a PDF file, returning `true` if one of the password is correct, as well as the encryption key.
type AcroForm ¶
type AcroForm struct { Fields []*FormFieldDict NeedAppearances bool SigFlags SignatureFlag // optional, default to 0 // (optional) references to field dictionaries with calculation actions, defining // the calculation order in which their values will be recalculated // when the value of any field changes CO []*FormFieldDict DR ResourcesDict // optional DA string // optional Q Quadding // optional, default to 0 }
func (AcroForm) Flatten ¶
func (a AcroForm) Flatten() map[string]FormFieldInherited
Flatten walk the tree of form fields and accumulate them in a map, resolving the inheritance and forming the fully qualified names used as keys of the returned map.
type Action ¶
type Action struct { ActionType // sequence of actions that shall be performed after // the action represented by this dictionary Next []Action }
Action defines the characteristics and behaviour of an action.
type ActionEmbeddedGoTo ¶
type ActionEmbeddedGoTo struct { D Destination // DestinationExplicitIntern are not allowed F *FileSpec // optional NewWindow bool T *EmbeddedTarget // optional if F is present }
type ActionGoTo ¶
type ActionGoTo struct {
D Destination
}
type ActionHide ¶
type ActionHide struct { T []ActionHideTarget Show bool // optional, written in a PDF file as H (hide) }
ActionHide hides or shows one or more annotations
type ActionHideTarget ¶
type ActionHideTarget interface {
// contains filtered or unexported methods
}
ActionHideTarget is either an annotation or a form field
type ActionJavaScript ¶
type ActionJavaScript struct {
JS string // text string, may be found in PDF as stream object
}
type ActionRemoteGoTo ¶
type ActionRemoteGoTo struct { D Destination // DestinationExplicitIntern are not allowed F *FileSpec // must not be embedded NewWindow bool }
ActionRemoteGoTo is either an RemoteGoTo action or a Launch action, when D is nil
type ActionRendition ¶
type ActionRendition struct { R RenditionDict // optional AN *AnnotationDict // optional, must be with type Screen OP MaybeInt // optional, see the RenditionXxx constants JS string // optional, maybe written in PDF a text stream }
ActionRendition controls the playing of multimedia content See 12.6.4.13 - Rendition Actions
type ActionType ¶
type ActionType interface {
// contains filtered or unexported methods
}
ActionType specialize the action (see Table 198 – Action types). Many PDF actions are supported, excepted:
- Thread
- Sound
- Movie
TODO - SubmitForm TODO - ResetForm TODO - ImportData
- SetOCGState
- Rendition
- Trans
- GoTo3DView
type AlternateImage ¶
type AlternateImage struct { Image *XObjectImage DefaultForPrinting bool // optional }
type Annotation ¶
type Annotation interface {
// contains filtered or unexported methods
}
Annotation associates an object such as a note, sound, or movie with a location on a page of a PDF document, or provides a way to interact with the user by means of the mouse and keyboard.
type AnnotationAdditionalActions ¶
type AnnotationAdditionalActions struct { E Action // cursor enters the annotation’s active area. X Action // cursor exits the annotation’s active area. D Action // mouse button is pressed inside the annotation’s active area. U Action // mouse button is released inside the annotation’s active area. Fo Action // the annotation receives the input focus. Bl Action // the annotation loses the input focus. PO Action // the page containing the annotation is opened. PC Action // the page containing the annotation is closed. PV Action // the page containing the annotation becomes visible. PI Action // the page containing the annotation is no longer visible in the conforming reader’s user interface. }
All actions are optional See Table 194 – Entries in an annotation’s additional-actions dictionary.
func (AnnotationAdditionalActions) IsEmpty ¶
func (a AnnotationAdditionalActions) IsEmpty() bool
IsEmpty return `true` if it contains no actions.
type AnnotationCircle ¶
type AnnotationCircle AnnotationSquare
AnnotationCircle displays an ellipse on the page
type AnnotationDict ¶
type AnnotationDict struct { BaseAnnotation Subtype Annotation }
func (*AnnotationDict) GetStructParent ¶
func (a *AnnotationDict) GetStructParent() MaybeInt
GetStructParent implements StructParentObject
func (*AnnotationDict) IsReferenceable ¶
func (*AnnotationDict) IsReferenceable()
type AnnotationFlag ¶
type AnnotationFlag uint16
AnnotationFlag describe the behaviour of an annotation. See Table 165 – Annotation flags
const ( // Do not display the annotation if it does not belong to one of the // standard annotation types and no annotation handler is available. AInvisible AnnotationFlag = 1 << (1 - 1) // Do not display or print the annotation or allow it to // interact with the user, regardless of its annotation type or whether an // annotation handler is available. AHidden AnnotationFlag = 1 << (2 - 1) // Print the annotation when the page is printed. APrint AnnotationFlag = 1 << (3 - 1) // Do not scale the annotation’s appearance to match the // magnification of the page. ANoZoom AnnotationFlag = 1 << (4 - 1) // Do not rotate the annotation’s appearance to match // the rotation of the page. ANoRotate AnnotationFlag = 1 << (5 - 1) // Do not display the annotation on the screen or allow it // to interact with the user. ANoView AnnotationFlag = 1 << (6 - 1) // Do not allow the annotation to interact with the user. AReadOnly AnnotationFlag = 1 << (7 - 1) // Do not allow the annotation to be deleted or its // properties (including position and size) to be modified by the user. ALocked AnnotationFlag = 1 << (8 - 1) // Invert the interpretation of the NoView flag for certain // events. AToggleNoView AnnotationFlag = 1 << (9 - 1) // Do not allow the contents of the annotation to be // modified by the user. ALockedContents AnnotationFlag = 1 << (10 - 1) )
type AnnotationFreeText ¶
type AnnotationFreeText struct { AnnotationMarkup DA string // required Q uint8 // optional RC string // optional, may be written in PDF as a text stream DS string // optional CL []Fl // optional BE *BorderEffect // optional RD Rectangle // optional BS *BorderStyle // optional LE Name // optional }
AnnotationFreeText displays text directly on the page. See Table 174 – Additional entries specific to a free text annotation
type AnnotationLine ¶
type AnnotationLine struct { AnnotationMarkup L [4]Fl // required BS *BorderStyle // optional LE [2]Name // optional IC []Fl // optional LL Fl // optional LLE Fl // optional Cap bool // optional LLO MaybeFloat // optional CP Name // optional CO [2]Fl // optional }
AnnotationLine displays a single straight line on the page. See Table 175 – Additional entries specific to a line annotation
type AnnotationLink ¶
type AnnotationLink struct { A Action // optional, represented by a dictionary in PDF Dest Destination // may only be present is A is nil H Highlighting // optional PA Action // optional, of type ActionURI QuadPoints []Fl // optional, length 8 x n BS *BorderStyle // optional }
AnnotationLink either opens an URI (field A) or an internal page (field Dest) See Table 173 – Additional entries specific to a link annotation
type AnnotationMarkup ¶
type AnnotationMarkup struct { T string // optional Popup *AnnotationPopup // optional, written as an indirect reference CA MaybeFloat // optional RC string // optional, may be written in PDF as a text stream CreationDate time.Time // optional Subj string // optional IT Name // optional }
AnnotationMarkup groups attributes common to all markup annotations See Table 170 – Additional entries specific to markup annotations Markup annotations are:
- Text
- FreeText
- Line
- Square
- Circle
- Polygon
- PolyLine
- Highlight
- Underline
- Squiggly
- StrikeOut
- Stamp
- Caret
- Ink
- FileAttachment
- Sound
- Redact
type AnnotationPopup ¶
type AnnotationPopup struct { BaseAnnotation Open bool // optional }
AnnotationPopup is an annotation with a static type of Popup. It is not used as a standalone annotation, but in a markup annotation. Its Parent field is deduced from its container.
type AnnotationScreen ¶
type AnnotationScreen struct { T string // optional MK *AppearanceCharacteristics // optional A Action // optional AA AnnotationAdditionalActions // optional P *PageObject }
AnnotationScreen specifies a region of a page upon which media clips may be played. See 12.5.6.18 - Screen Annotations
type AnnotationSquare ¶
type AnnotationSquare struct { AnnotationMarkup BS *BorderStyle // optional IC []Fl // optional BE *BorderEffect // optional RD Rectangle // optional }
AnnotationSquare displays a rectangle on the page. See Table 177 – Additional entries specific to a square or circle annotation
type AnnotationText ¶
type AnnotationText struct { AnnotationMarkup Open bool // optional Name Name // optional State string // optional StateModel string // optional }
AnnotationText represents a “sticky note” attached to a point in the PDF document. See Table 172 – Additional entries specific to a text annotation.
type AnnotationWidget ¶
type AnnotationWidget struct { H Highlighting // optional MK *AppearanceCharacteristics // optional A Action // optional BS *BorderStyle // optional AA AnnotationAdditionalActions // optional }
AnnotationWidget is an annotation widget, primarily for form fields The Parent field is deduced from the containing form field.
type AppearanceCharacteristics ¶
type AppearanceCharacteristics struct { R Rotation // optional BC, BG Color // optional CA, RC, AC string // optional I, RI, IX *XObjectForm // optional IF *IconFit // optional TP uint8 // optional }
AppearanceCharacteristics contains additional information for constructing the annotation’s appearance stream. See Table 189 – Entries in an appearance characteristics dictionary
type AppearanceDict ¶
type AppearanceDict struct { N AppearanceEntry // annotation’s normal appearance R AppearanceEntry // annotation’s rollover appearance, optional, default to N D AppearanceEntry // annotation’s down appearance, optional, default to N }
type AppearanceEntry ¶
type AppearanceEntry map[Name]*XObjectForm
AppearanceEntry is either a Dictionary, or a subDictionary containing multiple appearances In the first case, the map is of length 1, with the empty string as key
type AppearanceTree ¶
type AppearanceTree struct { Kids []AppearanceTree Names []NameToAppearance }
AppearanceTree links a serie of arbitrary name to appearance streams
func (AppearanceTree) IsEmpty ¶
func (d AppearanceTree) IsEmpty() bool
IsEmpty returns true if the tree is empty and should not be written in the PDF file.
func (AppearanceTree) Limits ¶
func (d AppearanceTree) Limits() [2]string
Limits specify the (lexically) 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.
func (AppearanceTree) LookupTable ¶
func (d AppearanceTree) LookupTable() map[string]*XObjectForm
LookupTable walks the name tree and accumulates the result into one map
type AttributeObject ¶
type AttributeObject struct { RevisionNumber int // optional, default to 0 O Name // required // Other keys and values defining the attributes Attributes map[Name]Object }
AttributeObject is represented by a single or a pair of array elements, the first or only element shall contain the attribute object itself and the second (when present) shall contain the integer revision number associated with it in this structure element. We only support dictionary (via the Attributes field), not streams.
func (AttributeObject) Clone ¶
func (a AttributeObject) Clone() AttributeObject
type AttributeUserProperties ¶
type AttributeUserProperties []UserProperty
AttributeUserProperties is a predefined kind of Attribute It may be used only if an AttributeObject with O = UserProperties and Attributes = map[P: AttributeUserProperties]
func (AttributeUserProperties) Clone ¶
func (us AttributeUserProperties) Clone() Object
Clone implements Attribute
func (AttributeUserProperties) Write ¶
func (us AttributeUserProperties) Write(enc PDFWritter, context Reference) string
PDFString implements Attribute
type BaseAnnotation ¶
type BaseAnnotation struct { M time.Time // optional StructParent MaybeInt // required if the annotation is a structural content item AP *AppearanceDict // optional Border *Border // optional Contents string // optional NM string // optional // Appearance state (key of the AP.N subDictionary). // Required if the appearance dictionary AP contains one or more // subdictionaries AS Name C []Fl // 0, 1, 3 or 4 numbers in the range 0.0 to 1.0 Rect Rectangle F AnnotationFlag // optional }
type BaseGradient ¶
type BaseGradient struct { Domain [2]Fl // optional, default to [0 1] // either one 1 -> n function, or n 1->1 functions, // where n is the number of color components Function []FunctionDict Extend [2]bool // optional, default to [false, false] }
BaseGradient stores attributes common to linear and radial gradients.
type Border ¶
type Border struct { DashArray []Fl // optional (nil not to specify it) HCornerRadius, VCornerRadius, BorderWidth Fl }
Border is written in PDF as an array of 3 or 4 elements
type BorderEffect ¶
BorderEffect specifies an effect that shall be applied to the border of the annotations See Table 167 – Entries in a border effect dictionary
func (*BorderEffect) Clone ¶
func (b *BorderEffect) Clone() *BorderEffect
func (BorderEffect) String ¶
func (b BorderEffect) String() string
String returns the PDF dictionary .
type BorderStyle ¶
type BorderStyle struct { W MaybeFloat // optional, default to 1 S Name // optional D []Fl // optional, default to [3], nil not to specify it }
BorderStyle specifies the border characteristics for some types of annotations
func (BorderStyle) String ¶
func (bo BorderStyle) String() string
String returns the PDF dictionary representing the border style.
type CID ¶
type CID uint16 // See Table C.1 – Architectural limits for the 2^16 limit.
CID is a character code that correspond to one glyph It will be obtained (from the bytes of a string) through a CMap, and will be use as index in a CIDFont object. It is not the same as an Unicode point.
type CIDFontDictionary ¶
type CIDFontDictionary struct { Subtype Name // CIDFontType0 or CIDFontType2 BaseFont Name CIDSystemInfo CIDSystemInfo FontDescriptor FontDescriptor // indirect object DW int // optionnal, default to 1000 W []CIDWidth // optionnal DW2 [2]int // optionnal, default to [ 880 −1000 ] W2 []CIDVerticalMetric // optionnal CIDToGIDMap CIDToGIDMap // optional }
func (CIDFontDictionary) Clone ¶
func (c CIDFontDictionary) Clone() CIDFontDictionary
Clone returns a deep copy of the CIDFontDictionary
func (CIDFontDictionary) Widths ¶
func (c CIDFontDictionary) Widths() map[CID]Fl
Widths resolve the mapping from CID to glypth widths CID not found should be mapped to the default width
type CIDSystemInfo ¶
type CIDSystemInfo struct { Registry string // must be ASCII string Ordering string // must be ASCII string Supplement int }
func (CIDSystemInfo) ToUnicodeCMapName ¶
func (c CIDSystemInfo) ToUnicodeCMapName() Name
ToUnicodeCMapName construct a Unicode CMap name in the format `registry–ordering–UCS2`
type CIDToGIDMap ¶
type CIDToGIDMap interface { // Clone returns a deep copy, preserving the concrete type. Clone() CIDToGIDMap // contains filtered or unexported methods }
CIDToGIDMap is either /Identity or a (binary) stream
type CIDToGIDMapIdentity ¶
type CIDToGIDMapIdentity struct{}
func (CIDToGIDMapIdentity) Clone ¶
func (c CIDToGIDMapIdentity) Clone() CIDToGIDMap
type CIDToGIDMapStream ¶
type CIDToGIDMapStream struct {
Stream
}
func (CIDToGIDMapStream) Clone ¶
func (c CIDToGIDMapStream) Clone() CIDToGIDMap
type CIDVerticalMetric ¶
type CIDVerticalMetric interface { // VerticalMetrics accumulate the vertical metrics for each character, defined in user units VerticalMetrics(map[CID]VerticalMetric) // String returns a PDF representation of the width String() string // Clone returns a deepcopy, preserving the concrete type Clone() CIDVerticalMetric }
CIDVerticalMetric groups the two ways of defining vertical displacement for CID
type CIDVerticalMetricArray ¶
type CIDVerticalMetricArray struct { Start CID Verticals []VerticalMetric }
CIDVerticalMetricArray is written in PDF as
c [ w_1 w_2 ... w_n ]
func (CIDVerticalMetricArray) Clone ¶
func (c CIDVerticalMetricArray) Clone() CIDVerticalMetric
Clone return a deep copy of `c`, with concrete type `CIDVerticalMetricArray`
func (CIDVerticalMetricArray) String ¶
func (c CIDVerticalMetricArray) String() string
func (CIDVerticalMetricArray) VerticalMetrics ¶
func (c CIDVerticalMetricArray) VerticalMetrics(out map[CID]VerticalMetric)
type CIDVerticalMetricRange ¶
type CIDVerticalMetricRange struct {
First, Last CID
VerticalMetric VerticalMetric
}
CIDVerticalMetricRange is written in PDF as
c_first c_last w v_w v_y
func (CIDVerticalMetricRange) Clone ¶
func (c CIDVerticalMetricRange) Clone() CIDVerticalMetric
Clone return a deep copy of `c`, with concrete type `CIDVerticalMetricRange`
func (CIDVerticalMetricRange) String ¶
func (c CIDVerticalMetricRange) String() string
func (CIDVerticalMetricRange) VerticalMetrics ¶
func (c CIDVerticalMetricRange) VerticalMetrics(out map[CID]VerticalMetric)
type CIDWidth ¶
type CIDWidth interface { // Widths accumulate the widths for each character, defined in user units Widths(map[CID]Fl) // String returns a PDF representation of the width String() string // Clone returns a deepcopy, preserving the concrete type Clone() CIDWidth }
CIDWidth groups the two ways of defining widths for CID : either CIDWidthRange or CIDWidthArray
type CIDWidthArray ¶
CIDWidthArray is written in PDF as
start [ w_1 w_2 ... w_n ]
func (CIDWidthArray) Clone ¶
func (c CIDWidthArray) Clone() CIDWidth
Clone return a deep copy of `c`, with concrete type `CIDWidthArray`
func (CIDWidthArray) String ¶
func (c CIDWidthArray) String() string
func (CIDWidthArray) Widths ¶
func (c CIDWidthArray) Widths(out map[CID]Fl)
type CIDWidthRange ¶
CIDWidthRange is written in PDF as
c_first c_last w
func (CIDWidthRange) Clone ¶
func (c CIDWidthRange) Clone() CIDWidth
Clone return a deep copy of `c`, with concrete type `CIDWidthRange`
func (CIDWidthRange) String ¶
func (c CIDWidthRange) String() string
func (CIDWidthRange) Widths ¶
func (c CIDWidthRange) Widths(out map[CID]Fl)
type CMapEncoding ¶
type CMapEncoding interface { // Clone returns a deep copy, preserving the concrete type Clone() CMapEncoding // contains filtered or unexported methods }
CMapEncoding maps character codes to font numbers and CIDs
type CMapEncodingEmbedded ¶
type CMapEncodingEmbedded struct { Stream CMapName Name CIDSystemInfo CIDSystemInfo WMode bool // optional, true for vertical UseCMap CMapEncoding // optional }
func (CMapEncodingEmbedded) Clone ¶
func (p CMapEncodingEmbedded) Clone() CMapEncoding
Clone returns a deep copy with concrete type `EmbeddedCMapEncoding`
type CMapEncodingPredefined ¶
type CMapEncodingPredefined Name
func (CMapEncodingPredefined) Clone ¶
func (p CMapEncodingPredefined) Clone() CMapEncoding
Clone returns a deep copy with concrete type `PredefinedCMapEncoding`
type Catalog ¶
type Catalog struct { Pages PageTree Extensions Extensions Names NameDictionary // optional ViewerPreferences *ViewerPreferences // optional AcroForm AcroForm // optional Dests map[Name]DestinationExplicit // optional PageLabels *PageLabelsTree // optional Outlines *Outline // optional StructTreeRoot *StructureTree // optional MarkInfo *MarkDict // optional PageLayout Name // optional PageMode Name // optional // optional. A simple GoTo action to a direct destination // may be found as an array in a PDF file. OpenAction Action URI string // optional, ASCII string, written in PDF as a dictionary Lang string }
Catalog contains the main contents of the document. See especially the `Pages` tree, the `AcroForm` form and the `Outlines` tree.
type CertDict ¶
type CertDict struct { Ff uint8 // optional, default to 0 Subject []string // optional byte strings SubjectDN []map[Name]string // optional, each map values are text strings KeyUsage []string // optional, must be ASCII strings Issuer []string // optional, byte strings OID []string // optional, byte strings URL string // optional, must be ASCII string URLType Name // optional }
CertDict contains characteristics of the certificate that shall be used when signing
type Color ¶
type Color []Fl
Color is color, possibly invalid, defined by 1 (Gray), 3 (RGB) or 4 (CMYK) values, between 0 and 1.
type ColorSpace ¶
type ColorSpace interface { // Return the number of color components NbColorComponents() int // contains filtered or unexported methods }
ColorSpace is either a Name or a more complex object The three families Device, CIE-based and Special are supported.
type ColorSpaceCalGray ¶
type ColorSpaceCalGray struct { WhitePoint [3]Fl BlackPoint [3]Fl // optional, default to [0 0 0] Gamma Fl // optional, default to 1 }
---------------------- CIE-based ----------------------
func (ColorSpaceCalGray) NbColorComponents ¶
func (ColorSpaceCalGray) NbColorComponents() int
type ColorSpaceCalRGB ¶
type ColorSpaceCalRGB struct { WhitePoint [3]Fl BlackPoint [3]Fl // optional, default to [0 0 0] Gamma [3]Fl // optional, default to [1 1 1] Matrix [9]Fl // [ X_A Y_A Z_A X_B Y_B Z_B X_C Y_C Z_C ], optional, default to identity }
func (ColorSpaceCalRGB) NbColorComponents ¶
func (ColorSpaceCalRGB) NbColorComponents() int
type ColorSpaceDeviceN ¶
type ColorSpaceDeviceN struct { Names []Name AlternateSpace ColorSpace // required may not be another special colour space TintTransform FunctionDict // required, may be an indirect object Attributes *ColorSpaceDeviceNAttributes // optional }
ColorSpaceDeviceN is defined in PDF as an array [ /DeviceN names alternateSpace tintTransform attributes ] (attributes is optional)
func (ColorSpaceDeviceN) NbColorComponents ¶
func (cs ColorSpaceDeviceN) NbColorComponents() int
type ColorSpaceDeviceNAttributes ¶
type ColorSpaceDeviceNAttributes struct { Subtype Name // optional, DeviceN or NChannel Colorants map[Name]ColorSpaceSeparation // required if Subtype is NChannel Process ColorSpaceDeviceNProcess // optional MixingHints *ColorSpaceDeviceNMixingHints // optional }
ColorSpaceDeviceNAttributes contains additional information about the components See Table 71 – Entries in a DeviceN Colour Space Attributes Dictionary
type ColorSpaceDeviceNMixingHints ¶
type ColorSpaceDeviceNMixingHints struct { Solidities map[Name]Fl // optional PrintingOrder []Name // optional DotGain map[Name]FunctionDict // optional }
Table 73 – Entries in a DeviceN Mixing Hints Dictionary
func (*ColorSpaceDeviceNMixingHints) Clone ¶
func (c *ColorSpaceDeviceNMixingHints) Clone() *ColorSpaceDeviceNMixingHints
type ColorSpaceDeviceNProcess ¶
type ColorSpaceDeviceNProcess struct { ColorSpace ColorSpace // required Components []Name // required }
Table 72 – Entries in a DeviceN Process Dictionary
type ColorSpaceICCBased ¶
type ColorSpaceICCBased struct { Stream N int // 1, 3 or 4 Alternate ColorSpace // optional Range [][2]Fl // optional, default to [{0, 1}, ...] }
func (*ColorSpaceICCBased) IsReferenceable ¶
func (*ColorSpaceICCBased) IsReferenceable()
func (ColorSpaceICCBased) NbColorComponents ¶
func (cs ColorSpaceICCBased) NbColorComponents() int
type ColorSpaceIndexed ¶
type ColorSpaceIndexed struct { Base ColorSpace // required Hival uint8 Lookup ColorTable }
ColorSpaceIndexed is written in PDF as [/Indexed base hival lookup ]
func (ColorSpaceIndexed) NbColorComponents ¶
func (ColorSpaceIndexed) NbColorComponents() int
type ColorSpaceLab ¶
type ColorSpaceLab struct { WhitePoint [3]Fl BlackPoint [3]Fl // optional, default to [0 0 0] Range [4]Fl // [ a_min a_max b_min b_max ], optional, default to [−100 100 −100 100 ] }
func (ColorSpaceLab) NbColorComponents ¶
func (ColorSpaceLab) NbColorComponents() int
type ColorSpaceName ¶
type ColorSpaceName Name
const ( ColorSpaceRGB ColorSpaceName = "DeviceRGB" ColorSpaceGray ColorSpaceName = "DeviceGray" ColorSpaceCMYK ColorSpaceName = "DeviceCMYK" ColorSpacePattern ColorSpaceName = "Pattern" )
func NewNameColorSpace ¶
func NewNameColorSpace(cs string) (ColorSpaceName, error)
NewNameColorSpace validate the color space
func (ColorSpaceName) NbColorComponents ¶
func (n ColorSpaceName) NbColorComponents() int
func (ColorSpaceName) String ¶
func (cs ColorSpaceName) String() string
type ColorSpaceSeparation ¶
type ColorSpaceSeparation struct { Name Name AlternateSpace ColorSpace // required may not be another special colour space TintTransform FunctionDict // required, may be an indirect object }
ColorSpaceSeparation is defined in PDF as an array [/Separation name alternateSpace tintTransform ]
func (ColorSpaceSeparation) NbColorComponents ¶
func (ColorSpaceSeparation) NbColorComponents() int
type ColorSpaceUncoloredPattern ¶
type ColorSpaceUncoloredPattern struct {
UnderlyingColorSpace ColorSpace // required
}
ColorSpaceUncoloredPattern is written in PDF [/Pattern underlyingColorSpace ]
func (ColorSpaceUncoloredPattern) NbColorComponents ¶
func (ColorSpaceUncoloredPattern) NbColorComponents() int
type ColorTable ¶
type ColorTable interface {
// contains filtered or unexported methods
}
ColorTable is either a content stream or a simple byte string
type ColorTableBytes ¶
type ColorTableBytes []byte
type ColorTableStream ¶
type ColorTableStream Stream
func (*ColorTableStream) IsReferenceable ¶
func (*ColorTableStream) IsReferenceable()
type ContentItem ¶
type ContentItem interface {
// contains filtered or unexported methods
}
ContentItem may be one the three following item
- A structure element dictionary denoting another structure element
- A marked-content reference dictionary denoting a marked-content sequence In PDF, it may be written directly as an integer, when marked-content sequence is contained in the content stream of the page that is specified in the Pg entry of the structure element dictionary
- An object reference dictionary denoting a PDF object
type ContentItemMarkedReference ¶
type ContentItemMarkedReference struct { // marked-content identifier marked-content identifier sequence // within its content stream sequence within its content stream MCID int // optional. This entry should be an XObjectForm only if the marked-content sequence // resides in a content stream other than the content stream for the page Container ContentMarkedContainer }
ContentItemMarkedReference is a marked-content reference dictionary
type ContentItemObjectReference ¶
type ContentItemObjectReference struct { Pg *PageObject // optional Obj StructParentObject // required }
ContentItemObjectReference identifies an entire PDF object, such as an XObject or an annotation, that is associated with a page but not directly included in the page’s content stream
type ContentMarkedContainer ¶
type ContentMarkedContainer interface {
// contains filtered or unexported methods
}
ContentMarkedContainer is either *PageObject or *XObjectForm (found for exemple in appearance streams)
type ContentStream ¶
type ContentStream struct {
Stream
}
Content stream is a PDF stream object whose data consists of a sequence of instructions describing the graphical elements to be painted on a page.
func (ContentStream) Clone ¶
func (c ContentStream) Clone() ContentStream
type CrypFilter ¶
type CrypFilter struct { CFM Name // optional AuthEvent Name // optional Length int // optional // byte strings, required for public-key security handlers // for Crypt filter decode parameter dictionary, // a one element array is written in PDF directly as a string Recipients []string // optional, default to false // written in PDF under the key /EncryptMetadata DontEncryptMetadata bool }
type DashPattern ¶
func (DashPattern) String ¶
func (d DashPattern) String() string
String returns a description as a PDF array.
type DestTree ¶
type DestTree struct { Kids []DestTree // Names must be sorted by .Name fields Names []NameToDest }
DestTree links a serie of arbitrary name to explicit destination, enabling `NamedDestination` to reference them. In may be found as a tree in PDF files, but a linear representation may be enough for many use cases.
func (DestTree) IsEmpty ¶
IsEmpty returns true if the tree is empty and should not be written in the PDF file.
func (DestTree) Limits ¶
Limits specify the (lexically) 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.
func (DestTree) LookupTable ¶
func (d DestTree) LookupTable() map[DestinationString]DestinationExplicit
LookupTable walks the name tree and accumulates the result into one map
type Destination ¶
type Destination interface {
// contains filtered or unexported methods
}
type DestinationExplicit ¶
type DestinationExplicit interface { Destination // contains filtered or unexported methods }
DestinationExplicit is a destination to a page, either intern or extern
type DestinationExplicitExtern ¶
type DestinationExplicitExtern struct { Page int // 0 based Location DestinationLocation // required }
DestinationExplicitExtern is an explicit destination to a page in an other PDF file.
type DestinationExplicitIntern ¶
type DestinationExplicitIntern struct { Page *PageObject Location DestinationLocation // required }
DestinationExplicitIntern is an explicit destination to a page
type DestinationLocation ¶
type DestinationLocation interface {
// contains filtered or unexported methods
}
DestinationLocation precise where and how to display a destination page. It is either a Name o See Table 151 – Destination syntax in the SPEC.
type DestinationLocationFit ¶
type DestinationLocationFit Name
DestinationLocationFit is one of /Fit or /FitB
type DestinationLocationFitDim ¶
type DestinationLocationFitDim struct { Name Name // one of /FitH /FitV /FitBH ∕FitBV Dim MaybeFloat }
DestinationLocationFitDim is one of /FitH, /FitV, /FitBH or ∕FitBV
type DestinationLocationFitR ¶
type DestinationLocationFitR struct {
Left, Bottom, Right, Top Fl
}
DestinationLocationFitR is /FitR
type DestinationLocationXYZ ¶
type DestinationLocationXYZ struct {
Left, Top MaybeFloat
Zoom Fl
}
DestinationLocationXYZ is /XYZ
type DestinationName ¶
type DestinationName Name
DestinationString refers to a destination in the Dests entry of the document catalog
type DestinationString ¶
type DestinationString string
DestinationString refers to a destination in the Dests entry of the document name dictionnary
type Differences ¶
Differences describes the differences from the encoding specified by BaseEncoding It is written in a PDF file as a more condensed form: it is an array:
[ code1, name1_1, name1_2, code2, name2_1, name2_2, name2_3 ... ]
where code1 -> name1_1 ; code1 + 1 -> name1_2 ; ...
func (Differences) Apply ¶
func (d Differences) Apply(encoding [256]string) [256]string
Apply applies the difference to a base encoding, represented by glyph names.
func (Differences) Clone ¶
func (d Differences) Clone() Differences
Clone returns a deep copy of `d`
func (Differences) Write ¶
func (d Differences) Write() string
PDFString pack the differences again, to obtain a compact representation of the mappgin, as specified in the SPEC.
type Document ¶
Document is the top-level object, representing a whole PDF file. Where a PDF file use indirect object to link data together, `Document` uses Go pointers, making easier to analyse and mutate a document. See the package `reader` to create a new `Document` from an existing PDF file. The zero value represents an empty PDF file.
func (*Document) Clone ¶
Clone returns a deep copy of the document. It may be useful for example when we want to load a 'template' document once at server startup, and then modifyng it for each request. For every type implementing `Referenceable`, the equalities between pointers are preserved, meaning that if a pointer is used twice in the original document, it will also be used twice in the clone (and not duplicated).
func (Document) UseStandardEncryptionHandler ¶
func (d Document) UseStandardEncryptionHandler(enc Encrypt, ownerPassword, userPassword string, encryptMetadata bool) Encrypt
UseStandardEncryptionHandler create a Standard security handler and install it on the returned encrypt dict. The field V and P of the encrypt dict must be setup previously. `userPassword` and `ownerPassword` are used to generate the encryption keys and will be needed to decrypt the document.
type EmbeddedFileParams ¶
type EmbeddedFileParams struct { CreationDate time.Time // optional ModDate time.Time // optional Size int // optional CheckSum string // optional, must be hex16 encoded }
func (*EmbeddedFileParams) SetChecksumAndSize ¶
func (f *EmbeddedFileParams) SetChecksumAndSize(content []byte)
SetChecksumAndSize compute the size and the checksum of the `content`, which must be the original (not encoded) data.
type EmbeddedFileStream ¶
type EmbeddedFileStream struct { Stream Params EmbeddedFileParams // optional }
func (*EmbeddedFileStream) IsReferenceable ¶
func (*EmbeddedFileStream) IsReferenceable()
type EmbeddedFileTree ¶
type EmbeddedFileTree []NameToFile
EmbeddedFileTree is written as a Name Tree in PDF, but, since it generally won't be big, is represented here as a flat list. It must be sorted by .Name field.
func (EmbeddedFileTree) Limits ¶
func (efs EmbeddedFileTree) Limits() [2]string
type EmbeddedTarget ¶
type EmbeddedTarget struct { R Name N string P EmbeddedTargetDest // optional A EmbeddedTargetAnnot // optional T *EmbeddedTarget // optional }
type EmbeddedTargetAnnot ¶
type EmbeddedTargetAnnot interface {
// contains filtered or unexported methods
}
EmbeddedTargetAnnot is either the index (zero-based) of the annotation in the Annots array of the page specified by P or a text string that specifies the value of NM in the annotation dictionary
type EmbeddedTargetAnnotIndex ¶
type EmbeddedTargetAnnotIndex int
type EmbeddedTargetAnnotNamed ¶
type EmbeddedTargetAnnotNamed string
type EmbeddedTargetDest ¶
type EmbeddedTargetDest interface {
// contains filtered or unexported methods
}
EmbeddedTargetDest is either the page number (zero-based) in the current document containing the file attachment annotation or a string that specifies a named destination in the current document that provides the page number of the file attachment annotation.
type EmbeddedTargetDestNamed ¶
type EmbeddedTargetDestNamed DestinationString
type EmbeddedTargetDestPage ¶
type EmbeddedTargetDestPage int
type Encrypt ¶
type Encrypt struct { EncryptionHandler EncryptionHandler Filter Name SubFilter Name V EncryptionAlgorithm // Length in bytes, from 5 to 16, optional, default to 5. // It is written in pdf as bit length. Length uint8 CF map[Name]CrypFilter // optional StmF Name // optional StrF Name // optional EFF Name // optional P UserPermissions }
Encrypt stores the encryption-related information It will be filled when reading an existing PDF document. Note that to encrypt a document when writting it, a call to `Document.UseStandardEncryptionHandler` is needed (partly because password are needed, which are not contained in the PDF). Also note that encryption with a public key is not supported.
func (*Encrypt) NewAESSecurityHandler ¶
func (e *Encrypt) NewAESSecurityHandler(fileID string, revision uint8, dontEncryptMetadata bool) *AESSecurityHandler
NewAESSecurityHandler uses the field in `e` and the provided settings to build a `AESSecurityHandler`, which uses AES. When crypting a document, an EncryptionStandard shoud then be created and installed on the document. When decrypting a document, an EncryptionStandard should then be created and compared with the one found in the PDF file.
func (*Encrypt) NewRC4SecurityHandler ¶
func (e *Encrypt) NewRC4SecurityHandler(fileID string, revision uint8, dontEncryptMetadata bool) *RC4SecurityHandler
NewRC4SecurityHandler uses the field in `e` and the provided settings to build a `RC4SecurityHandler`, which uses RC4. When crypting a document, an EncryptionStandard shoud then be created and installed on the document. When decrypting a document, an EncryptionStandard should then be created and compared with the one found in the PDF file.
type EncryptionAlgorithm ¶
type EncryptionAlgorithm uint8
EncryptionAlgorithm is a code specifying the algorithm to be used in encrypting and decrypting the document
const ( EaRC440 EncryptionAlgorithm EaRC4Ext // encryption key with length greater than 40 EaRC4Custom EaAES // AES is used for all content )
type EncryptionHandler ¶
type EncryptionHandler interface { // Clone returns a deep copy, preserving the concrete type. Clone() EncryptionHandler // contains filtered or unexported methods }
EncryptionHandler is either EncryptionStandard or EncryptionPublicKey
type EncryptionPublicKey ¶
type EncryptionPublicKey []string
EncryptionPublicKey is written in PDF under the /Recipients key.
func (EncryptionPublicKey) Clone ¶
func (e EncryptionPublicKey) Clone() EncryptionHandler
type EncryptionStandard ¶
type EncryptionStandard struct { R uint8 // 2, 3, 4 or 5 O [48]byte // only the first 32 bytes are used when R != 5 U [48]byte // only the first 32 bytes are used when R != 5 // optional, default value is false // written in PDF under the key /EncryptMetadata DontEncryptMetadata bool UE, OE [32]byte // used for AES encryption Perms [16]byte // used for AES encryption // contains filtered or unexported fields }
func (EncryptionStandard) Clone ¶
func (e EncryptionStandard) Clone() EncryptionHandler
type FileSpec ¶
type FileSpec struct { UF string // optional EF *EmbeddedFileStream Desc string // optional }
FileSpec is a File Specification Dictionary. In PDF, it may be found as a simple File Specification String which should be stored in the `UF` field.
func (*FileSpec) IsReferenceable ¶
func (*FileSpec) IsReferenceable()
type Filter ¶
type Font ¶
type Font interface { FontName() Name // contains filtered or unexported methods }
Font is one of Type0, FontType1, TrueType or Type3
type FontDescriptor ¶
type FontDescriptor struct { // Required. PostScript name of the font: the value of BaseFont in the font or // CIDFont dictionary that refers to this font descriptor FontName Name Flags FontFlag // Required ItalicAngle Fl // Required FontFamily string // byte string, optional FontBBox Rectangle // specify the font bounding box, expressed in the glyph coordinate system // angle, expressed in degrees counterclockwise from // the vertical, of the dominant vertical strokes of the font. Ascent Fl // maximum height above the baseline reached by glyphs in this font Descent Fl // (negative number) maximum depth below the baseline reached by glyphs in this font Leading Fl // optional, default to 0. Spacing between baselines of consecutive lines of text CapHeight Fl // vertical coordinate of the top of flat capital letters, measured from the baseline XHeight Fl // optional, default to 0. Vertical coordinate of the top of flat nonascending lowercase letters StemV Fl // thickness, measured horizontally, of the dominant vertical stems of glyphs in the font StemH Fl // optional, default to 0. Thickness, measured vertically, of the dominant horizontal stems of glyphs in the font. AvgWidth Fl // optional, default to 0. Average width of glyphs in the font. MaxWidth Fl // optional, default to 0. Maximum width of glyphs in the font. MissingWidth int // optional, default to 0. Width to use for character codes whose widths are not specified FontFile *FontFile // optional, written in PDF under the key FontFile (for Type1), FontFile2 (for TrueType), FontFile3 (for Type 1 compact fonts, Type 0 compact CIDFonts or OpenType) CharSet string // optional, ASCII string or byte string. Meaningful only in Type 1 font }
func (FontDescriptor) Clone ¶
func (f FontDescriptor) Clone() FontDescriptor
Clone returns a deep copy of the font descriptor.
type FontDict ¶
type FontDict struct { Subtype Font ToUnicode *UnicodeCMap }
FontDict is a PDF font Dictionary.
It exposes only the information written and read in PDF files. Almost every text processing task will require more informations, especially when dealing with Unicode strings. See `pdf/fonts` for more information and tooling.
func (*FontDict) IsReferenceable ¶
func (*FontDict) IsReferenceable()
type FontFile ¶
type FontFile struct { Stream Length1 int Length2 int Length3 int Subtype Name // optional, one of Type1C for Type 1 compact fonts, CIDFontType0C for Type 0 compact CIDFonts, or OpenType }
func (*FontFile) IsReferenceable ¶
func (*FontFile) IsReferenceable()
type FontFlag ¶
type FontFlag uint32
FontFlag specify various characteristics of a font. See Table 123 – Font flags of the PDF SPEC.
const ( FixedPitch FontFlag = 1 << (1 - 1) Serif FontFlag = 1 << (2 - 1) Symbolic FontFlag = 1 << (3 - 1) Script FontFlag = 1 << (4 - 1) Nonsymbolic FontFlag = 1 << (6 - 1) Italic FontFlag = 1 << (7 - 1) AllCap FontFlag = 1 << (17 - 1) SmallCap FontFlag = 1 << (18 - 1) ForceBold FontFlag = 1 << (19 - 1) )
type FontSimple ¶
type FontSimple interface { Font SimpleEncoding() SimpleEncoding }
FontSimple is either FontType1, TrueType or Type3
type FontTrueType ¶
type FontTrueType FontType1
func (FontTrueType) FontName ¶
func (ft FontTrueType) FontName() Name
func (FontTrueType) SimpleEncoding ¶
func (ft FontTrueType) SimpleEncoding() SimpleEncoding
type FontType0 ¶
type FontType0 struct { BaseFont Name Encoding CMapEncoding // required DescendantFonts CIDFontDictionary // in PDF, array of one indirect object }
type FontType1 ¶
type FontType1 struct { BaseFont Name FirstChar byte // length (LastChar − FirstChar + 1) index i is char FirstChar + i // width are measured in units in which 1000 units correspond to 1 unit in text space Widths []int FontDescriptor FontDescriptor Encoding SimpleEncoding // optional }
func (FontType1) SimpleEncoding ¶
func (ft FontType1) SimpleEncoding() SimpleEncoding
type FontType3 ¶
type FontType3 struct { FontBBox Rectangle FontMatrix Matrix CharProcs map[Name]ContentStream Encoding SimpleEncoding // required FirstChar byte Widths []int // length (LastChar − FirstChar + 1); index i is char code FirstChar + i FontDescriptor *FontDescriptor // required in TaggedPDF Resources ResourcesDict // optional }
func (FontType3) SimpleEncoding ¶
func (ft FontType3) SimpleEncoding() SimpleEncoding
type FormFielAdditionalActions ¶
type FormFielAdditionalActions struct { K Action // on update F Action // before formating V Action // on validate C Action // to recalculate }
All actions are optional and must be JavaScript actions. See Table 196 – Entries in a form field’s additional-actions dictionary
func (FormFielAdditionalActions) IsEmpty ¶
func (f FormFielAdditionalActions) IsEmpty() bool
IsEmpty returns `true` if it contains no action.
type FormField ¶
type FormField interface {
// contains filtered or unexported methods
}
FormField provides additional form attributes, depending on the field type.
type FormFieldButton ¶
type FormFieldButton struct { V Name // check box’s appearance state Opt []string // optional, text strings, same length as Widgets }
FormFieldButton represent interactive controls on the screen that the user can manipulate with the mouse. They include pushbuttons, check boxes, and radio buttons.
type FormFieldChoice ¶
type FormFieldChoice struct { // text strings. When empty, it's written in PDF as null // If only one item is currently selected, it's written as a text string V []string Opt []Option // optional TI int // optional, default to 0 I []int // optional }
FormFieldChoice contain several text items, at most one of which may be selected as the field value. They include scrollable list boxes and combo boxes.
type FormFieldDict ¶
type FormFieldDict struct { FormFieldInheritable Parent *FormFieldDict // nil for the top level fields Kids []*FormFieldDict // nil for a leaf node // Widgets is not nil only for a leaf node, // and is represented in PDF under the /Kids entry, // or merged if their is only one widget. // *AnnotationDict must also be registered in // a PageObject.Annots list. See the PageObject.AddFormFieldWidget // for a convenient way of doing so. Widgets []FormFieldWidget T string // optional, text string TU string // optional, text string, alternate field name TM string // optional, text string, mapping name AA FormFielAdditionalActions // optional DS string // optional, text string RV string // optional, text string, may be written in PDF as a stream }
FormFields are organized hierarchically into one or more tree structures. Many field attributes are inheritable, meaning that if they are not explicitly specified for a given field, their values are taken from those of its parent in the field hierarchy.
This tree only defines the logic of the forms, not their appearance on the page. This is the purpose of the AnnotationWidget, defined in the Annots list of a page object. FormFields refer to them via the Widgets list.
We depart from the SPEC in that all fields related to the specialisation of a field (attribut FT) are inherited (or not) at the same time. This should not be a problem in pratice, because if a parent changes its type, the values related to it should change as well. TODO: fix this
func (*FormFieldDict) FullFieldName ¶
func (f *FormFieldDict) FullFieldName() string
FullFieldName returns the fully qualified field name, which is not explicitly defined but is constructed from the partial field names of the field and all of its ancestors. This is a convenient function, but not efficient if all called on all the fields of the tree.
type FormFieldInheritable ¶
type FormFieldInherited ¶
type FormFieldInherited struct { Field *FormFieldDict Merged FormFieldInheritable }
FormFieldInherited associate to a field the values resolved from its ancestors
type FormFieldSignature ¶
type FormFieldSignature struct { V *SignatureDict // optional Lock *LockDict // optional SV *SeedDict // optional }
FormFieldSignature represent digital signatures and optional data for authenticating the name of the signer and the document’s contentstream.
type FormFieldText ¶
type FormFieldText struct { V string // text string, may be written in PDF as a stream MaxLen MaybeInt // optional }
FormFieldText are boxes or spaces in which the user can enter text from the keyboard.
type FormFieldWidget ¶
type FormFieldWidget struct {
*AnnotationDict
}
FormFieldWidget is an annotation which must have a type of FormFieldWidget
type FormFlag ¶
type FormFlag uint32
See Table 221 – Field flags common to all field types Table 226 – Field flags specific to button fields Table 228 – Field flags specific to text fields Table 230 – Field flags specific to choice fields
const ( ReadOnly FormFlag = 1 << (1 - 1) Required FormFlag = 1 << (2 - 1) NoExport FormFlag = 1 << (3 - 1) Multiline FormFlag = 1 << (13 - 1) Password FormFlag = 1 << (14 - 1) NoToggleToOff FormFlag = 1 << (15 - 1) Radio FormFlag = 1 << (16 - 1) FileSelect FormFlag = 1 << (21 - 1) DoNotSpellCheck FormFlag = 1 << (23 - 1) DoNotScroll FormFlag = 1 << (24 - 1) Comb FormFlag = 1 << (25 - 1) RadiosInUnison FormFlag = 1 << (26 - 1) RichText FormFlag = 1 << (26 - 1) Combo FormFlag = 1 << (18 - 1) Edit FormFlag = 1 << (19 - 1) Sort FormFlag = 1 << (20 - 1) MultiSelect FormFlag = 1 << (22 - 1) CommitOnSelChange FormFlag = 1 << (27 - 1) )
type Function ¶
type Function interface { Clone() Function // contains filtered or unexported methods }
Function is one of FunctionSample, FunctionExpInterpolation, FunctionStitching, FunctionPostScriptCalculator
type FunctionDict ¶
type FunctionDict struct { FunctionType Function Domain []Range // length m Range []Range // length n, optionnal for ExpInterpolationFunction and StitchingFunction }
FunctionDict takes m arguments and return n values
func (FunctionDict) Clone ¶
func (f FunctionDict) Clone() FunctionDict
Clone returns a deep copy of the function
func (*FunctionDict) IsReferenceable ¶
func (*FunctionDict) IsReferenceable()
type FunctionExpInterpolation ¶
type FunctionExpInterpolation struct { C0 []Fl // length n, optional, default to 0 C1 []Fl // length n, optional, default to 1 N int // interpolation exponent (N=1 for linear interpolation) }
FunctionExpInterpolation (type 2) defines an exponential interpolation of one input value and n output values
func (FunctionExpInterpolation) Clone ¶
func (f FunctionExpInterpolation) Clone() Function
Clone returns a deep copy of the function (with concrete type `ExpInterpolationFunction`)
type FunctionPostScriptCalculator ¶
type FunctionPostScriptCalculator Stream
FunctionPostScriptCalculator (type 4) is stream containing code written in a small subset of the PostScript language
func (FunctionPostScriptCalculator) Clone ¶
func (f FunctionPostScriptCalculator) Clone() Function
Clone returns a deep copy of the function (with concrete type `PostScriptCalculatorFunction`)
type FunctionSampled ¶
type FunctionSampled struct { Stream Size []int // length m BitsPerSample uint8 // 1, 2, 4, 8, 12, 16, 24 or 32 Order uint8 // 1 (linear) or 3 (cubic), optional, default to 1 Encode [][2]Fl // length m, optional, default to [ 0 (Size_0 − 1) 0 (Size_1 − 1) ... ] Decode [][2]Fl // length n, optionnal, default to Range }
FunctionSampled (type 0)
func (FunctionSampled) Clone ¶
func (f FunctionSampled) Clone() Function
Clone returns a deep copy of the function (with concrete type `SampledFunction`)
type FunctionStitching ¶
type FunctionStitching struct { Functions []FunctionDict // array of k 1-input functions Bounds []Fl // array of k − 1 numbers Encode [][2]Fl // length k }
FunctionStitching (type 3) defines a stitching of the subdomains of several 1-input functions to produce a single new 1-input function
func (FunctionStitching) Clone ¶
func (f FunctionStitching) Clone() Function
Clone returns a deep copy of the function (with concrete type `StitchingFunction`)
type GraphicState ¶
type GraphicState struct { LW Fl LC MaybeInt // optional, >= 0 LJ MaybeInt // optional, >= 0 ML Fl D *DashPattern // optional RI Name Font FontStyle // font and size SM MaybeFloat // optional SA bool // Blend mode // See Table 136 – Standard separable blend modes // and Table 137 – Standard nonseparable blend modes BM []Name // 1-element array are written in PDF as a singlename SMask SoftMaskDict // optional CA MaybeFloat // stroking, optional, >= 0 Ca MaybeFloat // non-stroking, optional, >= 0 AIS bool }
GraphicState precises parameters in the graphics state. See Table 58 – Entries in a Graphics State Parameter Dictionary TODO: The following entries are not yet supported:
- OP, op, OPM
- BG, BG2, UCR, UCR2, TR, TR2
- HT
- FL
- TK
func (*GraphicState) IsReferenceable ¶
func (*GraphicState) IsReferenceable()
type HideTargetFormName ¶
type HideTargetFormName string
HideTargetFormName is the fully qualified field name of an interactive form field
type Highlighting ¶
type Highlighting Name
const ( HNone Highlighting = "N" // No highlighting. HInvert Highlighting = "I" // Invert the contents of the annotation rectangle. HOutline Highlighting = "O" // Invert the annotation’s border. HPush Highlighting = "P" // Display the annotation’s down appearance, if any HToggle Highlighting = "T" // Same as P (which is preferred). )
type IDTree ¶
type IDTree struct { Kids []IDTree Names []NameToStructureElement }
func NewIDTree ¶
func NewIDTree(ids map[string]*StructureElement) IDTree
NewIDTree builds a valid IDTree from the given maping. The tree should be good enough for most use cases, but you may also build you own.
func (IDTree) Limits ¶
Limits specify the (lexically) 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.
func (IDTree) LookupTable ¶
func (id IDTree) LookupTable() map[string]*StructureElement
LookupTable walks the tree and accumulate the names into one map.
type IconFit ¶
type IconFit struct { SW Name // optional S Name // optional A *[2]Fl // optional FB bool // optional }
IconFit specifies how to display the button’s icon within the annotation rectangle of its widget annotation. See Table 247 – Entries in an icon fit dictionary
type Image ¶
type Image struct { Stream BitsPerComponent uint8 // 1, 2, 4, 8, or 16. Width, Height int // optional. Array of length : number of color component required by color space. // Special case for Mask image where [1 0] is also allowed Decode [][2]Fl ImageMask bool // optional Intent Name // optional Interpolate bool // optional }
Image are shared between inline images and XForm images. The ColorSpace is not included since inline images have additional restrictions.
func (Image) PDFFields ¶
func (img Image) PDFFields(inline bool) StreamHeader
PDFFields return the image characteristics.
type ImageSMask ¶
type ImageSMask struct { Image // ImageMask and Intent are ignored Matte []Fl // optional, length: number of color components in the parent image }
ImageSMask is a soft image mask See 11.6.5.3 - Soft-Mask Images
func (*ImageSMask) IsReferenceable ¶
func (*ImageSMask) IsReferenceable()
type Info ¶
type Info struct { Producer string Title string Subject string Author string Keywords string Creator string CreationDate time.Time ModDate time.Time }
Info contains metadata about the document
type LanguageArray ¶
type LanguageArray [][2]string
LanguageArray contains pairs of strings. The first string in each pair shall be a language identifier. The second string is text associated with the language.
func (LanguageArray) Clone ¶
func (l LanguageArray) Clone() LanguageArray
func (LanguageArray) Write ¶
func (l LanguageArray) Write(w PDFWritter, ref Reference) string
type LockDict ¶
type MarkDict ¶
MarkDict provides additional information relevant to specialized uses of structured PDF documents.
type Mask ¶
type Mask interface {
// contains filtered or unexported methods
}
Mask is either MaskColor or *XObjectImage See 8.9.6.2 - Stencil Masking
type MaskColor ¶
type MaskColor [][2]int
MaskColor is a range of colours to be masked See 8.9.6.4 - Colour Key Masking
type Matrix ¶
type Matrix [6]Fl // [a,b,c,d,e,f]
Matrix maps an input (x,y) to an output (x',y') defined by x′ = a × x + c × y + e y′ = b × x + d × y + f
type MaybeBool ¶
type MaybeBool interface {
// contains filtered or unexported methods
}
MaybeBool is a Bool or nothing It'a an other way to specify *Fl, safer to use and pass by value.
type MaybeFloat ¶
type MaybeFloat interface {
// contains filtered or unexported methods
}
MaybeFloat is a Float or nothing It'a an other way to specify *Fl, safer to use and pass by value.
type MaybeInt ¶
type MaybeInt interface {
// contains filtered or unexported methods
}
MaybeInt is an Int or nothing It'a an other way to specify *int, safer to use and pass by value.
type MediaBitDepth ¶
func (MediaBitDepth) Write ¶
func (m MediaBitDepth) Write() string
type MediaClip ¶
type MediaClip interface {
// contains filtered or unexported methods
}
MediaClip is either a Media Clip Data or a Media Clip Section
type MediaClipData ¶
type MediaClipData struct { D MediaClipDataContent // required CT string // optional, MIME, must be ASCII P MediaClipPermission // optional, default to TempNever Alt LanguageArray MH, BE string // optional, ASCII url, written as a dict in PDF }
type MediaClipDataContent ¶
type MediaClipDataContent interface { Referenceable // contains filtered or unexported methods }
MediaClipDataContent is either a file specification or an XForm object
type MediaClipDict ¶
type MediaClipPermission ¶
type MediaClipPermission string
const ( TempNever MediaClipPermission = "TEMPNEVER" TempExtract MediaClipPermission = "TEMPEXTRACT" TempAccess MediaClipPermission = "TEMPACCESS" TempAlways MediaClipPermission = "TEMPALWAYS" )
type MediaClipSection ¶
type MediaClipSection struct { D MediaClipDict // required Alt LanguageArray // optional MH, BE MediaClipSectionLimits // optional }
MediaClipSection defines a continuous section of another media clip object. See Table 277 – Additional entries in a media clip section dictionary
type MediaClipSectionLimits ¶
type MediaClipSectionLimits struct { B MediaOffset // optional (begining) E MediaOffset // optional (end) }
func (MediaClipSectionLimits) IsEmpty ¶
func (m MediaClipSectionLimits) IsEmpty() bool
IsEmpty return true if the dict is empty.
func (MediaClipSectionLimits) Write ¶
func (m MediaClipSectionLimits) Write(pdf PDFWritter, ref Reference) string
type MediaCriteria ¶
type MediaCriteria struct {
A, C, O, S MaybeBool
R MaybeInt
D MediaBitDepth
Z MediaScreenSize
V []SoftwareIdentifier
P [2]Name
L []string
}
MediaCriteria All entry are optional
func (*MediaCriteria) Clone ¶
func (m *MediaCriteria) Clone() *MediaCriteria
func (MediaCriteria) Write ¶
func (m MediaCriteria) Write(pdf PDFWritter, context Reference) string
type MediaDuration ¶
type MediaDuration interface {
// contains filtered or unexported methods
}
MediaDuration is either a name I or F (Name) or a time span (ObjFloat)
var ( MediaDurationIntrinsic MediaDuration = Name("I") MediaDurationInfinite MediaDuration = Name("F") )
type MediaOffset ¶
type MediaOffset interface {
// contains filtered or unexported methods
}
MediaOffset specifies an offset into a media object. It is either:
- a time, in seconds as ObjFloat
- a frame, as ObjInt
- a marker, as ObjStringLitteral
type MediaPlayer ¶
type MediaPlayer struct {
// TODO: PL
MH, BE MediaPlayerParameters // optional
}
func (MediaPlayer) Write ¶
func (m MediaPlayer) Write() string
type MediaPlayerParameters ¶
type MediaPlayerParameters struct { V MaybeInt C bool F MaybeInt // optional 0 to 5 D MediaDuration // optional NotAuto bool // optional, default to false, written in PDF as /A RC MaybeFloat // optional, default to 1, 0 means for repeat for ever }
func (MediaPlayerParameters) Write ¶
func (m MediaPlayerParameters) Write() string
type MediaScreen ¶
type MediaScreen struct {
MH, BE *MediaScreenParams // optional
}
func (MediaScreen) Clone ¶
func (m MediaScreen) Clone() MediaScreen
func (MediaScreen) Write ¶
func (m MediaScreen) Write(w PDFWritter, r Reference) string
type MediaScreenFloatingWindow ¶
type MediaScreenFloatingWindow struct { D [2]int // required, width and height RT, R uint8 P, O MaybeInt T, UC MaybeBool TT LanguageArray }
func (*MediaScreenFloatingWindow) Clone ¶
func (m *MediaScreenFloatingWindow) Clone() *MediaScreenFloatingWindow
func (MediaScreenFloatingWindow) Write ¶
func (m MediaScreenFloatingWindow) Write(w PDFWritter, r Reference) string
type MediaScreenParams ¶
type MediaScreenParams struct { W MaybeInt B *[3]Fl // optional O MaybeFloat M int F *MediaScreenFloatingWindow // optional }
func (*MediaScreenParams) Clone ¶
func (m *MediaScreenParams) Clone() *MediaScreenParams
func (MediaScreenParams) Write ¶
func (m MediaScreenParams) Write(w PDFWritter, r Reference) string
type MediaScreenSize ¶
func (MediaScreenSize) Write ¶
func (m MediaScreenSize) Write() string
type MetadataStream ¶
type MetadataStream struct {
Stream
}
MetadataStream is a stream containing XML metadata, implementing Object
func (MetadataStream) Clone ¶
func (m MetadataStream) Clone() Object
func (MetadataStream) Write ¶
func (m MetadataStream) Write(w PDFWritter, _ Reference) string
type NameDictionary ¶
type NameDictionary struct { EmbeddedFiles EmbeddedFileTree Dests DestTree AP AppearanceTree Pages TemplateTree Templates TemplateTree }
NameDictionary establish the correspondence between names and objects. All fields are optional. TODO: add more names
type NameToAppearance ¶
type NameToAppearance struct { Name string Appearance *XObjectForm }
NameToAppearance associate an appearance stream to a name.
type NameToDest ¶
type NameToDest struct { Name DestinationString Destination DestinationExplicit }
NameToDest associate an explicit destination to a name.
type NameToFile ¶
type NameToPage ¶
type NameToPage struct { Name string Page *PageObject }
type NameToStructureElement ¶
type NameToStructureElement struct { Name string Structure *StructureElement }
------------------------------------------------------------
type NumToPageLabel ¶
type NumToParent ¶
type NumToParent struct { Num int // either Parent or Parents must be non nil Parent *StructureElement Parents []*StructureElement }
NumToParent store the values of `ParentTree`. For an object that is a content item in its own right, the value shall be a *StructureElement, that contains it as a content item. For a page object or content stream containing marked-content sequences that are content items, the value shall be []*StructureElement, parent elements of those marked-content sequences.
type ObjCommand ¶
type ObjCommand string
ObjCommand is a PDF operation found in content streams.
func (ObjCommand) Clone ¶
func (cmd ObjCommand) Clone() Object
func (ObjCommand) Write ¶
func (cmd ObjCommand) Write(PDFWritter, Reference) string
type ObjHexLiteral ¶
type ObjHexLiteral string
ObjHexLiteral represents a PDF hex literal object. Its content is stored not encoded, and will be transformed when writting to a PDF file. When required, text strings must be encoded and encrypted in a first step.
func (ObjHexLiteral) Clone ¶
func (h ObjHexLiteral) Clone() Object
func (ObjHexLiteral) Write ¶
func (h ObjHexLiteral) Write(w PDFWritter, r Reference) string
type ObjIndirectRef ¶
ObjIndirectRef represents a PDF indirect object. This type will be found in a parsed PDF, but not in the model (see the `Reference` type documentation).
func (ObjIndirectRef) Clone ¶
func (ir ObjIndirectRef) Clone() Object
func (ObjIndirectRef) Write ¶
func (ir ObjIndirectRef) Write(PDFWritter, Reference) string
type ObjName ¶
type ObjName string
ObjName is a symbol to be referenced, and it is included in PDF without encoding, by prepending/
type ObjStream ¶
type ObjStream struct { Args ObjDict Content []byte // as written in a PDF file (that is, encoded) }
ObjStream is a stream
type ObjStringLiteral ¶
type ObjStringLiteral string
ObjStringLiteral represents a PDF string literal object. When required, text strings must be encoded and encrypted in a first step: the content of ObjStringLiteral will only be escaped.
func (ObjStringLiteral) Clone ¶
func (s ObjStringLiteral) Clone() Object
func (ObjStringLiteral) Write ¶
func (s ObjStringLiteral) Write(w PDFWritter, r Reference) string
type Object ¶
type Object interface { // Write must return a PDF string representation // of the object. // `PDFWritter` shall be use with strings and streams, // so that they are espaced and crypted accordingly. // This requires the `Reference` value (object number) of the parent object, // which should be forwarded to the `PDFWritter.EncodeString` method. // // When using indirect objects, `PDFWritter` `CreateObject` and `WriteObject` // methods must be used to create the necessary object and returns the string // form of the reference. // // When used in content stream, ecryption is disabled, so the `PDFWritter` // instance will be nil (and `Reference` invalid). Write(writter PDFWritter, parent Reference) string // Clone must return a deep copy of the object, preserving the concrete type. Clone() Object }
Object is a node of a PDF syntax tree.
It serves two purposes:
- representing a PDF file in-memory, before turning it into a Document. In this case, it is obtained from a PDF file by tokenizing and parsing its content, and the concrete types used will be the basic PDF types defined in this file.
- allowing arbitrary user defined content, which is needed for some edge-cases like property list or signature build information. In this case, custom type may be used, but care should be taken to handle indirect objects: when implementing WriteToPDF, new objects must be created using CreateObject.
Note that the PDF null object is represented by its own concrete type, so Object must never be nil.
type Option ¶
Option is either a text string representing one of the available options or an array consisting of two text strings: the option’s export value and the text that shall be displayed as the name of the option.
type Outline ¶
type Outline struct {
First *OutlineItem
}
Outline is the root of the ouline hierarchie
func (*Outline) Count ¶
Count returns the total number of visible outline items at all levels of the outline.
func (*Outline) Flatten ¶
func (o *Outline) Flatten() []*OutlineItem
Flatten return all the leaf objects (open or not)
func (*Outline) Last ¶
func (o *Outline) Last() *OutlineItem
Last returns the last of this item’s immediate children in the outline hierarchy
type OutlineFlag ¶
type OutlineFlag uint8
OutlineFlag specify style characteristics for displaying an outline item.
const ( OutlineItalic OutlineFlag = 1 OutlineBold OutlineFlag = 1 << 2 )
type OutlineItem ¶
type OutlineItem struct { Title string // text string Parent OutlineNode // parent of this item in the outline hierarchy First *OutlineItem // first of this item’s immediate children in the outline hierarchy Next *OutlineItem // next item at this outline level // indicate if this outline item is open // in PDF, it is encoded by the sign of the Count property Open bool Dest Destination // optional A Action // optional SE *StructureElement // optional C [3]Fl // optional, default to [0 0 0] F OutlineFlag // optional, default to 0 }
OutlineItem serves as visual table of contents to display the document’s structure to the user
func (*OutlineItem) Count ¶
func (o *OutlineItem) Count() int
Count returns the number of visible descendent outline items at all level This is the abolute value of the property Count defined in the PDF spec
func (*OutlineItem) Last ¶
func (o *OutlineItem) Last() *OutlineItem
Last returns the last of this item’s immediate children in the outline hierarchy
func (*OutlineItem) Prev ¶
func (o *OutlineItem) Prev() *OutlineItem
Prev returns the previous item at this outline level
type OutlineNode ¶
type OutlineNode interface {
// contains filtered or unexported methods
}
type PDFStringEncoding ¶
type PDFStringEncoding uint8
const ( ByteString PDFStringEncoding = iota // no special treatment, except escaping // ASCIIString // ASCII encoding and escaping HexString // hex form TextString // one of the PDF encoding: PDFDocEncoding or UTF16-BE )
type PDFWritter ¶
type PDFWritter interface { // EncodeString transforms an UTF-8 string `s` to satisfy the PDF // format required by `mode`. // It will also encrypt `s`, if needed, using // `context`, which is the object number of the containing object. // EncodeString may panic if `mode` is not one of `ByteString`, `HexString`, `TextString` EncodeString(s string, mode PDFStringEncoding, context Reference) string // Allocate a new object (used then by `WriteObject`) CreateObject() Reference // WriteObject add the objects content to the output, under the // `ref` object number. // This method should be called at most once for each reference. WriteObject(content string, ref Reference) // WriteStream write the content of the object `ref`, and update the offsets. // This method will be called at most once for each reference. // Stream content will be encrypted if needed and the Length field adjusted. WriteStream(header StreamHeader, stream []byte, ref Reference) }
PDFWritter abstracts away the complexity of writting PDF files. It used internally by the package, but is also exposed to ease the use of custom types implementing `Object`. It will handle strings formatting and encryption, as well as creating indirect objects.
type PageLabelsTree ¶
type PageLabelsTree struct { Kids []PageLabelsTree Nums []NumToPageLabel }
func (PageLabelsTree) Clone ¶
func (p PageLabelsTree) Clone() PageLabelsTree
func (PageLabelsTree) Limits ¶
func (d PageLabelsTree) Limits() [2]int
Limits specify the (numerically) least and greatest keys included in the Nums array of a leaf node or in the Nums arrays of any leaf nodes that are descendants of an intermediate node.
func (PageLabelsTree) LookupTable ¶
func (d PageLabelsTree) LookupTable() map[int]PageLabel
LookupTable walks the number tree and accumulates the result into one map
type PageNode ¶
type PageNode interface { // Count returns the number of Page objects (leaf node) // in all the descendants of `p` (including `p`) Count() int // contains filtered or unexported methods }
PageNode is either a `PageTree` or a `PageObject`
type PageObject ¶
type PageObject struct { // TODO: complete fields Resources *ResourcesDict // if nil, will be inherited from the parent MediaBox *Rectangle // if nil, will be inherited from the parent CropBox *Rectangle // if nil, will be inherited. if still nil, default to MediaBox BleedBox, TrimBox, ArtBox *Rectangle // if nil, default to CropBox // If nil, will be inherited from the parent. // Only multiple of 90 are allowed (see the constants) Rotate Rotation Annots []*AnnotationDict // optional, should not contain annotation widget Contents []ContentStream // array of stream (often of length 1) StructParents MaybeInt // Required if the page contains structural content items Tabs Name // optional, one of R , C or S // contains filtered or unexported fields }
PageObject Since Widget annotation are only used with form fields, we choose to define them only in the AcroForm catalog entry. Thus, no AnnotationWidget should be added to the Annots entry (it will be done automatically when writing the PDF).
func (*PageObject) Count ¶
func (*PageObject) Count() int
Count return the number of PageObject-that is 1
func (*PageObject) DecodeAllContents ¶
func (p *PageObject) DecodeAllContents() ([]byte, error)
DecodeAllContents read each content stream and returns the aggregated one.
type PageTree ¶
type PageTree struct { Kids []PageNode // TODO: complete the inheritable fields Resources *ResourcesDict // if nil, will be inherited from the parent MediaBox *Rectangle // if nil, will be inherited from the parent // contains filtered or unexported fields }
PageTree describe the page hierarchy of a PDF file.
func (*PageTree) Count ¶
Count returns the number of Page objects (leaf node) in all the descendants of `p` (not only in its direct children)
func (PageTree) Flatten ¶
func (p PageTree) Flatten() []*PageObject
Flatten returns all the leaf of the tree, respecting the indexing convention for pages (0-based): the page with index i is Flatten()[i]. Be aware that inherited resource are not resolved (see FlattenInherit)
func (PageTree) FlattenInherit ¶
func (p PageTree) FlattenInherit() []PageObject
FlattenInherit returns all the leaf of the tree, respecting the indexing convention for pages (0-based): the page with index i is FlattenInherit()[i]. The inherited resources are resolved, and the page returned page objects are copied and updated with it.
type ParentTree ¶
type ParentTree struct { Kids []ParentTree Nums []NumToParent }
ParentTree associate to a StructParent or StructParents entry the corresponding *StructureElement(s)
func NewParentTree ¶
func NewParentTree(parents map[int]NumToParent) ParentTree
NewParentTree builds a valid ParentTree from the given maping. The tree should be good enough for most use cases, but you may also build you own. Note that the field `Num` in the `parents` values are ignored: the key in the map is used instead.
func (ParentTree) Limits ¶
func (d ParentTree) Limits() [2]int
func (ParentTree) LookupTable ¶
func (id ParentTree) LookupTable() map[int]NumToParent
LookupTable walks the tree and accumulate the parents into one map.
type Pattern ¶
type Pattern interface { Referenceable // contains filtered or unexported methods }
Pattern is either a Tiling or a Shading pattern
type PatternShading ¶
type PatternShading struct { Shading *ShadingDict // required Matrix Matrix // optionnal, default to Identity ExtGState *GraphicState // optionnal }
PatternShading is a type2 pattern
func (*PatternShading) IsReferenceable ¶
func (*PatternShading) IsReferenceable()
type PatternTiling ¶
type PatternTiling struct { ContentStream PaintType uint8 // 1 for coloured; 2 for uncoloured TilingType uint8 // 1, 2, 3 BBox Rectangle XStep Fl YStep Fl Resources ResourcesDict Matrix Matrix // optional, default to identity }
PatternTiling is a type 1 pattern
func (*PatternTiling) IsReferenceable ¶
func (*PatternTiling) IsReferenceable()
type PropertyList ¶
type PropertyList = ObjDict
PropertyList is a dictionary of custom values. See Metadata for an implementation for the /Metadata key
type RC4SecurityHandler ¶
type RC4SecurityHandler struct {
// contains filtered or unexported fields
}
RC4SecurityHandler stores the various data needed to crypt/decryt a PDF file. It is obtained from user provided passwords and data found in Encrypt dictionnary and file trailer.
func (*RC4SecurityHandler) AuthenticatePasswords ¶
func (s *RC4SecurityHandler) AuthenticatePasswords(ownerPassword, userPassword string, enc EncryptionStandard) ([]byte, bool)
AuthenticatePasswords compare the given passwords to the hash found in a PDF file, returning `true` if one of the password is correct, as well as the encryption key.
type Rectangle ¶
type Rectangle struct {
Llx, Lly, Urx, Ury Fl // lower-left x, lower-left y, upper-right x, and upper-right y coordinates of the rectangle
}
type Reference ¶
type Reference uint32
Reference is the object number of a PDF object. It is only needed to write a document. It differs from the ObjReference type because it is never part of a PDF object, but is only created and used during the write phase. Instead, indirection is represented in the model by standard Go pointers.
type Referenceable ¶
type Referenceable interface { IsReferenceable() // contains filtered or unexported methods }
Referenceable is a private interface implemented by the structures idenfied by pointers. For such a structure, two usage of the same pointer in a `Document` will be written in the PDF file using the same object number, avoiding unnecessary duplications.
type Rendition ¶
type Rendition interface {
// contains filtered or unexported methods
}
Rendition is either a selector or a media rendition
type RenditionDict ¶
type RenditionDict struct { N string // optional Subtype Rendition MH, BE *MediaCriteria // optional, written in PDF as a dict with a C entry }
RenditionDict is either a media rendition or a selector rendition See 13.2.3 - Renditions
type RenditionMedia ¶
type RenditionMedia struct { C MediaClipDict P MediaPlayer SP MediaScreen }
type RenditionSelector ¶
type RenditionSelector struct {
R []RenditionDict
}
type ResourcesColorSpace ¶
type ResourcesColorSpace map[ColorSpaceName]ColorSpace
func (ResourcesColorSpace) Resolve ¶
func (res ResourcesColorSpace) Resolve(cs ColorSpaceName) (ColorSpace, error)
Resolve return the color space in the resource dictionary, taking care of default color spaces. See 8.6.5.6 - Default Colour Spaces
type ResourcesDict ¶
type ResourcesDict struct { ExtGState map[Name]*GraphicState // optional ColorSpace ResourcesColorSpace // optional Shading map[Name]*ShadingDict // optional Pattern map[Name]Pattern // optional Font map[Name]*FontDict // optional XObject map[Name]XObject // optional Properties map[Name]PropertyList // optional }
ResourcesDict maps name to (indirect) ressources
func (*ResourcesDict) IsEmpty ¶
func (r *ResourcesDict) IsEmpty() bool
IsEmpty returns `true` is the resources pointer is either `nil` or all the map are empty; in this case it should not be written in the PDF file.
func (ResourcesDict) ShallowCopy ¶
func (r ResourcesDict) ShallowCopy() ResourcesDict
ShallowCopy returns a new resources dict, with new maps, containing the same pointer values. As a consequence, inserting or deleting resources will not affect the original, but mutating the resources themselves will.
type Rotation ¶
type Rotation uint8
Rotation encodes an optional clock-wise rotation.
func NewRotation ¶
NewRotation validate the input and returns a rotation, which may be unset.
type SecuriyHandler ¶
type SecuriyHandler interface { // compare the given passwords against the hash found in a PDF file, // and return the encryption key and true if they are correct, or false AuthenticatePasswords(ownerPassword, userPassword string, enc EncryptionStandard) ([]byte, bool) }
type SeedDict ¶
type SeedDict struct { Ff SeedFlag // optional, default to 0 Filter Name // optional SubFilter []Name // optional DigestMethod []Name // optional, names among SHA1, SHA256, SHA384, SHA512 and RIPEMD160 V Fl // optional Cert *CertDict // optional Reasons []string // optional, text strings // optional, from 0 to 3 // writen in pdf as a dictionary with entry P MDP MaybeInt TimeStamp *TimeStampDict // optional LegalAttestation []string // optional, text strings AddRevInfo bool // optional, default to false }
type Shading ¶
type Shading interface { Clone() Shading // contains filtered or unexported methods }
Shading is the kind of shading and may be FunctionBased, Axial, Radial, FreeForm, Lattice, Coons, TensorProduct
type ShadingAxial ¶
type ShadingAxial struct { BaseGradient Coords [4]Fl // x0, y0, x1, y1 }
func (ShadingAxial) Clone ¶
func (f ShadingAxial) Clone() Shading
Clone returns a deep copy with concrete type `Axial`
type ShadingCoons ¶
type ShadingCoons ShadingFreeForm
func (ShadingCoons) Clone ¶
func (co ShadingCoons) Clone() Shading
Clone returns a deep copy with concrete type `ShadingCoons`
type ShadingDict ¶
type ShadingDict struct { ShadingType Shading ColorSpace ColorSpace // required // colour components appropriate to the colour space // only applied when part of a (shading) pattern Background []Fl // optional BBox *Rectangle // optional in shading’s target coordinate space AntiAlias bool // optional, default to false }
ShadingDict is either a plain dict, or is a stream (+ dict)
func (*ShadingDict) IsReferenceable ¶
func (*ShadingDict) IsReferenceable()
type ShadingFreeForm ¶
type ShadingFreeForm struct { ShadingStream BitsPerFlag uint8 // 2, 4, or 8 }
func (ShadingFreeForm) Clone ¶
func (co ShadingFreeForm) Clone() Shading
Clone returns a deep copy with concrete type `ShadingFreeForm`
type ShadingFunctionBased ¶
type ShadingFunctionBased struct { Domain [4]Fl // optional, default to [0 1 0 1] Matrix Matrix // optional, default to identity Function []FunctionDict // either one 2 -> n function, or n 2 -> 1 functions }
func (ShadingFunctionBased) Clone ¶
func (f ShadingFunctionBased) Clone() Shading
Clone returns a deep copy with concrete type `FunctionBased`
type ShadingLattice ¶
type ShadingLattice struct { ShadingStream VerticesPerRow int // required }
func (ShadingLattice) Clone ¶
func (co ShadingLattice) Clone() Shading
Clone returns a deep copy with concrete type `ShadingLattice`
type ShadingRadial ¶
type ShadingRadial struct { BaseGradient Coords [6]Fl // x0, y0, r0, x1, y1, r1 }
func (ShadingRadial) Clone ¶
func (f ShadingRadial) Clone() Shading
Clone returns a deep copy with concrete type `Radial`
type ShadingStream ¶
type ShadingStream struct { Stream BitsPerCoordinate uint8 // 1, 2, 4, 8, 12, 16, 24, or 32 BitsPerComponent uint8 // 1, 2, 4, 8, 12, or 16 Decode [][2]Fl Function []FunctionDict // optional, one 1->n function or n 1->1 functions (n is the number of colour components) }
ShadingStream is the base type shared by 4 to 7 shadings type
func (ShadingStream) Clone ¶
func (ss ShadingStream) Clone() ShadingStream
Clone returns a deep copy
type ShadingTensorProduct ¶
type ShadingTensorProduct ShadingFreeForm
func (ShadingTensorProduct) Clone ¶
func (co ShadingTensorProduct) Clone() Shading
Clone returns a deep copy with concrete type `ShadingTensorProduct`
type SignatureDict ¶
type SignatureDict struct { Filter Name // optional SubFilter Name // optional Contents string // byte string, written as hexadecimal in PDF Cert []string // optional, byte strings. One-element arrays may be written in PDF a a single byte string ByteRange [][2]int // optional. Written in PDF as an array of pairs Reference []SignatureRefDict // optional Changes [3]int // optional Name string // optional, text string M time.Time // optional Location string // optional, text string Reason string // optional, text string ContactInfo string // optional, text string V int // optional // Prop_Build is implementation-specific by design. // It can be used to store audit information that is specific to the software application // that was used to create the signature. Prop_Build Object // optional Prop_AuthTime time.Time // optional Prop_AuthType Name // optional }
func (*SignatureDict) Clone ¶
func (s *SignatureDict) Clone() *SignatureDict
Clone returns a deep copy
type SignatureFlag ¶
type SignatureFlag uint32
const ( SignaturesExist SignatureFlag = 1 AppendOnly SignatureFlag = 1 << 1 )
type SignatureRefDict ¶
type SignatureRefDict struct { TransformMethod Name // among DocMDP, UR, FieldMDP TransformParams Transform DigestMethod Name }
SignatureRefDict is a signature reference dictionary Note: The SPEC does not restrict the Data attribute, but we, as other libraries, do: we only allow it to point to the Catalog.
func (SignatureRefDict) Clone ¶
func (s SignatureRefDict) Clone() SignatureRefDict
Clone returns a deep copy
type SimpleEncoding ¶
type SimpleEncoding interface {
// contains filtered or unexported methods
}
SimpleEncoding is a font encoding for simple fonts
func NewSimpleEncodingPredefined ¶
func NewSimpleEncodingPredefined(s string) SimpleEncoding
NewSimpleEncodingPredefined validated the string `s` and return either a valid `PredefinedEncoding` or nil
type SimpleEncodingDict ¶
type SimpleEncodingDict struct { BaseEncoding SimpleEncodingPredefined // optionnal Differences Differences // optionnal }
func (*SimpleEncodingDict) IsReferenceable ¶
func (*SimpleEncodingDict) IsReferenceable()
type SimpleEncodingPredefined ¶
type SimpleEncodingPredefined Name
const ( MacRomanEncoding SimpleEncodingPredefined = "MacRomanEncoding" MacExpertEncoding SimpleEncodingPredefined = "MacExpertEncoding" WinAnsiEncoding SimpleEncodingPredefined = "WinAnsiEncoding" )
type SoftMaskDict ¶
type SoftMaskDict struct { S Name // required G *XObjectTransparencyGroup // required BC []Fl // optional, length: number of color components // Optional. nil means the same as the /Identity name TR *FunctionDict }
SoftMaskDict See Table 144 – Entries in a soft-mask dictionary In addition, we use the following convention:
- S == "" means 'nil' (not specified)
- S == /None means the name None
- other value means normal dictionary
type SoftwareIdentifier ¶
type SoftwareIdentifier struct { U string // required, ASCII string L, H []int LI, HI MaybeBool OS []string }
Table 292 – Entries in a software identifier dictionary
func (SoftwareIdentifier) Clone ¶
func (s SoftwareIdentifier) Clone() SoftwareIdentifier
func (SoftwareIdentifier) Write ¶
func (s SoftwareIdentifier) Write(pdf PDFWritter, context Reference) string
type Stream ¶
Stream is a PDF stream.
A new stream can be created by applying the filters described in `Stream.Filters` to the non-filtered data to obtain `Content`.
func NewCompressedStream ¶
NewCompressedStream compress the given content using zlib, and return the corresponding Stream.
func (Stream) Decode ¶
Decode attemps to apply the Filters to decode its content. Be aware that not all PDF filters are supported (see filters.List).
func (Stream) PDFCommonFields ¶
func (s Stream) PDFCommonFields(withLength bool) StreamHeader
PDFCommonArgs returns the content of the Dictionary of `s` without the enclosing << >>. It will usually be used in combination with other fields.
func (Stream) PDFContent ¶
func (s Stream) PDFContent() (StreamHeader, []byte)
PDFContent return the stream object content. Often, additional arguments will be needed, so `PDFCommonFields` should be used instead.
type StreamHeader ¶
WrittenObject represents a PDF object to write on a file. This intermediate representation makes to possible to modify object just before writting them, as needed for instance for the Length attribute of encrypted streams.
func (StreamHeader) PDFContent ¶
func (w StreamHeader) PDFContent() []byte
type StructParentObject ¶
type StructParentObject interface { Referenceable // isStructParentObject() GetStructParent() MaybeInt }
StructParentObject identifies the PDF object that may be reference in the Structure Tree, that is, the objects that have a StructParent entry. It may be one of *AnnotationDict, *XObjectForm or *XObjectImage
type StructureElement ¶
type StructureElement struct { S Name P *StructureElement // parent ID string // byte string, optional Pg *PageObject // optional K []ContentItem // 1-array may be written in PDF directly A []AttributeObject // 1-array may be written in PDF directly C []ClassName // 1-array may be written in PDF directly R int // optional, revision number T string // optional, text string Lang string // optional, text string Alt string // optional, text string E string // optional, text string ActualText string // optional, text string }
type StructureTree ¶
type StructureTree struct { K []*StructureElement // 1-array may be written in PDF directly as a dict IDTree IDTree ParentTree ParentTree RoleMap map[Name]Name ClassMap map[Name][]AttributeObject // for each key, 1-array may be written in PDF directly }
StructureTree is the root of the structure tree.
When read from an existing file, `IDTree` and `ParentTree` will be filled. However, when creating a new structure tree, since the information is mostly redundant (only the shape of the trees are to choose), `BuildIDTree` and `BuildParentTree` may be used as a convenience.
func (*StructureTree) BuildIDTree ¶
func (s *StructureTree) BuildIDTree()
BuildIdTree walks through the structure, looking for the /ID of the structure elements and build a valid ParentTree, updating `s`. It should be good enough for most use case, but when a custom shape for the tree is needed, the `IDTree` attribut may be set directly.
func (*StructureTree) BuildParentTree ¶
func (s *StructureTree) BuildParentTree()
BuildParentTree walks through the structure, looking for the ∕StructParent and /StructParents of the target of the structure elements and build a valid ParentTree, updating `s`. It should be good enough for most use case, but when a custom shape for the tree is needed, the `ParentTree` attribut may be set directly.
func (StructureTree) ParentTreeNextKey ¶
func (s StructureTree) ParentTreeNextKey() int
An integer greater than any key in the parent tree, which shall be used as a key for the next entry added to the tree
type TemplateTree ¶
type TemplateTree struct { Kids []TemplateTree Names []NameToPage }
TemplateTree is both the Templates and the Pages entry of the name dictionary
func (TemplateTree) IsEmpty ¶
func (d TemplateTree) IsEmpty() bool
IsEmpty returns true if the tree is empty and should not be written in the PDF file.
func (TemplateTree) Limits ¶
func (d TemplateTree) Limits() [2]string
Limits specify the (lexically) 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.
func (TemplateTree) LookupTable ¶
func (d TemplateTree) LookupTable() map[string]*PageObject
LookupTable walks the name tree and accumulates the result into one map
type TimeStampDict ¶
type TimeStampDict struct { URL string // URL must be ASCII string Ff uint8 // 0 or 1, default to 0 }
func (*TimeStampDict) Clone ¶
func (t *TimeStampDict) Clone() *TimeStampDict
type Trailer ¶
type Transform ¶
type Transform interface { // Clone returns a deep copy of the transform, preserving the concrete type. Clone() Transform // contains filtered or unexported methods }
Transform determines which objects are included and excluded in revision comparison
type TransformDocMDP ¶
func (TransformDocMDP) Clone ¶
func (t TransformDocMDP) Clone() Transform
type TransformFieldMDP ¶
type TransformFieldMDP struct { Action Name Fields []string // text strings, optional is Action == All V Name }
TransformFieldMDP is used to detect changes to the values of a list of form fields.
func (TransformFieldMDP) Clone ¶
func (t TransformFieldMDP) Clone() Transform
type TransformUR ¶
type TransformUR struct { Document []Name // optional Msg string // optional, text string V Name // optional Annots []Name // optional Form []Name // optional Signature []Name // optional EF []Name // optional P bool // optional }
func (TransformUR) Clone ¶
func (t TransformUR) Clone() Transform
type UnicodeCMap ¶
type UnicodeCMap struct { Stream UseCMap UnicodeCMapBase // optional }
UnicodeCMap is stream object containing a special kind of CMap file that maps character codes to Unicode values.
type UnicodeCMapBase ¶
type UnicodeCMapBase interface {
// contains filtered or unexported methods
}
UnicodeCMapBase is either the name of a predifined CMap or an other UnicodeCMap stream
type UnicodeCMapBasePredefined ¶
type UnicodeCMapBasePredefined Name
type UserPermissions ¶
type UserPermissions uint32
UserPermissions is a flag. See Table 22 – User access permissions and Table 24 – Public-Key security handler user access permissions in the PDF SPEC.
const ( PermissionChangeEncryption UserPermissions = 1 << (2 - 1) // Permits change of encryption and enables all other permissions. PermissionPrint UserPermissions = 1 << (3 - 1) // Print the document. PermissionModify UserPermissions = 1 << (4 - 1) // Modify the contents of the document by operations other than those controlled by bits 6, 9, and 11. PermissionCopy UserPermissions = 1 << (5 - 1) // Copy or otherwise extract text and graphics from the document PermissionAdd UserPermissions = 1 << (6 - 1) // Add or modify text annotations, fill in interactive form fields PermissionFill UserPermissions = 1 << (9 - 1) // Fill in existing interactive form fields PermissionExtract UserPermissions = 1 << (10 - 1) // Extract text and graphics PermissionAssemble UserPermissions = 1 << (11 - 1) // Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images) PermissionPrintDigital UserPermissions = 1 << (12 - 1) // Print the document to a representation from which a faithful digital copy of the PDF content could be generated. )
type UserProperty ¶
type UserProperty struct { N string // required V Object // required F string // optional H bool // optional }
func (UserProperty) Write ¶
func (u UserProperty) Write(enc PDFWritter, context Reference) string
type VerticalMetric ¶
VerticalMetric is found in PDF as 3 numbers
func (VerticalMetric) String ¶
func (v VerticalMetric) String() string
type ViewerPreferences ¶
type ViewerPreferences struct { FitWindow bool CenterWindow bool // right to left: determine the relative positioning // of pages when displayed side by side or printed n-up DirectionRTL bool }
ViewerPreferences specifies the way the document shall be displayed on the screen. TODO: ViewerPreferences extend the fields
type XObject ¶
type XObject interface { Referenceable // contains filtered or unexported methods }
XObject is either an image or PDF form (*XObjectForm or *XObjectTransparencyGroup)
type XObjectForm ¶
type XObjectForm struct { ContentStream BBox Rectangle Matrix Matrix // optional, default to identity Resources ResourcesDict // optional // Integer key of the form XObject’s entry in the structural parent tree. // At most one of the entries StructParent or StructParents shall be // present: a form XObject shall be either a content item in its entirety (StructParent) or // a container for marked-content sequences that are content items (StructParents), but // not both. // Optional StructParent, StructParents MaybeInt }
XObjectForm is a is a self-contained description of an arbitrary sequence of graphics objects
func (*XObjectForm) GetStructParent ¶
func (a *XObjectForm) GetStructParent() MaybeInt
GetStructParent implements StructParentObject
func (*XObjectForm) IsReferenceable ¶
func (*XObjectForm) IsReferenceable()
type XObjectImage ¶
type XObjectImage struct { Image ColorSpace ColorSpace // optional, any type of colour space except Pattern Alternates []AlternateImage // optional Mask Mask // optional SMask *ImageSMask // optional SMaskInData uint8 // optional, 0, 1 or 2 StructParent MaybeInt // required if the image is a structural content item }
XObjectImage represents a sampled visual image such as a photograph
func (*XObjectImage) GetStructParent ¶
func (img *XObjectImage) GetStructParent() MaybeInt
GetStructParent implements StructParentObject
func (*XObjectImage) IsReferenceable ¶
func (*XObjectImage) IsReferenceable()
type XObjectTransparencyGroup ¶
type XObjectTransparencyGroup struct { XObjectForm // the followings are written in PDF under a /Group dict. CS ColorSpace I bool // optional, default value: false K bool // optional, default value: false }
XObjectTransparencyGroup is a sequence of consecutive objects in a transparency stack that shall be collected together and composited to produce a single colour, shape, and opacity at each point. The result shall then be treated as if it were a single object for subsequent compositing operations. Groups may be nested within other groups to form a tree-structured group hierarchy. See Table 147 – Additional entries specific to a transparency group attributes dictionary
func (*XObjectTransparencyGroup) IsReferenceable ¶
func (*XObjectTransparencyGroup) IsReferenceable()