HomeUniDoc
...

Package model

Overview ▾

Package model provides an interface for working with high-level objects (models) in PDF files, including reading and writing documents.

The document structure of a PDF is constructed of a hierarchy of data models, representing a tree of information starting from the Document catalog (Figure 5 p. 80). It is based on the core package which handles core functionality such as file i/o, parsing and handling of primitive PDF objects (core.PdfObject).

As an example of the interface, the following snippet can read the PDF and output the number of pages:

f, err := os.Open(inputPath)
	if err != nil {
	return nil, err
}
defer f.Close()
pdfReader, err := unipdf.NewPdfReader(f)
if err != nil {
	fmt.Printf("Failed to read PDF file: %v\n", err)
	os.Exit(1)
}
numPages, err := pdfReader.GetNumPages()
if err != nil {
	fmt.Printf("Failed to get number of pages: %v\n", err)
	os.Exit(1)
}
fmt.Printf("The PDF file has %d pages\n", numPages)

For more examples, see the unidoc-examples repository on GitHub: https://github.com/unidoc/unidoc-examples

Index ▾

Constants
Variables
func DetermineColorspaceNameFromPdfObject(obj core.PdfObject) (core.PdfObjectName, error)
func GetAlphabet(text string) map[rune]int
func SetImageHandler(imgHandling ImageHandler)
func SetPdfAuthor(author string)
func SetPdfCreationDate(creationDate time.Time)
func SetPdfCreator(creator string)
func SetPdfKeywords(keywords string)
func SetPdfModifiedDate(modifiedDate time.Time)
func SetPdfProducer(producer string)
func SetPdfSubject(subject string)
func SetPdfTitle(title string)
type AcroFormRepairOptions
type AlphaMapFunc
type AnnotFilterFunc
type BorderEffect
type BorderStyle
    func (bs *BorderStyle) GetPdfName() string
type ButtonType
type CharMetrics
type CompliancePdfReader
    func NewCompliancePdfReader(rs io.ReadSeeker) (*CompliancePdfReader, error)
    func (r *CompliancePdfReader) ParserMetadata() core.ParserMetadata
type ContentStreamWrapper
type DSS
    func NewDSS() *DSS
    func (dss *DSS) AddCRLs(crls [][]byte) ([]*core.PdfObjectStream, error)
    func (dss *DSS) AddCerts(certs [][]byte) ([]*core.PdfObjectStream, error)
    func (dss *DSS) AddOCSPs(ocsps [][]byte) ([]*core.PdfObjectStream, error)
    func (dss *DSS) GenerateHashMaps() error
    func (dss *DSS) GetContainingPdfObject() core.PdfObject
    func (dss *DSS) ToPdfObject() core.PdfObject
type DefaultImageHandler
    func (ih DefaultImageHandler) Compress(input *Image, quality int64) (*Image, error)
    func (ih DefaultImageHandler) NewGrayImageFromGoImage(goimg goimage.Image) (*Image, error)
    func (ih DefaultImageHandler) NewImageFromGoImage(goimg goimage.Image) (*Image, error)
    func (ih DefaultImageHandler) Read(reader io.Reader) (*Image, error)
type Direction
type Duplex
type EmbeddedFile
    func NewEmbeddedFile(path string) (*EmbeddedFile, error)
    func NewEmbeddedFileFromContent(content []byte) (*EmbeddedFile, error)
    func NewEmbeddedFileFromObject(obj core.PdfObject) (*EmbeddedFile, error)
    func (ef *EmbeddedFile) ToPdfObject() core.PdfObject
type EncryptOptions
type EncryptionAlgorithm
type FieldAppearanceGenerator
type FieldFilterFunc
type FieldFlag
    func (flag FieldFlag) Clear(fl FieldFlag) FieldFlag
    func (flag FieldFlag) Has(fl FieldFlag) bool
    func (flag FieldFlag) Mask() uint32
    func (flag FieldFlag) Set(fl FieldFlag) FieldFlag
    func (flag FieldFlag) String() string
type FieldFlattenOpts
type FieldImageProvider
type FieldValueProvider
type FileRelationship
type Hasher
type IDTree
    func (t *IDTree) ToPdfObject() core.PdfObject
type Image
    func (img *Image) AlphaMap(mapFunc AlphaMapFunc)
    func (img *Image) ColorAt(x, y int) (gocolor.Color, error)
    func (img *Image) ConvertToBinary() error
    func (img *Image) GetParamsDict() *core.PdfObjectDictionary
    func (img *Image) GetSamples() []uint32
    func (img *Image) Resample(targetBitsPerComponent int64)
    func (img *Image) SetAlpha(alpha []byte)
    func (img *Image) SetDecode(decode []float64)
    func (img *Image) SetSamples(samples []uint32)
    func (img *Image) ToGoImage() (goimage.Image, error)
    func (img *Image) ToJBIG2Image() (*core.JBIG2Image, error)
type ImageHandler
type KDict
    func NewKDictionary() *KDict
    func (k *KDict) AddChild(kv *KValue)
    func (k *KDict) AddKChild(kChild *KDict)
    func (k *KDict) AddMCIDChild(mcid int)
    func (k *KDict) AddRefChild(kChild *core.PdfObjectDictionary)
    func (k *KDict) GenerateRandomID() string
    func (k *KDict) GetChildren() []*KValue
    func (k *KDict) GetPageNumber() int64
    func (k *KDict) SetBoundingBox(x, y, width, height float64)
    func (k *KDict) SetPage(page *core.PdfIndirectObject)
    func (k *KDict) SetPageNumber(pageNumber int64)
    func (k *KDict) ToPdfObject() core.PdfObject
type KValue
    func NewKValue() *KValue
    func (kv *KValue) Clear()
    func (kv *KValue) GetKDict() *KDict
    func (kv *KValue) GetMCID() *int
    func (kv *KValue) GetRefObject() core.PdfObject
    func (kv *KValue) SetKDict(kDict *KDict)
    func (kv *KValue) SetMCID(mcid int)
    func (kv *KValue) SetRefObject(refObject core.PdfObject)
    func (kv *KValue) ToPdfObject() core.PdfObject
type LTV
    func NewLTV(appender *PdfAppender) (*LTV, error)
    func (l *LTV) Enable(sig *PdfSignature, extraCerts []*x509.Certificate) error
    func (l *LTV) EnableAll(extraCerts []*x509.Certificate) error
    func (l *LTV) EnableByName(name string, extraCerts []*x509.Certificate) error
    func (l *LTV) EnableChain(chain []*x509.Certificate) error
type MultipleFontEncoder
    func NewMultipleFontEncoder(fonts []*PdfFont) *MultipleFontEncoder
    func (mfe *MultipleFontEncoder) Encoder(rn rune) (textencoding.TextEncoder, bool)
    func (mfe *MultipleFontEncoder) GetRuneMetrics(r rune) (fonts.CharMetrics, bool)
    func (mfe *MultipleFontEncoder) Reset()
type Names
    func (n *Names) ToPdfObject() core.PdfObject
type NonFullScreenPageMode
type Optimizer
type Outline
    func NewOutline() *Outline
    func (o *Outline) Add(item *OutlineItem)
    func (o *Outline) Insert(index uint, item *OutlineItem)
    func (o *Outline) Items() []*OutlineItem
    func (o *Outline) ToOutlineTree() *PdfOutlineTreeNode
    func (o *Outline) ToPdfObject() core.PdfObject
    func (o *Outline) ToPdfOutline() *PdfOutline
type OutlineDest
    func NewOutlineDest(page int64, x, y float64) OutlineDest
    func (od OutlineDest) ToPdfObject() core.PdfObject
type OutlineItem
    func NewOutlineItem(title string, dest OutlineDest) *OutlineItem
    func (oi *OutlineItem) Add(item *OutlineItem)
    func (oi *OutlineItem) Insert(index uint, item *OutlineItem)
    func (oi *OutlineItem) Items() []*OutlineItem
    func (oi *OutlineItem) ToPdfObject() core.PdfObject
    func (oi *OutlineItem) ToPdfOutlineItem() (*PdfOutlineItem, int64)
type PageBoundary
type PageCallback
type PageProcessCallback
type PdfAcroForm
    func NewPdfAcroForm() *PdfAcroForm
    func (form *PdfAcroForm) AllFields() []*PdfField
    func (form *PdfAcroForm) Fill(provider FieldValueProvider) error
    func (form *PdfAcroForm) FillWithAppearance(provider FieldValueProvider, appGen FieldAppearanceGenerator) error
    func (form *PdfAcroForm) GetContainingPdfObject() core.PdfObject
    func (form *PdfAcroForm) ToPdfObject() core.PdfObject
type PdfAction
    func NewPdfAction() *PdfAction
    func (a *PdfAction) GetContainingPdfObject() core.PdfObject
    func (a *PdfAction) GetContext() PdfModel
    func (a *PdfAction) SetContext(ctx PdfModel)
    func (a *PdfAction) String() string
    func (a *PdfAction) ToPdfObject() core.PdfObject
type PdfActionGoTo
    func NewPdfActionGoTo() *PdfActionGoTo
    func (gotoAct *PdfActionGoTo) ToPdfObject() core.PdfObject
type PdfActionGoTo3DView
    func NewPdfActionGoTo3DView() *PdfActionGoTo3DView
    func (goTo3DViewAct *PdfActionGoTo3DView) ToPdfObject() core.PdfObject
type PdfActionGoToE
    func NewPdfActionGoToE() *PdfActionGoToE
    func (gotoEAct *PdfActionGoToE) ToPdfObject() core.PdfObject
type PdfActionGoToR
    func NewPdfActionGoToR() *PdfActionGoToR
    func (gotoRAct *PdfActionGoToR) ToPdfObject() core.PdfObject
type PdfActionHide
    func NewPdfActionHide() *PdfActionHide
    func (hideAct *PdfActionHide) ToPdfObject() core.PdfObject
type PdfActionImportData
    func NewPdfActionImportData() *PdfActionImportData
    func (importDataAct *PdfActionImportData) ToPdfObject() core.PdfObject
type PdfActionJavaScript
    func NewPdfActionJavaScript() *PdfActionJavaScript
    func (javaScriptAct *PdfActionJavaScript) ToPdfObject() core.PdfObject
type PdfActionLaunch
    func NewPdfActionLaunch() *PdfActionLaunch
    func (launchAct *PdfActionLaunch) ToPdfObject() core.PdfObject
type PdfActionMovie
    func NewPdfActionMovie() *PdfActionMovie
    func (movieAct *PdfActionMovie) ToPdfObject() core.PdfObject
type PdfActionNamed
    func NewPdfActionNamed() *PdfActionNamed
    func (namedAct *PdfActionNamed) ToPdfObject() core.PdfObject
type PdfActionRendition
    func NewPdfActionRendition() *PdfActionRendition
    func (renditionAct *PdfActionRendition) ToPdfObject() core.PdfObject
type PdfActionResetForm
    func NewPdfActionResetForm() *PdfActionResetForm
    func (resetFormAct *PdfActionResetForm) ToPdfObject() core.PdfObject
type PdfActionSetOCGState
    func NewPdfActionSetOCGState() *PdfActionSetOCGState
    func (setOCGStateAct *PdfActionSetOCGState) ToPdfObject() core.PdfObject
type PdfActionSound
    func NewPdfActionSound() *PdfActionSound
    func (soundAct *PdfActionSound) ToPdfObject() core.PdfObject
type PdfActionSubmitForm
    func NewPdfActionSubmitForm() *PdfActionSubmitForm
    func (submitFormAct *PdfActionSubmitForm) ToPdfObject() core.PdfObject
type PdfActionThread
    func NewPdfActionThread() *PdfActionThread
    func (threadAct *PdfActionThread) ToPdfObject() core.PdfObject
type PdfActionTrans
    func NewPdfActionTrans() *PdfActionTrans
    func (transAct *PdfActionTrans) ToPdfObject() core.PdfObject
type PdfActionType
type PdfActionURI
    func NewPdfActionURI() *PdfActionURI
    func (uriAct *PdfActionURI) ToPdfObject() core.PdfObject
type PdfAnnotation
    func NewPdfAnnotation() *PdfAnnotation
    func (a *PdfAnnotation) GetContainingPdfObject() core.PdfObject
    func (a *PdfAnnotation) GetContext() PdfModel
    func (a *PdfAnnotation) SetContext(ctx PdfModel)
    func (a *PdfAnnotation) String() string
    func (a *PdfAnnotation) ToPdfObject() core.PdfObject
type PdfAnnotation3D
    func NewPdfAnnotation3D() *PdfAnnotation3D
    func (a3d *PdfAnnotation3D) ToPdfObject() core.PdfObject
type PdfAnnotationCaret
    func NewPdfAnnotationCaret() *PdfAnnotationCaret
    func (caret *PdfAnnotationCaret) ToPdfObject() core.PdfObject
type PdfAnnotationCircle
    func NewPdfAnnotationCircle() *PdfAnnotationCircle
    func (circle *PdfAnnotationCircle) ToPdfObject() core.PdfObject
type PdfAnnotationFileAttachment
    func NewPdfAnnotationFileAttachment() *PdfAnnotationFileAttachment
    func (file *PdfAnnotationFileAttachment) ToPdfObject() core.PdfObject
type PdfAnnotationFreeText
    func NewPdfAnnotationFreeText() *PdfAnnotationFreeText
    func (ft *PdfAnnotationFreeText) ToPdfObject() core.PdfObject
type PdfAnnotationHighlight
    func NewPdfAnnotationHighlight() *PdfAnnotationHighlight
    func (hl *PdfAnnotationHighlight) ToPdfObject() core.PdfObject
type PdfAnnotationInk
    func NewPdfAnnotationInk() *PdfAnnotationInk
    func (ink *PdfAnnotationInk) ToPdfObject() core.PdfObject
type PdfAnnotationLine
    func NewPdfAnnotationLine() *PdfAnnotationLine
    func (line *PdfAnnotationLine) ToPdfObject() core.PdfObject
type PdfAnnotationLink
    func NewPdfAnnotationLink() *PdfAnnotationLink
    func (link *PdfAnnotationLink) GetAction() (*PdfAction, error)
    func (link *PdfAnnotationLink) SetAction(action *PdfAction)
    func (link *PdfAnnotationLink) ToPdfObject() core.PdfObject
type PdfAnnotationMarkup
type PdfAnnotationMovie
    func NewPdfAnnotationMovie() *PdfAnnotationMovie
    func (mov *PdfAnnotationMovie) ToPdfObject() core.PdfObject
type PdfAnnotationPolyLine
    func NewPdfAnnotationPolyLine() *PdfAnnotationPolyLine
    func (polyl *PdfAnnotationPolyLine) ToPdfObject() core.PdfObject
type PdfAnnotationPolygon
    func NewPdfAnnotationPolygon() *PdfAnnotationPolygon
    func (poly *PdfAnnotationPolygon) ToPdfObject() core.PdfObject
type PdfAnnotationPopup
    func NewPdfAnnotationPopup() *PdfAnnotationPopup
    func (popup *PdfAnnotationPopup) ToPdfObject() core.PdfObject
type PdfAnnotationPrinterMark
    func NewPdfAnnotationPrinterMark() *PdfAnnotationPrinterMark
    func (pm *PdfAnnotationPrinterMark) ToPdfObject() core.PdfObject
type PdfAnnotationProjection
    func NewPdfAnnotationProjection() *PdfAnnotationProjection
    func (proj *PdfAnnotationProjection) ToPdfObject() core.PdfObject
type PdfAnnotationRedact
    func NewPdfAnnotationRedact() *PdfAnnotationRedact
    func (redact *PdfAnnotationRedact) ToPdfObject() core.PdfObject
type PdfAnnotationRichMedia
    func NewPdfAnnotationRichMedia() *PdfAnnotationRichMedia
    func (rm *PdfAnnotationRichMedia) ToPdfObject() core.PdfObject
type PdfAnnotationScreen
    func NewPdfAnnotationScreen() *PdfAnnotationScreen
    func (scr *PdfAnnotationScreen) ToPdfObject() core.PdfObject
type PdfAnnotationSound
    func NewPdfAnnotationSound() *PdfAnnotationSound
    func (snd *PdfAnnotationSound) ToPdfObject() core.PdfObject
type PdfAnnotationSquare
    func NewPdfAnnotationSquare() *PdfAnnotationSquare
    func (sq *PdfAnnotationSquare) ToPdfObject() core.PdfObject
type PdfAnnotationSquiggly
    func NewPdfAnnotationSquiggly() *PdfAnnotationSquiggly
    func (squiggly *PdfAnnotationSquiggly) ToPdfObject() core.PdfObject
type PdfAnnotationStamp
    func NewPdfAnnotationStamp() *PdfAnnotationStamp
    func (stamp *PdfAnnotationStamp) ToPdfObject() core.PdfObject
type PdfAnnotationStrikeOut
    func NewPdfAnnotationStrikeOut() *PdfAnnotationStrikeOut
    func (strikeo *PdfAnnotationStrikeOut) ToPdfObject() core.PdfObject
type PdfAnnotationText
    func NewPdfAnnotationText() *PdfAnnotationText
    func (text *PdfAnnotationText) ToPdfObject() core.PdfObject
type PdfAnnotationTrapNet
    func NewPdfAnnotationTrapNet() *PdfAnnotationTrapNet
    func (trapn *PdfAnnotationTrapNet) ToPdfObject() core.PdfObject
type PdfAnnotationUnderline
    func NewPdfAnnotationUnderline() *PdfAnnotationUnderline
    func (underline *PdfAnnotationUnderline) ToPdfObject() core.PdfObject
type PdfAnnotationWatermark
    func NewPdfAnnotationWatermark() *PdfAnnotationWatermark
    func (wm *PdfAnnotationWatermark) ToPdfObject() core.PdfObject
type PdfAnnotationWidget
    func NewPdfAnnotationWidget() *PdfAnnotationWidget
    func (widget *PdfAnnotationWidget) Field() *PdfField
    func (widget *PdfAnnotationWidget) ToPdfObject() core.PdfObject
type PdfAppender
    func NewPdfAppender(reader *PdfReader) (*PdfAppender, error)
    func NewPdfAppenderWithOpts(reader *PdfReader, opts *ReaderOpts, encryptOptions *EncryptOptions) (*PdfAppender, error)
    func (a *PdfAppender) AddPages(pages ...*PdfPage)
    func (a *PdfAppender) GetDSS() (dss *DSS)
    func (a *PdfAppender) MergePageWith(pageNum int, page *PdfPage) error
    func (a *PdfAppender) RemovePage(pageNum int)
    func (a *PdfAppender) ReplaceAcroForm(acroForm *PdfAcroForm)
    func (a *PdfAppender) ReplacePage(pageNum int, page *PdfPage)
    func (a *PdfAppender) SetDSS(dss *DSS)
    func (a *PdfAppender) SetDocInfo(info *PdfInfo)
    func (a *PdfAppender) Sign(pageNum int, field *PdfFieldSignature) error
    func (a *PdfAppender) UpdateObject(obj core.PdfObject)
    func (a *PdfAppender) UpdatePage(page *PdfPage)
    func (a *PdfAppender) Write(w io.Writer) error
    func (a *PdfAppender) WriteToFile(outputPath string) error
type PdfBorderEffect
type PdfBorderStyle
    func NewBorderStyle() *PdfBorderStyle
    func (bs *PdfBorderStyle) GetBorderWidth() float64
    func (bs *PdfBorderStyle) SetBorderWidth(width float64)
    func (bs *PdfBorderStyle) ToPdfObject() core.PdfObject
type PdfColor
type PdfColorCalGray
    func NewPdfColorCalGray(grayVal float64) *PdfColorCalGray
    func (col *PdfColorCalGray) GetNumComponents() int
    func (col *PdfColorCalGray) ToInteger(bits int) uint32
    func (col *PdfColorCalGray) Val() float64
type PdfColorCalRGB
    func NewPdfColorCalRGB(a, b, c float64) *PdfColorCalRGB
    func (col *PdfColorCalRGB) A() float64
    func (col *PdfColorCalRGB) B() float64
    func (col *PdfColorCalRGB) C() float64
    func (col *PdfColorCalRGB) GetNumComponents() int
    func (col *PdfColorCalRGB) ToInteger(bits int) [3]uint32
type PdfColorDeviceCMYK
    func NewPdfColorDeviceCMYK(c, m, y, k float64) *PdfColorDeviceCMYK
    func (col *PdfColorDeviceCMYK) C() float64
    func (col *PdfColorDeviceCMYK) GetNumComponents() int
    func (col *PdfColorDeviceCMYK) K() float64
    func (col *PdfColorDeviceCMYK) M() float64
    func (col *PdfColorDeviceCMYK) ToInteger(bits int) [4]uint32
    func (col *PdfColorDeviceCMYK) Y() float64
type PdfColorDeviceGray
    func NewPdfColorDeviceGray(grayVal float64) *PdfColorDeviceGray
    func (col *PdfColorDeviceGray) GetNumComponents() int
    func (col *PdfColorDeviceGray) ToInteger(bits int) uint32
    func (col *PdfColorDeviceGray) Val() float64
type PdfColorDeviceRGB
    func NewPdfColorDeviceRGB(r, g, b float64) *PdfColorDeviceRGB
    func (col *PdfColorDeviceRGB) B() float64
    func (col *PdfColorDeviceRGB) G() float64
    func (col *PdfColorDeviceRGB) GetNumComponents() int
    func (col *PdfColorDeviceRGB) R() float64
    func (col *PdfColorDeviceRGB) ToGray() *PdfColorDeviceGray
    func (col *PdfColorDeviceRGB) ToInteger(bits int) [3]uint32
type PdfColorLab
    func NewPdfColorLab(l, a, b float64) *PdfColorLab
    func (col *PdfColorLab) A() float64
    func (col *PdfColorLab) B() float64
    func (col *PdfColorLab) GetNumComponents() int
    func (col *PdfColorLab) L() float64
    func (col *PdfColorLab) ToInteger(bits int) [3]uint32
type PdfColorPattern
    func NewPdfColorPattern() *PdfColorPattern
type PdfColorPatternType2
    func NewPdfColorPatternType2() *PdfColorPatternType2
type PdfColorPatternType3
    func NewPdfColorPatternType3() *PdfColorPatternType3
type PdfColorspace
    func NewPdfColorspaceFromPdfObject(obj core.PdfObject) (PdfColorspace, error)
type PdfColorspaceCalGray
    func NewPdfColorspaceCalGray() *PdfColorspaceCalGray
    func (cs *PdfColorspaceCalGray) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceCalGray) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceCalGray) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceCalGray) DecodeArray() []float64
    func (cs *PdfColorspaceCalGray) GetNumComponents() int
    func (cs *PdfColorspaceCalGray) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceCalGray) String() string
    func (cs *PdfColorspaceCalGray) ToPdfObject() core.PdfObject
type PdfColorspaceCalRGB
    func NewPdfColorspaceCalRGB() *PdfColorspaceCalRGB
    func (cs *PdfColorspaceCalRGB) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceCalRGB) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceCalRGB) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceCalRGB) DecodeArray() []float64
    func (cs *PdfColorspaceCalRGB) GetNumComponents() int
    func (cs *PdfColorspaceCalRGB) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceCalRGB) String() string
    func (cs *PdfColorspaceCalRGB) ToPdfObject() core.PdfObject
type PdfColorspaceDeviceCMYK
    func NewPdfColorspaceDeviceCMYK() *PdfColorspaceDeviceCMYK
    func (cs *PdfColorspaceDeviceCMYK) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceDeviceCMYK) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceDeviceCMYK) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceDeviceCMYK) DecodeArray() []float64
    func (cs *PdfColorspaceDeviceCMYK) GetNumComponents() int
    func (cs *PdfColorspaceDeviceCMYK) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceDeviceCMYK) String() string
    func (cs *PdfColorspaceDeviceCMYK) ToPdfObject() core.PdfObject
type PdfColorspaceDeviceGray
    func NewPdfColorspaceDeviceGray() *PdfColorspaceDeviceGray
    func (cs *PdfColorspaceDeviceGray) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceDeviceGray) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceDeviceGray) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceDeviceGray) DecodeArray() []float64
    func (cs *PdfColorspaceDeviceGray) GetNumComponents() int
    func (cs *PdfColorspaceDeviceGray) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceDeviceGray) String() string
    func (cs *PdfColorspaceDeviceGray) ToPdfObject() core.PdfObject
type PdfColorspaceDeviceN
    func NewPdfColorspaceDeviceN() *PdfColorspaceDeviceN
    func (cs *PdfColorspaceDeviceN) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceDeviceN) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceDeviceN) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceDeviceN) DecodeArray() []float64
    func (cs *PdfColorspaceDeviceN) GetNumComponents() int
    func (cs *PdfColorspaceDeviceN) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceDeviceN) String() string
    func (cs *PdfColorspaceDeviceN) ToPdfObject() core.PdfObject
type PdfColorspaceDeviceNAttributes
    func (cs *PdfColorspaceDeviceNAttributes) ToPdfObject() core.PdfObject
type PdfColorspaceDeviceRGB
    func NewPdfColorspaceDeviceRGB() *PdfColorspaceDeviceRGB
    func (cs *PdfColorspaceDeviceRGB) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceDeviceRGB) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceDeviceRGB) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceDeviceRGB) DecodeArray() []float64
    func (cs *PdfColorspaceDeviceRGB) GetNumComponents() int
    func (cs *PdfColorspaceDeviceRGB) ImageToGray(img Image) (Image, error)
    func (cs *PdfColorspaceDeviceRGB) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceDeviceRGB) String() string
    func (cs *PdfColorspaceDeviceRGB) ToPdfObject() core.PdfObject
type PdfColorspaceICCBased
    func NewPdfColorspaceICCBased(N int) (*PdfColorspaceICCBased, error)
    func (cs *PdfColorspaceICCBased) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceICCBased) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceICCBased) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceICCBased) DecodeArray() []float64
    func (cs *PdfColorspaceICCBased) GetContainingPdfObject() core.PdfObject
    func (cs *PdfColorspaceICCBased) GetNumComponents() int
    func (cs *PdfColorspaceICCBased) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceICCBased) String() string
    func (cs *PdfColorspaceICCBased) ToPdfObject() core.PdfObject
type PdfColorspaceLab
    func NewPdfColorspaceLab() *PdfColorspaceLab
    func (cs *PdfColorspaceLab) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceLab) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceLab) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceLab) DecodeArray() []float64
    func (cs *PdfColorspaceLab) GetNumComponents() int
    func (cs *PdfColorspaceLab) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceLab) String() string
    func (cs *PdfColorspaceLab) ToPdfObject() core.PdfObject
type PdfColorspaceSpecialIndexed
    func NewPdfColorspaceSpecialIndexed() *PdfColorspaceSpecialIndexed
    func (cs *PdfColorspaceSpecialIndexed) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceSpecialIndexed) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceSpecialIndexed) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceSpecialIndexed) DecodeArray() []float64
    func (cs *PdfColorspaceSpecialIndexed) GetNumComponents() int
    func (cs *PdfColorspaceSpecialIndexed) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceSpecialIndexed) String() string
    func (cs *PdfColorspaceSpecialIndexed) ToPdfObject() core.PdfObject
type PdfColorspaceSpecialPattern
    func NewPdfColorspaceSpecialPattern() *PdfColorspaceSpecialPattern
    func (cs *PdfColorspaceSpecialPattern) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceSpecialPattern) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceSpecialPattern) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceSpecialPattern) DecodeArray() []float64
    func (cs *PdfColorspaceSpecialPattern) GetNumComponents() int
    func (cs *PdfColorspaceSpecialPattern) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceSpecialPattern) String() string
    func (cs *PdfColorspaceSpecialPattern) ToPdfObject() core.PdfObject
type PdfColorspaceSpecialSeparation
    func NewPdfColorspaceSpecialSeparation() *PdfColorspaceSpecialSeparation
    func (cs *PdfColorspaceSpecialSeparation) ColorFromFloats(vals []float64) (PdfColor, error)
    func (cs *PdfColorspaceSpecialSeparation) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    func (cs *PdfColorspaceSpecialSeparation) ColorToRGB(color PdfColor) (PdfColor, error)
    func (cs *PdfColorspaceSpecialSeparation) DecodeArray() []float64
    func (cs *PdfColorspaceSpecialSeparation) GetNumComponents() int
    func (cs *PdfColorspaceSpecialSeparation) ImageToRGB(img Image) (Image, error)
    func (cs *PdfColorspaceSpecialSeparation) String() string
    func (cs *PdfColorspaceSpecialSeparation) ToPdfObject() core.PdfObject
type PdfDate
    func NewPdfDate(dateStr string) (PdfDate, error)
    func NewPdfDateFromTime(timeObj time.Time) (PdfDate, error)
    func (d PdfDate) ToGoTime() time.Time
    func (d *PdfDate) ToPdfObject() core.PdfObject
type PdfField
    func NewPdfField() *PdfField
    func (f *PdfField) Flags() FieldFlag
    func (f *PdfField) FullName() (string, error)
    func (f *PdfField) GetContainingPdfObject() core.PdfObject
    func (f *PdfField) GetContext() PdfModel
    func (f *PdfField) IsTerminal() bool
    func (f *PdfField) PartialName() string
    func (f *PdfField) SetContext(ctx PdfModel)
    func (f *PdfField) SetFlag(flag FieldFlag)
    func (f *PdfField) String() string
    func (f *PdfField) ToPdfObject() core.PdfObject
type PdfFieldButton
    func (fb *PdfFieldButton) GetFillImage() *Image
    func (fb *PdfFieldButton) GetType() ButtonType
    func (fb *PdfFieldButton) IsCheckbox() bool
    func (fb *PdfFieldButton) IsPush() bool
    func (fb *PdfFieldButton) IsRadio() bool
    func (fb *PdfFieldButton) SetFillImage(image *Image)
    func (fb *PdfFieldButton) SetType(btype ButtonType)
    func (fb *PdfFieldButton) ToPdfObject() core.PdfObject
type PdfFieldChoice
    func (ch *PdfFieldChoice) ToPdfObject() core.PdfObject
type PdfFieldSignature
    func NewPdfFieldSignature(signature *PdfSignature) *PdfFieldSignature
    func (sig *PdfFieldSignature) ToPdfObject() core.PdfObject
type PdfFieldText
    func (ft *PdfFieldText) ToPdfObject() core.PdfObject
type PdfFilespec
    func NewPdfFileSpecFromEmbeddedFile(file *EmbeddedFile) *PdfFilespec
    func NewPdfFilespec() *PdfFilespec
    func NewPdfFilespecFromObj(obj core.PdfObject) (*PdfFilespec, error)
    func (f *PdfFilespec) GetContainingPdfObject() core.PdfObject
    func (f *PdfFilespec) ToPdfObject() core.PdfObject
type PdfFont
    func DefaultFont() *PdfFont
    func NewCompositePdfFontFromTTF(r io.ReadSeeker) (*PdfFont, error)
    func NewCompositePdfFontFromTTFFile(filePath string) (*PdfFont, error)
    func NewPdfFontFromPdfObject(fontObj core.PdfObject) (*PdfFont, error)
    func NewPdfFontFromTTF(r io.ReadSeeker) (*PdfFont, error)
    func NewPdfFontFromTTFFile(filePath string) (*PdfFont, error)
    func NewStandard14Font(basefont StdFontName) (*PdfFont, error)
    func NewStandard14FontMustCompile(basefont StdFontName) *PdfFont
    func NewStandard14FontWithEncoding(basefont StdFontName, alphabet map[rune]int) (*PdfFont, textencoding.SimpleEncoder, error)
    func (font *PdfFont) BaseFont() string
    func (font *PdfFont) BytesToCharcodes(data []byte) []textencoding.CharCode
    func (font *PdfFont) CharcodeBytesToUnicode(data []byte) (string, int, int)
    func (font *PdfFont) CharcodesToStrings(charcodes []textencoding.CharCode, replacementText string) ([]string, int, int)
    func (font *PdfFont) CharcodesToUnicode(charcodes []textencoding.CharCode) []rune
    func (font *PdfFont) CharcodesToUnicodeWithStats(charcodes []textencoding.CharCode) (runelist []rune, numHits, numMisses int)
    func (font *PdfFont) Encoder() textencoding.TextEncoder
    func (font *PdfFont) FontDescriptor() *PdfFontDescriptor
    func (font *PdfFont) GetCIDToGIDMapObject() core.PdfObject
    func (font *PdfFont) GetCharMetrics(code textencoding.CharCode) (CharMetrics, bool)
    func (font PdfFont) GetFontDescriptor() (*PdfFontDescriptor, error)
    func (font *PdfFont) GetRuneMetrics(r rune) (CharMetrics, bool)
    func (font *PdfFont) IsCID() bool
    func (font *PdfFont) IsSimple() bool
    func (font *PdfFont) RunesToCharcodeBytes(data []rune) ([]byte, int)
    func (font *PdfFont) String() string
    func (font *PdfFont) StringToCharcodeBytes(str string) ([]byte, int)
    func (font *PdfFont) SubsetRegistered() error
    func (font *PdfFont) Subtype() string
    func (font *PdfFont) ToPdfObject() core.PdfObject
    func (font *PdfFont) ToUnicode() string
type PdfFontDescriptor
    func (desc *PdfFontDescriptor) GetAscent() (float64, error)
    func (desc *PdfFontDescriptor) GetCapHeight() (float64, error)
    func (desc *PdfFontDescriptor) GetDescent() (float64, error)
    func (desc *PdfFontDescriptor) GetXHeight() (float64, error)
    func (desc *PdfFontDescriptor) String() string
    func (desc *PdfFontDescriptor) ToPdfObject() core.PdfObject
type PdfFunction
type PdfFunctionType0
    func (f *PdfFunctionType0) Evaluate(x []float64) ([]float64, error)
    func (f *PdfFunctionType0) ToPdfObject() core.PdfObject
type PdfFunctionType2
    func (f *PdfFunctionType2) Evaluate(x []float64) ([]float64, error)
    func (f *PdfFunctionType2) ToPdfObject() core.PdfObject
type PdfFunctionType3
    func (f *PdfFunctionType3) Evaluate(x []float64) ([]float64, error)
    func (f *PdfFunctionType3) ToPdfObject() core.PdfObject
type PdfFunctionType4
    func (f *PdfFunctionType4) Evaluate(xVec []float64) ([]float64, error)
    func (f *PdfFunctionType4) ToPdfObject() core.PdfObject
type PdfInfo
    func NewPdfInfoFromObject(obj core.PdfObject) (*PdfInfo, error)
    func (info *PdfInfo) AddCustomInfo(name string, value string) error
    func (info *PdfInfo) CustomKeys() []string
    func (info *PdfInfo) GetCustomInfo(name string) *core.PdfObjectString
    func (info *PdfInfo) ToPdfObject() core.PdfObject
type PdfInfoTrapped
type PdfModel
type PdfOutline
    func NewPdfOutline() *PdfOutline
    func NewPdfOutlineTree() *PdfOutline
    func (o *PdfOutline) GetContainingPdfObject() core.PdfObject
    func (o *PdfOutline) ToPdfObject() core.PdfObject
type PdfOutlineItem
    func NewOutlineBookmark(title string, page *core.PdfIndirectObject) *PdfOutlineItem
    func NewPdfOutlineItem() *PdfOutlineItem
    func (oi *PdfOutlineItem) GetContainingPdfObject() core.PdfObject
    func (oi *PdfOutlineItem) ToPdfObject() core.PdfObject
type PdfOutlineTreeNode
    func (n *PdfOutlineTreeNode) GetContainingPdfObject() core.PdfObject
    func (n *PdfOutlineTreeNode) GetContext() PdfModel
    func (n *PdfOutlineTreeNode) ToPdfObject() core.PdfObject
type PdfOutputIntent
    func NewCustomPdfOutputIntent(outputCondition, outputConditionIdentifier, info string, destOutputProfile []byte, colorComponents int) *PdfOutputIntent
    func NewPdfOutputIntentFromPdfObject(object core.PdfObject) (*PdfOutputIntent, error)
    func NewStandardPdfOutputIntent(outputCondition, outputConditionIdentifier, registryName string, destOutputProfile []byte, colorComponents int) *PdfOutputIntent
    func (p *PdfOutputIntent) GetContainingPdfObject() core.PdfObject
    func (p *PdfOutputIntent) ParsePdfObject(object core.PdfObject) error
    func (p *PdfOutputIntent) SetSubtype(subtype PdfOutputIntentType) error
    func (p *PdfOutputIntent) ToPdfObject() core.PdfObject
type PdfOutputIntentType
    func (p PdfOutputIntentType) IsValid() bool
    func (p PdfOutputIntentType) String() string
type PdfPage
    func NewPdfPage() *PdfPage
    func (p *PdfPage) AddAnnotation(annot *PdfAnnotation)
    func (p *PdfPage) AddContentStreamByString(contentStr string) error
    func (p *PdfPage) AddExtGState(name core.PdfObjectName, egs *core.PdfObjectDictionary) error
    func (p *PdfPage) AddFont(name core.PdfObjectName, font core.PdfObject) error
    func (p *PdfPage) AddImageResource(name core.PdfObjectName, ximg *XObjectImage) error
    func (p *PdfPage) AddWatermarkImage(ximg *XObjectImage, opt WatermarkImageOptions) error
    func (p *PdfPage) AppendContentBytes(cs []byte, wrapContents bool) error
    func (p *PdfPage) AppendContentStream(contentStr string) error
    func (p *PdfPage) Duplicate() *PdfPage
    func (page *PdfPage) FlattenFieldsWithOpts(appgen FieldAppearanceGenerator, opts *FieldFlattenOpts) error
    func (p *PdfPage) GetAllContentStreams() (string, error)
    func (p *PdfPage) GetAnnotations() ([]*PdfAnnotation, error)
    func (p *PdfPage) GetContainingPdfObject() core.PdfObject
    func (p *PdfPage) GetContentStreamObjs() []core.PdfObject
    func (p *PdfPage) GetContentStreams() ([]string, error)
    func (p *PdfPage) GetMediaBox() (*PdfRectangle, error)
    func (p *PdfPage) GetPageAsIndirectObject() *core.PdfIndirectObject
    func (p *PdfPage) GetPageDict() *core.PdfObjectDictionary
    func (p *PdfPage) GetRotate() (int64, error)
    func (p *PdfPage) GetStructParentsKey() int
    func (p *PdfPage) GetStructTreeRoot() (*core.PdfObject, bool)
    func (p *PdfPage) GetXObjectByName(name core.PdfObjectName) (core.PdfObject, bool)
    func (p *PdfPage) HasExtGState(name core.PdfObjectName) bool
    func (p *PdfPage) HasFontByName(name core.PdfObjectName) bool
    func (p *PdfPage) HasXObjectByName(name core.PdfObjectName) bool
    func (p *PdfPage) RemoveStructParentsKey()
    func (p *PdfPage) RemoveTabOrder()
    func (p *PdfPage) SetAnnotations(annotations []*PdfAnnotation)
    func (p *PdfPage) SetContentStreams(cStreams []string, encoder core.StreamEncoder) error
    func (p *PdfPage) SetStructParentsKey(key int)
    func (p *PdfPage) SetTabOrder(order TabOrderType)
    func (p *PdfPage) Size() (float64, float64, error)
    func (p *PdfPage) ToPdfObject() core.PdfObject
type PdfPageResources
    func NewPdfPageResources() *PdfPageResources
    func NewPdfPageResourcesFromDict(dict *core.PdfObjectDictionary) (*PdfPageResources, error)
    func (r *PdfPageResources) AddExtGState(gsName core.PdfObjectName, gsDict core.PdfObject) error
    func (r *PdfPageResources) GenerateXObjectName() core.PdfObjectName
    func (r *PdfPageResources) GetColorspaceByName(keyName core.PdfObjectName) (PdfColorspace, bool)
    func (r *PdfPageResources) GetColorspaces() (*PdfPageResourcesColorspaces, error)
    func (r *PdfPageResources) GetContainingPdfObject() core.PdfObject
    func (r *PdfPageResources) GetExtGState(keyName core.PdfObjectName) (core.PdfObject, bool)
    func (r *PdfPageResources) GetFontByName(keyName core.PdfObjectName) (core.PdfObject, bool)
    func (r *PdfPageResources) GetPatternByName(keyName core.PdfObjectName) (*PdfPattern, bool)
    func (r *PdfPageResources) GetShadingByName(keyName core.PdfObjectName) (*PdfShading, bool)
    func (r *PdfPageResources) GetXObjectByName(keyName core.PdfObjectName) (*core.PdfObjectStream, XObjectType)
    func (r *PdfPageResources) GetXObjectFormByName(keyName core.PdfObjectName) (*XObjectForm, error)
    func (r *PdfPageResources) GetXObjectImageByName(keyName core.PdfObjectName) (*XObjectImage, error)
    func (r *PdfPageResources) HasColorspaceByName(keyName core.PdfObjectName) bool
    func (r *PdfPageResources) HasExtGState(keyName core.PdfObjectName) bool
    func (r *PdfPageResources) HasFontByName(keyName core.PdfObjectName) bool
    func (r *PdfPageResources) HasPatternByName(keyName core.PdfObjectName) bool
    func (r *PdfPageResources) HasShadingByName(keyName core.PdfObjectName) bool
    func (r *PdfPageResources) HasXObjectByName(keyName core.PdfObjectName) bool
    func (r *PdfPageResources) SetColorSpace(colorspace *PdfPageResourcesColorspaces)
    func (r *PdfPageResources) SetColorspaceByName(keyName core.PdfObjectName, cs PdfColorspace) error
    func (r *PdfPageResources) SetFontByName(keyName core.PdfObjectName, obj core.PdfObject) error
    func (r *PdfPageResources) SetPatternByName(keyName core.PdfObjectName, pattern core.PdfObject) error
    func (r *PdfPageResources) SetShadingByName(keyName core.PdfObjectName, shadingObj core.PdfObject) error
    func (r *PdfPageResources) SetXObjectByName(keyName core.PdfObjectName, stream *core.PdfObjectStream) error
    func (r *PdfPageResources) SetXObjectFormByName(keyName core.PdfObjectName, xform *XObjectForm) error
    func (r *PdfPageResources) SetXObjectImageByName(keyName core.PdfObjectName, ximg *XObjectImage) error
    func (r *PdfPageResources) SetXObjectImageByNameLazy(keyName core.PdfObjectName, ximg *XObjectImage, lazy bool) error
    func (r *PdfPageResources) ToPdfObject() core.PdfObject
type PdfPageResourcesColorspaces
    func NewPdfPageResourcesColorspaces() *PdfPageResourcesColorspaces
    func (rcs *PdfPageResourcesColorspaces) Set(key core.PdfObjectName, val PdfColorspace)
    func (rcs *PdfPageResourcesColorspaces) ToPdfObject() core.PdfObject
type PdfPattern
    func (p *PdfPattern) GetAsShadingPattern() *PdfShadingPattern
    func (p *PdfPattern) GetAsTilingPattern() *PdfTilingPattern
    func (p *PdfPattern) GetContainingPdfObject() core.PdfObject
    func (p *PdfPattern) GetContext() PdfModel
    func (p *PdfPattern) IsShading() bool
    func (p *PdfPattern) IsTiling() bool
    func (p *PdfPattern) SetContext(ctx PdfModel)
    func (p *PdfPattern) ToPdfObject() core.PdfObject
type PdfReader
    func NewPdfReader(rs io.ReadSeeker) (*PdfReader, error)
    func NewPdfReaderFromFile(pdfFile string, opts *ReaderOpts) (*PdfReader, *os.File, error)
    func NewPdfReaderLazy(rs io.ReadSeeker) (*PdfReader, error)
    func NewPdfReaderWithOpts(rs io.ReadSeeker, opts *ReaderOpts) (*PdfReader, error)
    func NewReaderForText(txt string) *PdfReader
    func (r *PdfReader) AcroFormNeedsRepair() (bool, error)
    func (r *PdfReader) CheckAccessRights(password []byte) (bool, security.Permissions, error)
    func (r *PdfReader) Decrypt(password []byte) (bool, error)
    func (r *PdfReader) FlattenFields(allannots bool, appgen FieldAppearanceGenerator) error
    func (r *PdfReader) FlattenFieldsWithOpts(appgen FieldAppearanceGenerator, opts *FieldFlattenOpts) error
    func (r *PdfReader) GetAttachedFiles() ([]*EmbeddedFile, error)
    func (r *PdfReader) GetCatalogLanguage() (core.PdfObject, bool)
    func (r *PdfReader) GetCatalogMarkInfo() (core.PdfObject, bool)
    func (r *PdfReader) GetCatalogMetadata() (core.PdfObject, bool)
    func (r *PdfReader) GetCatalogStructTreeRoot() (core.PdfObject, bool)
    func (r *PdfReader) GetCatalogViewerPreferences() (core.PdfObject, bool)
    func (r *PdfReader) GetEncryptionMethod() string
    func (r *PdfReader) GetIndirectObjectByNumber(number int) (core.PdfObject, error)
    func (r *PdfReader) GetNameDictionary() (core.PdfObject, error)
    func (r *PdfReader) GetNamedDestinations() (core.PdfObject, error)
    func (r *PdfReader) GetNumPages() (int, error)
    func (r *PdfReader) GetOCProperties() (core.PdfObject, error)
    func (r *PdfReader) GetObjectNums() []int
    func (r *PdfReader) GetOutlineTree() *PdfOutlineTreeNode
    func (r *PdfReader) GetOutlines() (*Outline, error)
    func (r *PdfReader) GetOutlinesFlattened() ([]*PdfOutlineTreeNode, []string, error)
    func (r *PdfReader) GetPage(pageNumber int) (*PdfPage, error)
    func (r *PdfReader) GetPageLabels() (core.PdfObject, error)
    func (r *PdfReader) GetPdfInfo() (*PdfInfo, error)
    func (r *PdfReader) GetPerms() *Permissions
    func (r *PdfReader) GetPreviousRevision() (*PdfReader, error)
    func (r *PdfReader) GetRevision(revisionNumber int) (*PdfReader, error)
    func (r *PdfReader) GetRevisionNumber() int
    func (r *PdfReader) GetTrailer() (*core.PdfObjectDictionary, error)
    func (r *PdfReader) Inspect() (map[string]int, error)
    func (r *PdfReader) IsEncrypted() (bool, error)
    func (r *PdfReader) PageFromIndirectObject(ind *core.PdfIndirectObject) (*PdfPage, int, error)
    func (r *PdfReader) PdfVersion() core.Version
    func (r *PdfReader) RepairAcroForm(opts *AcroFormRepairOptions) error
    func (r *PdfReader) ToWriter(opts *ReaderToWriterOpts) (*PdfWriter, error)
    func (r *PdfReader) ValidateSignatures(handlers []SignatureHandler) ([]SignatureValidationResult, error)
type PdfRectangle
    func NewPdfRectangle(arr core.PdfObjectArray) (*PdfRectangle, error)
    func (rect *PdfRectangle) Height() float64
    func (rect *PdfRectangle) Normalize()
    func (rect *PdfRectangle) ToPdfObject() core.PdfObject
    func (rect *PdfRectangle) Transform(transformMatrix transform.Matrix)
    func (rect *PdfRectangle) Width() float64
type PdfShading
    func (s *PdfShading) GetContainingPdfObject() core.PdfObject
    func (s *PdfShading) GetContext() PdfModel
    func (s *PdfShading) SetContext(ctx PdfModel)
    func (s *PdfShading) ToPdfObject() core.PdfObject
type PdfShadingPattern
    func (p *PdfShadingPattern) ToPdfObject() core.PdfObject
type PdfShadingPatternType2
    func NewPdfShadingPatternType2() *PdfShadingPatternType2
    func (p *PdfShadingPatternType2) ToPdfObject() core.PdfObject
type PdfShadingPatternType3
    func NewPdfShadingPatternType3() *PdfShadingPatternType3
    func (p *PdfShadingPatternType3) ToPdfObject() core.PdfObject
type PdfShadingType1
    func (s *PdfShadingType1) ToPdfObject() core.PdfObject
type PdfShadingType2
    func NewPdfShadingType2() *PdfShadingType2
    func (s *PdfShadingType2) ToPdfObject() core.PdfObject
type PdfShadingType3
    func NewPdfShadingType3() *PdfShadingType3
    func (s *PdfShadingType3) ToPdfObject() core.PdfObject
type PdfShadingType4
    func (s *PdfShadingType4) ToPdfObject() core.PdfObject
type PdfShadingType5
    func (s *PdfShadingType5) ToPdfObject() core.PdfObject
type PdfShadingType6
    func (s *PdfShadingType6) ToPdfObject() core.PdfObject
type PdfShadingType7
    func (s *PdfShadingType7) ToPdfObject() core.PdfObject
type PdfSignature
    func NewPdfSignature(handler SignatureHandler) *PdfSignature
    func (sig *PdfSignature) GetCerts() ([]*x509.Certificate, error)
    func (sig *PdfSignature) GetContainingPdfObject() core.PdfObject
    func (sig *PdfSignature) GetDocMDPPermission() (mdp.DocMDPPermission, bool)
    func (sig *PdfSignature) Initialize() error
    func (sig *PdfSignature) SetDate(date time.Time, format string)
    func (sig *PdfSignature) SetLocation(location string)
    func (sig *PdfSignature) SetName(name string)
    func (sig *PdfSignature) SetReason(reason string)
    func (sig *PdfSignature) ToPdfObject() core.PdfObject
type PdfSignatureReference
    func NewPdfSignatureReferenceDocMDP(transformParams *PdfTransformParamsDocMDP) *PdfSignatureReference
    func (sigref *PdfSignatureReference) GetContainingPdfObject() core.PdfObject
    func (sigref *PdfSignatureReference) ToPdfObject() core.PdfObject
type PdfTilingPattern
    func (p *PdfTilingPattern) GetContentStream() ([]byte, error)
    func (p *PdfTilingPattern) GetContentStreamWithEncoder() ([]byte, core.StreamEncoder, error)
    func (p *PdfTilingPattern) IsColored() bool
    func (p *PdfTilingPattern) SetContentStream(content []byte, encoder core.StreamEncoder) error
    func (p *PdfTilingPattern) ToPdfObject() core.PdfObject
type PdfTransformParamsDocMDP
    func NewPdfTransformParamsDocMDP(permission mdp.DocMDPPermission) *PdfTransformParamsDocMDP
    func (sig *PdfTransformParamsDocMDP) String() string
    func (sig *PdfTransformParamsDocMDP) ToPdfObject() core.PdfObject
    func (sig *PdfTransformParamsDocMDP) WriteString() string
type PdfWriter
    func NewPdfWriter() PdfWriter
    func (w *PdfWriter) AddExtension(extName, baseVersion string, extLevel int)
    func (w *PdfWriter) AddOutlineTree(outlineTree *PdfOutlineTreeNode)
    func (w *PdfWriter) AddPage(page *PdfPage) error
    func (w *PdfWriter) ApplyStandard(optimizer StandardApplier)
    func (w *PdfWriter) AttachFile(file *EmbeddedFile) error
    func (w *PdfWriter) Encrypt(userPass, ownerPass []byte, options *EncryptOptions) error
    func (w *PdfWriter) GetOptimizer() Optimizer
    func (w *PdfWriter) GetPageIndirectObject(pageNum int) (*core.PdfIndirectObject, error)
    func (w *PdfWriter) GetPdfVersion() string
    func (w *PdfWriter) GetStandardApplier() StandardApplier
    func (w *PdfWriter) GetVersion() core.Version
    func (w *PdfWriter) SetCatalogLanguage(lang core.PdfObject) error
    func (w *PdfWriter) SetCatalogMarkInfo(info core.PdfObject) error
    func (w *PdfWriter) SetCatalogMetadata(meta core.PdfObject) error
    func (w *PdfWriter) SetCatalogStructTreeRoot(tree core.PdfObject) error
    func (w *PdfWriter) SetCatalogViewerPreferences(pref core.PdfObject) error
    func (w *PdfWriter) SetDocInfo(info *PdfInfo)
    func (w *PdfWriter) SetFileName(name string)
    func (w *PdfWriter) SetForms(form *PdfAcroForm) error
    func (w *PdfWriter) SetNameDictionary(names core.PdfObject) error
    func (w *PdfWriter) SetNamedDestinations(dests core.PdfObject) error
    func (w *PdfWriter) SetOCProperties(ocProperties core.PdfObject) error
    func (w *PdfWriter) SetOpenAction(dest core.PdfObject) error
    func (w *PdfWriter) SetOptimizer(optimizer Optimizer)
    func (w *PdfWriter) SetPageLabels(pageLabels core.PdfObject) error
    func (w *PdfWriter) SetRotation(rotate int64) error
    func (w *PdfWriter) SetVersion(majorVersion, minorVersion int)
    func (w *PdfWriter) Write(writer io.Writer) error
    func (w *PdfWriter) WriteToFile(outputFilePath string) error
type Permissions
    func NewPermissions(docMdp *PdfSignature) *Permissions
    func (p *Permissions) GetContainingPdfObject() core.PdfObject
    func (p *Permissions) ToPdfObject() core.PdfObject
type PrintScaling
type ReaderOpts
    func NewReaderOpts() *ReaderOpts
type ReaderToWriterOpts
type SignatureHandler
type SignatureHandlerDocMDP
type SignatureHandlerDocMDPParams
type SignatureValidationResult
    func (v SignatureValidationResult) String() string
type StandardApplier
type StandardImplementer
type StandardValidator
type StdFontName
type StructTreeRoot
    func NewStructTreeRoot() *StructTreeRoot
    func NewStructTreeRootFromPdfObject(obj core.PdfObject) (*StructTreeRoot, error)
    func (s *StructTreeRoot) AddKDict(k *KDict)
    func (s *StructTreeRoot) ToPdfObject() core.PdfObject
type TabOrderType
type VRI
    func (v *VRI) ToPdfObject() *core.PdfObjectDictionary
type VariableText
type ViewerPreferences
    func NewViewerPreferences() *ViewerPreferences
    func NewViewerPreferencesFromPdfObject(obj core.PdfObject) (*ViewerPreferences, error)
    func (vp *ViewerPreferences) Direction() Direction
    func (vp *ViewerPreferences) Duplex() Duplex
    func (vp *ViewerPreferences) IsCenterWindow() bool
    func (vp *ViewerPreferences) IsDisplayDocTitle() bool
    func (vp *ViewerPreferences) IsFitWindow() bool
    func (vp *ViewerPreferences) IsHideMenubar() bool
    func (vp *ViewerPreferences) IsHideToolbar() bool
    func (vp *ViewerPreferences) IsHideWindowUI() bool
    func (vp *ViewerPreferences) NonFullScreenPageMode() NonFullScreenPageMode
    func (vp *ViewerPreferences) NumCopies() int
    func (vp *ViewerPreferences) PickTrayByPDFSize() bool
    func (vp *ViewerPreferences) PrintArea() PageBoundary
    func (vp *ViewerPreferences) PrintClip() PageBoundary
    func (vp *ViewerPreferences) PrintPageRange() []int
    func (vp *ViewerPreferences) PrintScaling() PrintScaling
    func (vp *ViewerPreferences) SetCenterWindow(centerWindow bool)
    func (vp *ViewerPreferences) SetDirection(direction Direction)
    func (vp *ViewerPreferences) SetDisplayDocTitle(displayDocTitle bool)
    func (vp *ViewerPreferences) SetDuplex(duplex Duplex)
    func (vp *ViewerPreferences) SetFitWindow(fitWindow bool)
    func (vp *ViewerPreferences) SetHideMenubar(hideMenubar bool)
    func (vp *ViewerPreferences) SetHideToolbar(hideToolbar bool)
    func (vp *ViewerPreferences) SetHideWindowUI(hideWindowUI bool)
    func (vp *ViewerPreferences) SetNonFullScreenPageMode(nonFullScreenPageMode NonFullScreenPageMode)
    func (vp *ViewerPreferences) SetNumCopies(numCopies int)
    func (vp *ViewerPreferences) SetPickTrayByPDFSize(pickTrayByPDFSize bool)
    func (vp *ViewerPreferences) SetPrintArea(printArea PageBoundary)
    func (vp *ViewerPreferences) SetPrintClip(printClip PageBoundary)
    func (vp *ViewerPreferences) SetPrintPageRange(printPageRange []int)
    func (vp *ViewerPreferences) SetPrintScaling(printScaling PrintScaling)
    func (vp *ViewerPreferences) SetViewArea(viewArea PageBoundary)
    func (vp *ViewerPreferences) SetViewClip(viewClip PageBoundary)
    func (vp *ViewerPreferences) ToPdfObject() core.PdfObject
    func (vp *ViewerPreferences) ViewArea() PageBoundary
    func (vp *ViewerPreferences) ViewClip() PageBoundary
type WatermarkImageOptions
type XObjectForm
    func NewXObjectForm() *XObjectForm
    func NewXObjectFormFromStream(stream *core.PdfObjectStream) (*XObjectForm, error)
    func (xform *XObjectForm) GetContainingPdfObject() core.PdfObject
    func (xform *XObjectForm) GetContentStream() ([]byte, error)
    func (xform *XObjectForm) SetContentStream(content []byte, encoder core.StreamEncoder) error
    func (xform *XObjectForm) ToPdfObject() core.PdfObject
type XObjectImage
    func NewXObjectImage() *XObjectImage
    func NewXObjectImageFromImage(img *Image, cs PdfColorspace, encoder core.StreamEncoder) (*XObjectImage, error)
    func NewXObjectImageFromImageLazy(img *Image, cs PdfColorspace, encoder core.StreamEncoder, lazy bool) (*XObjectImage, error)
    func NewXObjectImageFromStream(stream *core.PdfObjectStream) (*XObjectImage, error)
    func UpdateXObjectImageFromImage(xobjIn *XObjectImage, img *Image, cs PdfColorspace, encoder core.StreamEncoder) (*XObjectImage, error)
    func (ximg *XObjectImage) GetContainingPdfObject() core.PdfObject
    func (ximg *XObjectImage) SetFilter(encoder core.StreamEncoder) error
    func (ximg *XObjectImage) SetImage(img *Image, cs PdfColorspace) error
    func (ximg *XObjectImage) ToImage() (*Image, error)
    func (ximg *XObjectImage) ToPdfObject() core.PdfObject
type XObjectType

Package files

action.go annotations.go appender.go colorspace.go compliance_reader.go const.go doc.go doc_info.go dss.go fields.go file.go flatten.go font.go font_composite.go font_simple.go font_type3.go fontfile.go form.go functions.go image.go ltv.go model.go multifont_encoder.go names.go optimizer.go outline.go outlines.go output_intent.go page.go pattern.go reader.go resources.go shading.go signature.go signature_handler.go standards.go structure_tree_root.go structures.go utils.go viewer_preferences.go writer.go xobject.go

Constants

const (
    // NonFullScreenPageModeUseNone specifies that neither document outline
    // nor thumbnail images visible.
    NonFullScreenPageModeUseNone NonFullScreenPageMode = "UseNone"

    // NonFullScreenPageModeUseOutlines specifies that document outline visible.
    NonFullScreenPageModeUseOutlines NonFullScreenPageMode = "UseOutlines"

    // NonFullScreenPageModeUseThumbs specifies that thumbnail images visible.
    NonFullScreenPageModeUseThumbs NonFullScreenPageMode = "UseThumbs"

    // NonFullScreenPageModeUseOC specifies that optional content
    // group panel visible.
    NonFullScreenPageModeUseOC NonFullScreenPageMode = "UseOC"

    // DirectionL2R specifies left to right reading order.
    DirectionL2R Direction = "L2R"

    // DirectionR2L specifies right to left reading order.
    DirectionR2L Direction = "R2L"

    // PageBoundaryMediaBox specifies the media box page boundary.
    PageBoundaryMediaBox PageBoundary = "MediaBox"

    // PageBoundaryCropBox specifies the crop box page boundary.
    PageBoundaryCropBox PageBoundary = "CropBox"

    // PageBoundaryBleedBox specifies the bleed box page boundary.
    PageBoundaryBleedBox PageBoundary = "BleedBox"

    // PageBoundaryTrimBox specifies the trim box page boundary.
    PageBoundaryTrimBox PageBoundary = "TrimBox"

    // PageBoundaryArtBox specifies the art box page boundary.
    PageBoundaryArtBox PageBoundary = "ArtBox"

    // PrintScalingNone specifies that no page scaling.
    PrintScalingNone PrintScaling = "None"

    // PrintScalingAppDefault specifies that it will use reader default
    // print scaling.
    PrintScalingAppDefault PrintScaling = "AppDefault"

    // DuplexNone specifies that no duplex settings specified.
    DuplexNone Duplex = "none"

    // DuplexSimplex specifies print single-sided.
    DuplexSimplex Duplex = "Simplex"

    // DuplexFlipShortEdge specifies duplex and flip on the
    // short edge of the sheet.
    DuplexFlipShortEdge Duplex = "DuplexFlipShortEdge"

    // DuplexFlipLongEdge specifies duplex and flip on the long edge of the sheet
    DuplexFlipLongEdge Duplex = "DuplexFlipLongEdge"
)
const (
    // RC4_128bit uses RC4 encryption (128 bit)
    RC4_128bit = EncryptionAlgorithm(iota)
    // AES_128bit uses AES encryption (128 bit, PDF 1.6)
    AES_128bit
    // AES_256bit uses AES encryption (256 bit, PDF 2.0)
    AES_256bit
)

Variables

Errors when parsing/loading data in PDF. TODO(gunnsth): Unexport errors except if there is a clear use case.

var (
    ErrRequiredAttributeMissing = errors.New("required attribute missing")
    ErrInvalidAttribute         = errors.New("invalid attribute")
    ErrTypeCheck                = errors.New("type check")

    ErrEncrypted              = errors.New("file needs to be decrypted first")
    ErrNoFont                 = errors.New("font not defined")
    ErrFontNotSupported       = xerrors.Errorf("unsupported font (%w)", core.ErrNotSupported)
    ErrType1CFontNotSupported = xerrors.Errorf("Type1C fonts are not currently supported (%w)", core.ErrNotSupported)
    ErrType3FontNotSupported  = xerrors.Errorf("Type3 fonts are not currently supported (%w)", core.ErrNotSupported)
    ErrTTCmapNotSupported     = xerrors.Errorf("unsupported TrueType cmap format (%w)", core.ErrNotSupported)
    ErrSignNotEnoughSpace     = xerrors.Errorf("insufficient space allocated for the signature contents")
    ErrSignNoCertificates     = xerrors.Errorf("could not retrieve certificate chain")
)

Standard structure types for grouping elements Ref: Sub chapter 14.8.4.2 Grouping Elements - Table 333.

var (
    // (Document)
    //
    // A complete document. This is the root element of any structure tree
    // containing multiple parts or multiple articles.
    StructureTypeDocument = "Document"

    // (Part)
    //
    // A large-scale division of a document. This type of element is appropriate for
    // grouping articles or sections.
    StructureTypePart = "Part"

    // (Article)
    //
    // A relatively self-contained body of text constituting a single narrative or
    // exposition. Articles should be disjoint; that is, they should not contain other articles as
    // constituent elements.
    StructureTypeArticle = "Art"

    // (Section)
    //
    // A container for grouping related content elements.
    StructureTypeSection = "Sect"

    // (Division)
    //
    // A generic block-level element or group of elements.
    StructureTypeDivision = "Div"

    // (Block quotation)
    //
    // A portion of text consisting of one or more paragraphs attributed to
    // someone other than the author of the surrounding text.
    StructureTypeBlockQuote = "BlockQuote"

    // (Caption)
    //
    // A brief portion of text describing a table or figure.
    StructureTypeCaption = "Caption"

    // (Table of contents)
    //
    // A list made up of table of contents item entries (structure type TOCI)
    // and/or other nested table of contents entries (TOC).
    StructureTypeTOC = "TOC"

    // (Table of contents item)
    //
    // An individual member of a table of contents.
    StructureTypeTOCI = "TOCI"

    // (Index)
    //
    // A sequence of entries containing identifying text accompanied by reference
    // elements that point out occurrences of the specified text in the main body of a document.
    StructureTypeIndex = "Index"

    // (Nonstructural element)
    //
    // A grouping element having no inherent structural significance; it serves solely for grouping purposes.
    StructureTypeNonStructural = "NonStruct"

    // (Private element)
    //
    // A grouping element containing private content belonging to the
    // application producing it. The structural significance of this type of element is
    // unspecified and shall be determined entirely by the conforming writer. Neither the
    // Private element nor any of its descendants shall be interpreted or exported to other
    // document formats.
    StructureTypePrivate = "Private"
)

Block-Level Structure Elements

A block-level structure element (BLSE) is any region of text or other content that is laid out in the block- progression direction, such as a paragraph, heading, list item, or footnote.

Ref: Sub chapter 14.8.4.3 - Table 334-337.

var (
    // (Paragraph) A low-level division of text.
    StructureTypeParagraph = "P"

    // (Heading)
    //
    // A label for a subdivision of a document’s content. It should be the first
    // child of the division that it heads.
    StructureTypeHeader = "H"

    // Headings with specific levels, for use in conforming writers that cannot
    // hierarchically nest their sections and thus cannot determine the level of a heading
    // from its level of nesting.
    StructureTypeHeading1 = "H1"
    StructureTypeHeading2 = "H2"
    StructureTypeHeading3 = "H3"
    StructureTypeHeading4 = "H4"
    StructureTypeHeading5 = "H5"
    StructureTypeHeading6 = "H6"

    // (List)
    //
    // A sequence of items of like meaning and importance. Its immediate children
    // should be an optional caption followed by one or more list items (structure type LI).
    StructureTypeList = "L"

    // (List item)
    //
    // An individual member of a list. Its children may be one or more labels,
    // list bodies, or both (structure types Lbl or LBody).
    StructureTypeListItem = "LI"

    // (Label)
    //
    // A name or number that distinguishes a given item from others in the same
    // list or other group of like items.
    StructureTypeLabel = "Lbl"

    // (List body)
    //
    // The descriptive content of a list item. In a dictionary list, for example, it
    // contains the definition of the term. It may either contain the content directly or have
    // other BLSEs, perhaps including nested lists, as children.
    StructureTypeListBody = "LBody"

    // (Table)
    //
    // A two-dimensional layout of rectangular data cells, possibly having a
    // complex substructure. It contains either one or more table rows (structure type TR)
    // as children; or an optional table head (structure type THead) followed by one or
    // more table body elements (structure type TBody) and an optional table footer
    // (structure type TFoot).
    StructureTypeTable = "Table"

    // (Table row)
    //
    // A row of headings or data in a table. It may contain table header cells
    // and table data cells (structure types TH and TD).
    StructureTypeTableRow = "TR"

    // (Table header cell)
    //
    // A table cell containing header text describing one or more rows
    // or columns of the table.
    StructureTypeTableHeaderCell = "TH"

    // (Table data cell) A table cell containing data that is part of the table’s content.
    StructureTypeTableData = "TD"

    // (Table header row group; PDF 1.5)
    //
    // A group of rows that constitute the header of a table.
    StructureTypeTableHead = "THead"

    // (Table body row group; PDF 1.5)
    //
    // A group of rows that constitute the main body portion of a table.
    StructureTypeTableBody = "TBody"

    // (Table footer row group; PDF 1.5)
    //
    // A group of rows that constitute the footer of a table.
    StructureTypeTableFooter = "TFoot"
)

Inline-Level Structure Elements

An inline-level structure element (ILSE) contains a portion of text or other content having specific styling characteristics or playing a specific role in the document. Within a paragraph or other block defined by a containing BLSE, consecutive ILSEs—possibly intermixed with other content items that are direct children of the parent BLSE—are laid out consecutively in the inline-progression direction (left to right in Western writing systems).

Ref: Sub chapter 14.8.4.4 - Table 338 & 339.

var (
    // (Span)
    //
    // A generic inline portion of text having no particular inherent characteristics.
    // It can be used, for example, to delimit a range of text with a given set of styling attributes.
    StructureTypeSpan = "Span"

    // (Quotation)
    //
    // An inline portion of text attributed to someone other than the author of
    // the surrounding text.
    StructureTypeQuote = "Quote"

    // (Note)
    //
    // An item of explanatory text, such as a footnote or an endnote, that is
    // referred to from within the body of the document.
    StructureTypeNote = "Note"

    // (Reference)
    //
    // A citation to content elsewhere in the document.
    StructureTypeReference = "Reference"

    // (Bibliography entry)
    //
    // A reference identifying the external source of some cited content.
    StructureTypeBibliography = "BibEntry"

    // (Code)
    //
    // A fragment of computer program text.
    StructureTypeCode = "Code"

    // (Link)
    //
    // An association between a portion of the ILSE’s content and a corresponding
    // link annotation or annotations.
    StructureTypeLink = "Link"

    // (Annotation; PDF 1.5)
    // An association between a portion of the ILSE’s content and a corresponding PDF annotation.
    StructureTypeAnnot = "Annot"

    // (Ruby; PDF 1.5)
    //
    // A side-note (annotation) written in a smaller text size and placed
    // adjacent to the base text to which it refers.
    StructureTypeRuby = "Ruby"

    // (Warichu; PDF 1.5)
    //
    // A comment or annotation in a smaller text size and formatted
    // onto two smaller lines within the height of the containing text line and placed
    // following (inline) the base text to which it refers.
    StructureTypeWarichu = "Warichu"

    // (Ruby base text)
    //
    // The full-size text to which the ruby annotation is applied. RB may
    // contain text, other inline elements, or a mixture of both.
    StructureTypeRubyBase = "RB"

    // (Ruby annotation text)
    //
    // The smaller-size text that shall be placed adjacent to the
    // ruby base text. It may contain text, other inline elements, or a mixture of both.
    StructureTypeRubyText = "RT"

    // (Ruby punctuation)
    //
    // Punctuation surrounding the ruby annotation text. It is used
    // only when a ruby annotation cannot be properly formatted in a ruby style and
    // instead is formatted as a normal comment, or when it is formatted as a warichu.
    StructureTypeRubyPunctuation = "RP"

    // (Warichu text)
    //
    // The smaller-size text of a warichu comment that is formatted into
    // two lines and placed between surrounding WP elements.
    StructureTypeWarichuText = "WT"

    // (Warichu punctuation)
    //
    // The punctuation that surrounds the WT text. It contains text
    // (usually a single LEFT or RIGHT PARENTHESIS or similar bracketing character).
    StructureTypeWarichuPunctuation = "WP"

    // (Figure)
    //
    // An item of graphical content.
    StructureTypeFigure = "Figure"

    // (Formula)
    //
    // A mathematical formula.
    StructureTypeFormula = "Formula"

    // (Form)
    //
    // A widget annotation representing an interactive form field.
    StructureTypeForm = "Form"
)

Names of the standard 14 fonts.

var (
    CourierName              = fonts.CourierName
    CourierBoldName          = fonts.CourierBoldName
    CourierObliqueName       = fonts.CourierObliqueName
    CourierBoldObliqueName   = fonts.CourierBoldObliqueName
    HelveticaName            = fonts.HelveticaName
    HelveticaBoldName        = fonts.HelveticaBoldName
    HelveticaObliqueName     = fonts.HelveticaObliqueName
    HelveticaBoldObliqueName = fonts.HelveticaBoldObliqueName
    SymbolName               = fonts.SymbolName
    ZapfDingbatsName         = fonts.ZapfDingbatsName
    TimesRomanName           = fonts.TimesRomanName
    TimesBoldName            = fonts.TimesBoldName
    TimesItalicName          = fonts.TimesItalicName
    TimesBoldItalicName      = fonts.TimesBoldItalicName
)

ErrColorOutOfRange returned when value of a color is out of colorspace range.

var ErrColorOutOfRange = errors.New("color out of range")

func DetermineColorspaceNameFromPdfObject

func DetermineColorspaceNameFromPdfObject(obj core.PdfObject) (core.PdfObjectName, error)

DetermineColorspaceNameFromPdfObject determines PDF colorspace from a PdfObject. Returns the colorspace name and an error on failure. If the colorspace was not found, will return an empty string.

func GetAlphabet

func GetAlphabet(text string) map[rune]int

GetAlphabet returns a map of the runes in `text` and their frequencies.

func SetImageHandler

func SetImageHandler(imgHandling ImageHandler)

SetImageHandler sets the image handler used by the package.

func SetPdfAuthor

func SetPdfAuthor(author string)

SetPdfAuthor sets the Author attribute of the output PDF.

func SetPdfCreationDate

func SetPdfCreationDate(creationDate time.Time)

SetPdfCreationDate sets the CreationDate attribute of the output PDF.

func SetPdfCreator

func SetPdfCreator(creator string)

SetPdfCreator sets the Creator attribute of the output PDF.

func SetPdfKeywords

func SetPdfKeywords(keywords string)

SetPdfKeywords sets the Keywords attribute of the output PDF.

func SetPdfModifiedDate

func SetPdfModifiedDate(modifiedDate time.Time)

SetPdfModifiedDate sets the ModDate attribute of the output PDF.

func SetPdfProducer

func SetPdfProducer(producer string)

SetPdfProducer sets the Producer attribute of the output PDF.

func SetPdfSubject

func SetPdfSubject(subject string)

SetPdfSubject sets the Subject attribute of the output PDF.

func SetPdfTitle

func SetPdfTitle(title string)

SetPdfTitle sets the Title attribute of the output PDF.

type AcroFormRepairOptions

AcroFormRepairOptions contains options for rebuilding the AcroForm.

type AcroFormRepairOptions struct {
}

type AlphaMapFunc

AlphaMapFunc represents a alpha mapping function: byte -> byte. Can be used for thresholding the alpha channel, i.e. setting all alpha values below threshold to transparent.

type AlphaMapFunc func(alpha byte) byte

type AnnotFilterFunc

AnnotFilterFunc represents a PDF annotation filtering function. If the function returns true, the annotation is kept, otherwise it is discarded.

type AnnotFilterFunc func(*PdfAnnotation) bool

type BorderEffect

BorderEffect represents a border effect (Table 167 p. 395).

type BorderEffect int
const (
    // BorderEffectNoEffect represents no border effect.
    BorderEffectNoEffect BorderEffect = iota

    // BorderEffectCloudy represents a cloudy border effect.
    BorderEffectCloudy BorderEffect = iota
)

type BorderStyle

BorderStyle defines border type, typically used for annotations.

type BorderStyle int
const (
    // BorderStyleSolid represents a solid border.
    BorderStyleSolid BorderStyle = iota

    // BorderStyleDashed represents a dashed border.
    BorderStyleDashed BorderStyle = iota

    // BorderStyleBeveled represents a beveled border.
    BorderStyleBeveled BorderStyle = iota

    // BorderStyleInset represents an inset border.
    BorderStyleInset BorderStyle = iota

    // BorderStyleUnderline represents an underline border.
    BorderStyleUnderline BorderStyle = iota
)

func (*BorderStyle) GetPdfName

func (bs *BorderStyle) GetPdfName() string

GetPdfName returns the PDF name used to indicate the border style. (Table 166 p. 395).

type ButtonType

ButtonType represents the subtype of a button field, can be one of: - Checkbox (ButtonTypeCheckbox) - PushButton (ButtonTypePushButton) - RadioButton (ButtonTypeRadioButton)

type ButtonType int

Definitions for field button types

const (
    ButtonTypeCheckbox ButtonType = iota
    ButtonTypePush     ButtonType = iota
    ButtonTypeRadio    ButtonType = iota
)

type CharMetrics

CharMetrics represents width and height metrics of a glyph.

type CharMetrics = fonts.CharMetrics

type CompliancePdfReader

CompliancePdfReader is a wrapper over PdfReader that is used for verifying if the input Pdf document matches the compliance rules of standards like PDF/A. NOTE: This implementation is in experimental development state.

Keep in mind that it might change in the subsequent minor versions.
type CompliancePdfReader struct {
    *PdfReader
    // contains filtered or unexported fields
}

func NewCompliancePdfReader

func NewCompliancePdfReader(rs io.ReadSeeker) (*CompliancePdfReader, error)

NewCompliancePdfReader creates a PdfReader or an input io.ReadSeeker that during reading will scan the files for the metadata details. It could be used for the PDF standard implementations like PDF/A or PDF/X. NOTE: This implementation is in experimental development state.

Keep in mind that it might change in the subsequent minor versions.

func (*CompliancePdfReader) ParserMetadata

func (r *CompliancePdfReader) ParserMetadata() core.ParserMetadata

ParserMetadata gets the parser metadata.

type ContentStreamWrapper

ContentStreamWrapper wraps the Page's contentstream into q ... Q blocks.

type ContentStreamWrapper interface {
    WrapContentStream(page *PdfPage) error
}

type DSS

DSS represents a Document Security Store dictionary. The DSS dictionary contains both global and signature specific validation information. The certificates and revocation data in the `Certs`, `OCSPs`, and `CRLs` fields can be used to validate any signature in the document. Additionally, the VRI entry contains validation data per signature. The keys in the VRI entry are calculated as upper(hex(sha1(sig.Contents))). The values are VRI dictionaries containing certificates and revocation information used for validating a single signature. See ETSI TS 102 778-4 V1.1.1 for more information.

type DSS struct {
    Certs []*core.PdfObjectStream
    OCSPs []*core.PdfObjectStream
    CRLs  []*core.PdfObjectStream
    VRI   map[string]*VRI
    // contains filtered or unexported fields
}

func NewDSS

func NewDSS() *DSS

NewDSS returns a new DSS dictionary.

func (*DSS) AddCRLs

func (dss *DSS) AddCRLs(crls [][]byte) ([]*core.PdfObjectStream, error)

AddCRLs adds CRLs to DSS.

func (*DSS) AddCerts

func (dss *DSS) AddCerts(certs [][]byte) ([]*core.PdfObjectStream, error)

AddCerts adds certificates to DSS.

func (*DSS) AddOCSPs

func (dss *DSS) AddOCSPs(ocsps [][]byte) ([]*core.PdfObjectStream, error)

AddOCSPs adds OCSPs to DSS.

func (*DSS) GenerateHashMaps

func (dss *DSS) GenerateHashMaps() error

GenerateHashMaps generates DSS hashmaps for Certificates, OCSPs and CRLs to make sure they are unique.

func (*DSS) GetContainingPdfObject

func (dss *DSS) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the DSS (indirect object).

func (*DSS) ToPdfObject

func (dss *DSS) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the DSS dictionary.

type DefaultImageHandler

DefaultImageHandler is the default implementation of the ImageHandler using the standard go library.

type DefaultImageHandler struct{}

func (DefaultImageHandler) Compress

func (ih DefaultImageHandler) Compress(input *Image, quality int64) (*Image, error)

Compress is yet to be implemented. Should be able to compress in terms of JPEG quality parameter, and DPI threshold (need to know bounding area dimensions).

func (DefaultImageHandler) NewGrayImageFromGoImage

func (ih DefaultImageHandler) NewGrayImageFromGoImage(goimg goimage.Image) (*Image, error)

NewGrayImageFromGoImage creates a new grayscale unidoc Image from a golang Image.

func (DefaultImageHandler) NewImageFromGoImage

func (ih DefaultImageHandler) NewImageFromGoImage(goimg goimage.Image) (*Image, error)

NewImageFromGoImage creates a new NRGBA32 unidoc Image from a golang Image. If `goimg` is grayscale (*goimage.Gray8) then calls NewGrayImageFromGoImage instead.

func (DefaultImageHandler) Read

func (ih DefaultImageHandler) Read(reader io.Reader) (*Image, error)

Read reads an image and loads into a new Image object with an RGB colormap and 8 bits per component.

type Direction

Direction represents the predominant reading order for text.

type Direction string

type Duplex

Duplex represents the paper handling option that shall be used when printing the file from the print dialog.

type Duplex string

type EmbeddedFile

EmbeddedFile represents an embedded file.

type EmbeddedFile struct {
    Name         string
    Content      []byte
    FileType     string
    Description  string
    Relationship FileRelationship
    Hash         string
    CreationTime time.Time
    ModTime      time.Time
}

func NewEmbeddedFile

func NewEmbeddedFile(path string) (*EmbeddedFile, error)

NewEmbeddedFile constructs a new EmbeddedFile object from supplied file. The file type of the file would be detected automatically.

func NewEmbeddedFileFromContent

func NewEmbeddedFileFromContent(content []byte) (*EmbeddedFile, error)

NewEmbeddedFileFromContent construct a new EmbeddedFile from supplied file content.

func NewEmbeddedFileFromObject

func NewEmbeddedFileFromObject(obj core.PdfObject) (*EmbeddedFile, error)

NewEmbeddedFileFromObject construct a new EmbeddedFile from supplied object.

func (*EmbeddedFile) ToPdfObject

func (ef *EmbeddedFile) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type EncryptOptions

EncryptOptions represents encryption options for an output PDF.

type EncryptOptions struct {
    Permissions security.Permissions
    Algorithm   EncryptionAlgorithm
}

type EncryptionAlgorithm

EncryptionAlgorithm is used in EncryptOptions to change the default algorithm used to encrypt the document.

type EncryptionAlgorithm int

type FieldAppearanceGenerator

FieldAppearanceGenerator generates appearance stream for a given field.

type FieldAppearanceGenerator interface {
    ContentStreamWrapper
    GenerateAppearanceDict(form *PdfAcroForm, field *PdfField, wa *PdfAnnotationWidget) (*core.PdfObjectDictionary, error)
}

type FieldFilterFunc

FieldFilterFunc represents a PDF field filtering function. If the function returns true, the PDF field is kept, otherwise it is discarded.

type FieldFilterFunc func(*PdfField) bool

type FieldFlag

FieldFlag represents form field flags. Some of the flags can apply to all types of fields whereas other flags are specific.

type FieldFlag uint32

The following constants define bitwise flag representing different attributes of a form field.

const (
    // FieldFlagClear has no flags.
    FieldFlagClear FieldFlag = 0

    FieldFlagReadOnly FieldFlag = 1
    FieldFlagRequired FieldFlag = (1 << 1)
    FieldFlagNoExport FieldFlag = (2 << 1)

    FieldFlagNoToggleToOff   FieldFlag = (1 << 14)
    FieldFlagRadio           FieldFlag = (1 << 15)
    FieldFlagPushbutton      FieldFlag = (1 << 16)
    FieldFlagRadiosInUnision FieldFlag = (1 << 25)

    FieldFlagMultiline   FieldFlag = (1 << 12)
    FieldFlagPassword    FieldFlag = (1 << 13)
    FieldFlagFileSelect  FieldFlag = (1 << 20)
    FieldFlagDoNotScroll FieldFlag = (1 << 23)
    FieldFlagComb        FieldFlag = (1 << 24)
    FieldFlagRichText    FieldFlag = (1 << 26)

    FieldFlagDoNotSpellCheck FieldFlag = (1 << 22)

    FieldFlagCombo             FieldFlag = (1 << 17)
    FieldFlagEdit              FieldFlag = (1 << 18)
    FieldFlagSort              FieldFlag = (1 << 19)
    FieldFlagMultiSelect       FieldFlag = (1 << 21)
    FieldFlagCommitOnSelChange FieldFlag = (1 << 27)
)

func (FieldFlag) Clear

func (flag FieldFlag) Clear(fl FieldFlag) FieldFlag

Clear clears flag fl from the flag and returns the resulting flag.

func (FieldFlag) Has

func (flag FieldFlag) Has(fl FieldFlag) bool

Has checks if flag fl is set in flag and returns true if so, false otherwise.

func (FieldFlag) Mask

func (flag FieldFlag) Mask() uint32

Mask returns the uin32 bitmask for the specific flag.

func (FieldFlag) Set

func (flag FieldFlag) Set(fl FieldFlag) FieldFlag

Set applies flag fl to the flag's bitmask and returns the combined flag.

func (FieldFlag) String

func (flag FieldFlag) String() string

String returns a string representation of what flags are set.

type FieldFlattenOpts

FieldFlattenOpts defines a set of options which can be used to configure the field flattening process.

type FieldFlattenOpts struct {
    // FilterFunc allows filtering the form fields used in the flattening
    // process. If the filter function returns true, the field is flattened,
    // otherwise it is skipped.
    // If a non-terminal field is discarded, all of its children (the fields
    // present in the Kids array) are discarded as well.
    // Non-terminal fields are kept in the AcroForm if one or more of their
    // child fields have not been selected for flattening.
    // If a filter function is not provided, all form fields are flattened.
    FilterFunc FieldFilterFunc

    // AnnotFilterFunc allows filtering the annotations in the flattening
    // process. If the filter function returns true, the annotation is flattened,
    // otherwise it is skipped.
    AnnotFilterFunc AnnotFilterFunc
}

type FieldImageProvider

FieldImageProvider provides fields images for specified fields.

type FieldImageProvider interface {
    FieldImageValues() (map[string]*Image, error)
}

type FieldValueProvider

FieldValueProvider provides field values from a data source such as FDF, JSON or any other.

type FieldValueProvider interface {
    FieldValues() (map[string]core.PdfObject, error)
}

type FileRelationship

FileRelationship represents a attachment file relationship type.

type FileRelationship int
const (
    // Source shall be used if this file specification is the original source material for the associated content.
    RelationshipSource FileRelationship = iota

    // Data shall be used if this file speficification represents information used to derive a visual representation.
    RelationshipData

    // Alternative shall be used if this file specification is an alternative representation of content.
    RelationshipAlternative

    // Supplement shall be used if this file specification represents a supplemental representation of the original source
    // or data that maybe more easily consumable.
    RelationshipSupplement

    // Unspcified shall be used when the relationship is not know or cannot be described using one of the other values.
    RelationshipUnspecified
)

type Hasher

Hasher is the interface that wraps the basic Write method.

type Hasher interface {
    Write(p []byte) (n int, err error)
}

type IDTree

IDTree represents the ID tree dictionary where the format of the content is using Name Trees as described in chapter 7.9.6.

type IDTree struct {
    // Limits shall be an array of two strings, that shall specify the (lexically) least and greatest keys included in the Names array.
    Limits *core.PdfObjectArray

    // Names shall be an array of the form
    //
    // [ key1 value1 key2 value2 … keyn valuen]
    //
    // where each keyi shall be a string and the corresponding valuei shall be the object
    // associated with that key. The keys shall be sorted in lexical order, as described below.
    Names *core.PdfObjectArray

    // Kids Shall be an array of indirect references to the immediate children of this node.
    Kids []*IDTree
}

func (*IDTree) ToPdfObject

func (t *IDTree) ToPdfObject() core.PdfObject

ToPdfObject converts the ID tree to a PDF object.

type Image

Image interface is a basic representation of an image used in PDF. The colorspace is not specified, but must be known when handling the image.

type Image struct {
    Width            int64  // The width of the image in samples
    Height           int64  // The height of the image in samples
    BitsPerComponent int64  // The number of bits per color component
    ColorComponents  int    // Color components per pixel
    Data             []byte // Image data stored as bytes.
    // contains filtered or unexported fields
}

func (*Image) AlphaMap

func (img *Image) AlphaMap(mapFunc AlphaMapFunc)

AlphaMap performs mapping of alpha data for transformations. Allows custom filtering of alpha data etc.

func (*Image) ColorAt

func (img *Image) ColorAt(x, y int) (gocolor.Color, error)

ColorAt returns the color of the image pixel specified by the x and y coordinates.

func (*Image) ConvertToBinary

func (img *Image) ConvertToBinary() error

ConvertToBinary converts current image into binary (bi-level) format. Binary images are composed of single bits per pixel (only black or white). If provided image has more color components, then it would be converted into binary image using histogram auto threshold function.

func (*Image) GetParamsDict

func (img *Image) GetParamsDict() *core.PdfObjectDictionary

GetParamsDict returns *core.PdfObjectDictionary with a set of basic image parameters.

func (*Image) GetSamples

func (img *Image) GetSamples() []uint32

GetSamples converts the raw byte slice into samples which are stored in a uint32 bit array. Each sample is represented by BitsPerComponent consecutive bits in the raw data. NOTE: The method resamples the image byte data before returning the result and this could lead to high memory usage, especially on large images. It should be avoided, when possible. It is recommended to access the Data field of the image directly or use the ColorAt method to extract individual pixels.

func (*Image) Resample

func (img *Image) Resample(targetBitsPerComponent int64)

Resample resamples the image data converting from current BitsPerComponent to a target BitsPerComponent value. Sets the image's BitsPerComponent to the target value following resampling.

For example, converting an 8-bit RGB image to 1-bit grayscale (common for scanned images):

// Convert RGB image to grayscale.
rgbColorSpace := pdf.NewPdfColorspaceDeviceRGB()
grayImage, err := rgbColorSpace.ImageToGray(rgbImage)
if err != nil {
  return err
}
// Resample as 1 bit.
grayImage.Resample(1)

func (*Image) SetAlpha

func (img *Image) SetAlpha(alpha []byte)

SetAlpha sets the alpha layer for the image.

func (*Image) SetDecode

func (img *Image) SetDecode(decode []float64)

SetDecode sets the decode image float slice.

func (*Image) SetSamples

func (img *Image) SetSamples(samples []uint32)

SetSamples convert samples to byte-data and sets for the image. NOTE: The method resamples the data and this could lead to high memory usage, especially on large images. It should be used only when it is not possible to work with the image byte data directly.

func (*Image) ToGoImage

func (img *Image) ToGoImage() (goimage.Image, error)

ToGoImage converts the unidoc Image to a golang Image structure.

func (*Image) ToJBIG2Image

func (img *Image) ToJBIG2Image() (*core.JBIG2Image, error)

ToJBIG2Image converts current image to the core.JBIG2Image.

type ImageHandler

ImageHandler interface implements common image loading and processing tasks. Implementing as an interface allows for the possibility to use non-standard libraries for faster loading and processing of images.

type ImageHandler interface {
    // Read any image type and load into a new Image object.
    Read(r io.Reader) (*Image, error)

    // NewImageFromGoImage loads a NRGBA32 unidoc Image from a standard Go image structure.
    NewImageFromGoImage(goimg goimage.Image) (*Image, error)

    // NewGrayImageFromGoImage loads a grayscale unidoc Image from a standard Go image structure.
    NewGrayImageFromGoImage(goimg goimage.Image) (*Image, error)

    // Compress an image.
    Compress(input *Image, quality int64) (*Image, error)
}

ImageHandling is used for handling images.

var ImageHandling ImageHandler = DefaultImageHandler{}

type KDict

KDict represents a K dictionary object.

type KDict struct {
    // The structure type, a name object identifying the nature of the
    // structure element and its role within the document,
    // such as a chapter, paragraph, or footnote
    S core.PdfObject

    // The structure element that is the immediate parent of this one
    // in the structure hierarchy.
    P core.PdfObject

    // The element identifier, a byte string designating this structure element.
    ID *core.PdfObjectString

    // A page object representing a page on which some or all of the content
    // items designated by the K entry shall be rendered.
    Pg core.PdfObject

    // The children of this structure element.
    K core.PdfObject

    // A single attribute object or array of attribute objects associated
    // with this structure element.
    A core.PdfObject

    // An attribute class name or array of class names associated with
    // this structure element.
    C core.PdfObject

    // The current revision number of this structure element
    R *core.PdfObjectInteger

    // The title of the structure element, a text string representing
    // it in human-readable form.
    T *core.PdfObjectString

    // A language identifier specifying the natural language for all text
    // in the structure element except where overridden by
    // language specifications for nested structure elements or marked content.
    Lang *core.PdfObjectString

    // An alternate description of the structure element and its
    // children in human-readable form, which is useful when extracting
    // the document’s contents in support of accessibility to users with
    // disabilities or for other purposes.
    Alt *core.PdfObjectString

    // The expanded form of an abbreviation.
    E *core.PdfObjectString

    // Text that is an exact replacement for the structure element and its children.
    ActualText *core.PdfObjectString
    // contains filtered or unexported fields
}

func NewKDictionary

func NewKDictionary() *KDict

NewKDictionary creates a new K dictionary object.

func (*KDict) AddChild

func (k *KDict) AddChild(kv *KValue)

AddChild adds a child object.

func (*KDict) AddKChild

func (k *KDict) AddKChild(kChild *KDict)

AddKChild adds a child K dictionary object.

func (*KDict) AddMCIDChild

func (k *KDict) AddMCIDChild(mcid int)

AddMCIDChild adds a child MCID object.

func (*KDict) AddRefChild

func (k *KDict) AddRefChild(kChild *core.PdfObjectDictionary)

AddRefChild adds a child reference object.

func (*KDict) GenerateRandomID

func (k *KDict) GenerateRandomID() string

GenerateRandomID generates a random ID for the K dictionary object.

func (*KDict) GetChildren

func (k *KDict) GetChildren() []*KValue

GetChildren returns the children of the K dictionary object.

func (*KDict) GetPageNumber

func (k *KDict) GetPageNumber() int64

GetPageNumber returns the page number that has been assigned to the K object.

func (*KDict) SetBoundingBox

func (k *KDict) SetBoundingBox(x, y, width, height float64)

SetBoundingBox sets the bounding box in the attribute object.

func (*KDict) SetPage

func (k *KDict) SetPage(page *core.PdfIndirectObject)

SetPage directly sets the page object.

func (*KDict) SetPageNumber

func (k *KDict) SetPageNumber(pageNumber int64)

SetPageNumber sets the page number.

func (*KDict) ToPdfObject

func (k *KDict) ToPdfObject() core.PdfObject

ToPdfObject converts the K dictionary to a PDF object.

type KValue

KValue is a wrapper object to hold various type of K's children objects.

type KValue struct {
    // contains filtered or unexported fields
}

func NewKValue

func NewKValue() *KValue

NewKValue creates a new K value object.

func (*KValue) Clear

func (kv *KValue) Clear()

Clear clears the KValue.

func (*KValue) GetKDict

func (kv *KValue) GetKDict() *KDict

GetKDict returns the KDict of the KValue.

func (*KValue) GetMCID

func (kv *KValue) GetMCID() *int

GetMCID returns the MCID of the KValue.

func (*KValue) GetRefObject

func (kv *KValue) GetRefObject() core.PdfObject

GetRefObject returns the reference object of the KValue.

func (*KValue) SetKDict

func (kv *KValue) SetKDict(kDict *KDict)

SetKDict sets the KDict for the KValue.

func (*KValue) SetMCID

func (kv *KValue) SetMCID(mcid int)

SetMCID sets the MCID for the KValue.

func (*KValue) SetRefObject

func (kv *KValue) SetRefObject(refObject core.PdfObject)

SetRefObject sets the reference object for the KValue.

func (*KValue) ToPdfObject

func (kv *KValue) ToPdfObject() core.PdfObject

ToPdfObject converts the K dictionary to a PDF object.

type LTV

LTV represents an LTV (Long-Term Validation) client. It is used to LTV enable signatures by adding validation and revocation data (certificate, OCSP and CRL information) to the DSS dictionary of a PDF document.

LTV is added through the DSS by: - Adding certificates, OCSP and CRL information in the global scope of the

DSS. The global data is used for validating any of the signatures present
in the document.

- Adding certificates, OCSP and CRL information for a single signature,

through an entry in the VRI dictionary of the DSS. The added data is used
for validating that particular signature only. This is the recommended
method for adding validation data for a signature. However, this is not
is not possible in the same revision the signature is applied. Validation
data for a signature is added based on the Contents entry of the signature,
which is known only after the revision is written. Even if the Contents
are known (e.g. when signing externally), updating the DSS at that point
would invalidate the calculated signature. As a result, if adding LTV
in the same revision is a requirement, use the first method.
See LTV.EnableChain.

The client applies both methods, when possible.

If `LTV.SkipExisting` is set to true (the default), validations are not added for signatures which are already present in the VRI entry of the document's DSS dictionary.

type LTV struct {
    // CertClient is the client used to retrieve certificates.
    CertClient *sigutil.CertClient

    // OCSPClient is the client used to retrieve OCSP validation information.
    OCSPClient *sigutil.OCSPClient

    // CRLClient is the client used to retrieve CRL validation information.
    CRLClient *sigutil.CRLClient

    // SkipExisting specifies whether existing signature validations
    // should be skipped.
    SkipExisting bool
    // contains filtered or unexported fields
}

func NewLTV

func NewLTV(appender *PdfAppender) (*LTV, error)

NewLTV returns a new LTV client.

func (*LTV) Enable

func (l *LTV) Enable(sig *PdfSignature, extraCerts []*x509.Certificate) error

Enable LTV enables the specified signature. The signing certificate chain is extracted from the signature dictionary. Optionally, additional certificates can be specified through the `extraCerts` parameter. The LTV client attempts to build the certificate chain up to a trusted root by downloading any missing certificates.

func (*LTV) EnableAll

func (l *LTV) EnableAll(extraCerts []*x509.Certificate) error

EnableAll LTV enables all signatures in the PDF document. The signing certificate chain is extracted from each signature dictionary. Optionally, additional certificates can be specified through the `extraCerts` parameter. The LTV client attempts to build the certificate chain up to a trusted root by downloading any missing certificates.

func (*LTV) EnableByName

func (l *LTV) EnableByName(name string, extraCerts []*x509.Certificate) error

EnableByName LTV enables the signature dictionary of the PDF AcroForm field identified the specified name. The signing certificate chain is extracted from the signature dictionary. Optionally, additional certificates can be specified through the `extraCerts` parameter. The LTV client attempts to build the certificate chain up to a trusted root by downloading any missing certificates.

func (*LTV) EnableChain

func (l *LTV) EnableChain(chain []*x509.Certificate) error

EnableChain adds the specified certificate chain and validation data (OCSP and CRL information) for it to the global scope of the document DSS. The added data is used for validating any of the signatures present in the document. The LTV client attempts to build the certificate chain up to a trusted root by downloading any missing certificates.

type MultipleFontEncoder

multiFontEncoder implements a an Encoder that holds a list of fonts provided.

type MultipleFontEncoder struct {
    CurrentFont *PdfFont // points to the current font in use
    // contains filtered or unexported fields
}

func NewMultipleFontEncoder

func NewMultipleFontEncoder(fonts []*PdfFont) *MultipleFontEncoder

NewMultipleFontEncoder returns instantiates a new *MultipleFontEncoder

func (*MultipleFontEncoder) Encoder

func (mfe *MultipleFontEncoder) Encoder(rn rune) (textencoding.TextEncoder, bool)

Encoder iterates through the list of fonts and returns a working encoder

func (*MultipleFontEncoder) GetRuneMetrics

func (mfe *MultipleFontEncoder) GetRuneMetrics(r rune) (fonts.CharMetrics, bool)

GetRuneMetrics iterates through each font in the list of fonts the returns the fonts.CharMetrics from working font.

func (*MultipleFontEncoder) Reset

func (mfe *MultipleFontEncoder) Reset()

Reset sets the multi font encoder to its initial state.

type Names

Names represents a PDF name tree.

Ref: PDF32000_2008 chapter 7.7.4.

type Names struct {

    // Dests is a name tree mapping name string to destinations.
    Dests *core.PdfObjectDictionary

    // AP is a name tree mapping name strings to annotation appearance streams.
    AP *core.PdfObjectDictionary

    // JavaScript is a name tree mapping name strings to JavaScript actions.
    JavaScript *core.PdfObjectDictionary

    // Pages is a name tree mapping name strings to visible pages for use in interactive forms.
    Pages *core.PdfObjectDictionary

    // Templates is a name tree mapping name strings to invisible (template) pages for use in interactive forms.
    Templates *core.PdfObjectDictionary

    // IDS is a name tree mapping digital identifies to Web Capture content sets.
    IDS *core.PdfObjectDictionary

    // URLS is a name tree mapping URLs to Web Capture content sets.
    URLS *core.PdfObjectDictionary

    // EmbeddedFiles is a name tree mapping name strings to file specifications for embedded file streams.
    EmbeddedFiles *core.PdfObjectDictionary

    // AlternatePresentations is a name tree mapping name strings to alternate presentations.
    AlternatePresentations *core.PdfObjectDictionary

    // Renditions is a name tree mapping name strings (which shall have Unicode encoding) to rendition objects.
    Renditions *core.PdfObjectDictionary
    // contains filtered or unexported fields
}

func (*Names) ToPdfObject

func (n *Names) ToPdfObject() core.PdfObject

ToPdfObject generates a PdfObject representation of the Names struct.

type NonFullScreenPageMode

NonFullScreenPageMode represents the document’s page mode when exiting full-screen mode.

type NonFullScreenPageMode string

type Optimizer

Optimizer is the interface that performs optimization of PDF object structure for output writing.

Optimize receives a slice of input `objects`, performs optimization, including removing, replacing objects and output the optimized slice of objects.

type Optimizer interface {
    Optimize(objects []core.PdfObject) ([]core.PdfObject, error)
}

type Outline

Outline represents a PDF outline dictionary (Table 152 - p. 376). Currently, the Outline object can only be used to construct PDF outlines.

type Outline struct {
    Entries []*OutlineItem `json:"entries,omitempty"`
}

func NewOutline

func NewOutline() *Outline

NewOutline returns a new outline instance.

func (*Outline) Add

func (o *Outline) Add(item *OutlineItem)

Add appends a top level outline item to the outline.

func (*Outline) Insert

func (o *Outline) Insert(index uint, item *OutlineItem)

Insert adds a top level outline item in the outline, at the specified index.

func (*Outline) Items

func (o *Outline) Items() []*OutlineItem

Items returns all children outline items.

func (*Outline) ToOutlineTree

func (o *Outline) ToOutlineTree() *PdfOutlineTreeNode

ToOutlineTree returns a low level PdfOutlineTreeNode object, based on the current instance.

func (*Outline) ToPdfObject

func (o *Outline) ToPdfObject() core.PdfObject

ToPdfObject returns a PDF object representation of the outline.

func (*Outline) ToPdfOutline

func (o *Outline) ToPdfOutline() *PdfOutline

ToPdfOutline returns a low level PdfOutline object, based on the current instance.

type OutlineDest

OutlineDest represents the destination of an outline item. It holds the page and the position on the page an outline item points to.

type OutlineDest struct {
    PageObj *core.PdfIndirectObject `json:"-"`
    Page    int64                   `json:"page"`
    Mode    string                  `json:"mode"`
    X       float64                 `json:"x"`
    Y       float64                 `json:"y"`
    Zoom    float64                 `json:"zoom"`
}

func NewOutlineDest

func NewOutlineDest(page int64, x, y float64) OutlineDest

NewOutlineDest returns a new outline destination which can be used with outline items.

func (OutlineDest) ToPdfObject

func (od OutlineDest) ToPdfObject() core.PdfObject

ToPdfObject returns a PDF object representation of the outline destination.

type OutlineItem

OutlineItem represents a PDF outline item dictionary (Table 153 - pp. 376 - 377).

type OutlineItem struct {
    Title   string         `json:"title"`
    Dest    OutlineDest    `json:"dest"`
    Entries []*OutlineItem `json:"entries,omitempty"`
}

func NewOutlineItem

func NewOutlineItem(title string, dest OutlineDest) *OutlineItem

NewOutlineItem returns a new outline item instance.

func (*OutlineItem) Add

func (oi *OutlineItem) Add(item *OutlineItem)

Add appends an outline item as a child of the current outline item.

func (*OutlineItem) Insert

func (oi *OutlineItem) Insert(index uint, item *OutlineItem)

Insert adds an outline item as a child of the current outline item, at the specified index.

func (*OutlineItem) Items

func (oi *OutlineItem) Items() []*OutlineItem

Items returns all children outline items.

func (*OutlineItem) ToPdfObject

func (oi *OutlineItem) ToPdfObject() core.PdfObject

ToPdfObject returns a PDF object representation of the outline item.

func (*OutlineItem) ToPdfOutlineItem

func (oi *OutlineItem) ToPdfOutlineItem() (*PdfOutlineItem, int64)

ToPdfOutlineItem returns a low level PdfOutlineItem object, based on the current instance.

type PageBoundary

PageBoundary represents the name of the page boundary representing the visible area.

type PageBoundary string

type PageCallback

PageCallback callback function used in page loading that could be used to modify the page content.

Deprecated: will be removed in v4. Use PageProcessCallback instead.

type PageCallback func(pageNum int, page *PdfPage)

type PageProcessCallback

PageProcessCallback callback function used in page loading that could be used to modify the page content.

If an error is returned, the `ToWriter` process would fail.

This callback, if defined, will take precedence over `PageCallback` callback.

type PageProcessCallback func(pageNum int, page *PdfPage) error

type PdfAcroForm

PdfAcroForm represents the AcroForm dictionary used for representation of form data in PDF.

type PdfAcroForm struct {
    Fields          *[]*PdfField
    NeedAppearances *core.PdfObjectBool
    SigFlags        *core.PdfObjectInteger
    CO              *core.PdfObjectArray
    DR              *PdfPageResources
    DA              *core.PdfObjectString
    Q               *core.PdfObjectInteger
    XFA             core.PdfObject

    // ADBEEchoSign extra objects from Adobe Acrobat, causing signature invalid if not exists.
    ADBEEchoSign core.PdfObject
    // contains filtered or unexported fields
}

func NewPdfAcroForm

func NewPdfAcroForm() *PdfAcroForm

NewPdfAcroForm returns a new PdfAcroForm with an initialized container (indirect object).

func (*PdfAcroForm) AllFields

func (form *PdfAcroForm) AllFields() []*PdfField

AllFields returns a flattened list of all fields in the form.

func (*PdfAcroForm) Fill

func (form *PdfAcroForm) Fill(provider FieldValueProvider) error

Fill populates `form` with values provided by `provider`.

func (*PdfAcroForm) FillWithAppearance

func (form *PdfAcroForm) FillWithAppearance(provider FieldValueProvider, appGen FieldAppearanceGenerator) error

FillWithAppearance populates `form` with values provided by `provider`. If not nil, `appGen` is used to generate appearance dictionaries for the field annotations, based on the specified settings. Otherwise, appearance generation is skipped. e.g.: appGen := annotator.FieldAppearance{OnlyIfMissing: true, RegenerateTextFields: true} NOTE: In next major version this functionality will be part of Fill. (v4)

func (*PdfAcroForm) GetContainingPdfObject

func (form *PdfAcroForm) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the PdfAcroForm (indirect object).

func (*PdfAcroForm) ToPdfObject

func (form *PdfAcroForm) ToPdfObject() core.PdfObject

ToPdfObject converts PdfAcroForm to a PdfObject, i.e. an indirect object containing the AcroForm dictionary.

type PdfAction

PdfAction represents an action in PDF (section 12.6 p. 412).

type PdfAction struct {
    Type core.PdfObject
    S    core.PdfObject
    Next core.PdfObject
    // contains filtered or unexported fields
}

func NewPdfAction

func NewPdfAction() *PdfAction

NewPdfAction returns an initialized generic PDF action model.

func (*PdfAction) GetContainingPdfObject

func (a *PdfAction) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfAction) GetContext

func (a *PdfAction) GetContext() PdfModel

GetContext returns the action context which contains the specific type-dependent context. The context represents the subaction.

func (*PdfAction) SetContext

func (a *PdfAction) SetContext(ctx PdfModel)

SetContext sets the sub action (context).

func (*PdfAction) String

func (a *PdfAction) String() string

String implements interface PdfObject.

func (*PdfAction) ToPdfObject

func (a *PdfAction) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoTo

PdfActionGoTo represents a GoTo action.

type PdfActionGoTo struct {
    *PdfAction
    D core.PdfObject // name, byte string or array
}

func NewPdfActionGoTo

func NewPdfActionGoTo() *PdfActionGoTo

NewPdfActionGoTo returns a new "go to" action.

func (*PdfActionGoTo) ToPdfObject

func (gotoAct *PdfActionGoTo) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoTo3DView

PdfActionGoTo3DView represents a GoTo3DView action.

type PdfActionGoTo3DView struct {
    *PdfAction
    TA core.PdfObject
    V  core.PdfObject
}

func NewPdfActionGoTo3DView

func NewPdfActionGoTo3DView() *PdfActionGoTo3DView

NewPdfActionGoTo3DView returns a new "goTo3DView" action.

func (*PdfActionGoTo3DView) ToPdfObject

func (goTo3DViewAct *PdfActionGoTo3DView) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoToE

PdfActionGoToE represents a GoToE action.

type PdfActionGoToE struct {
    *PdfAction
    F         *PdfFilespec
    D         core.PdfObject // name, byte string or array
    NewWindow core.PdfObject
    T         core.PdfObject
}

func NewPdfActionGoToE

func NewPdfActionGoToE() *PdfActionGoToE

NewPdfActionGoToE returns a new "go to embedded" action.

func (*PdfActionGoToE) ToPdfObject

func (gotoEAct *PdfActionGoToE) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoToR

PdfActionGoToR represents a GoToR action.

type PdfActionGoToR struct {
    *PdfAction
    F         *PdfFilespec
    D         core.PdfObject // name, byte string or array
    NewWindow core.PdfObject
}

func NewPdfActionGoToR

func NewPdfActionGoToR() *PdfActionGoToR

NewPdfActionGoToR returns a new "go to remote" action.

func (*PdfActionGoToR) ToPdfObject

func (gotoRAct *PdfActionGoToR) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionHide

PdfActionHide represents a hide action.

type PdfActionHide struct {
    *PdfAction
    T core.PdfObject
    H core.PdfObject
}

func NewPdfActionHide

func NewPdfActionHide() *PdfActionHide

NewPdfActionHide returns a new "hide" action.

func (*PdfActionHide) ToPdfObject

func (hideAct *PdfActionHide) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionImportData

PdfActionImportData represents a importData action.

type PdfActionImportData struct {
    *PdfAction
    F *PdfFilespec
}

func NewPdfActionImportData

func NewPdfActionImportData() *PdfActionImportData

NewPdfActionImportData returns a new "import data" action.

func (*PdfActionImportData) ToPdfObject

func (importDataAct *PdfActionImportData) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionJavaScript

PdfActionJavaScript represents a javaScript action.

type PdfActionJavaScript struct {
    *PdfAction
    JS core.PdfObject
}

func NewPdfActionJavaScript

func NewPdfActionJavaScript() *PdfActionJavaScript

NewPdfActionJavaScript returns a new "javaScript" action.

func (*PdfActionJavaScript) ToPdfObject

func (javaScriptAct *PdfActionJavaScript) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionLaunch

PdfActionLaunch represents a launch action.

type PdfActionLaunch struct {
    *PdfAction
    F         *PdfFilespec
    Win       core.PdfObject
    Mac       core.PdfObject
    Unix      core.PdfObject
    NewWindow core.PdfObject
}

func NewPdfActionLaunch

func NewPdfActionLaunch() *PdfActionLaunch

NewPdfActionLaunch returns a new "launch" action.

func (*PdfActionLaunch) ToPdfObject

func (launchAct *PdfActionLaunch) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionMovie

PdfActionMovie represents a movie action.

type PdfActionMovie struct {
    *PdfAction
    Annotation core.PdfObject
    T          core.PdfObject
    Operation  core.PdfObject
}

func NewPdfActionMovie

func NewPdfActionMovie() *PdfActionMovie

NewPdfActionMovie returns a new "movie" action.

func (*PdfActionMovie) ToPdfObject

func (movieAct *PdfActionMovie) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionNamed

PdfActionNamed represents a named action.

type PdfActionNamed struct {
    *PdfAction
    N core.PdfObject
}

func NewPdfActionNamed

func NewPdfActionNamed() *PdfActionNamed

NewPdfActionNamed returns a new "named" action.

func (*PdfActionNamed) ToPdfObject

func (namedAct *PdfActionNamed) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionRendition

PdfActionRendition represents a Rendition action.

type PdfActionRendition struct {
    *PdfAction
    R  core.PdfObject
    AN core.PdfObject
    OP core.PdfObject
    JS core.PdfObject
}

func NewPdfActionRendition

func NewPdfActionRendition() *PdfActionRendition

NewPdfActionRendition returns a new "rendition" action.

func (*PdfActionRendition) ToPdfObject

func (renditionAct *PdfActionRendition) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionResetForm

PdfActionResetForm represents a resetForm action.

type PdfActionResetForm struct {
    *PdfAction
    Fields core.PdfObject
    Flags  core.PdfObject
}

func NewPdfActionResetForm

func NewPdfActionResetForm() *PdfActionResetForm

NewPdfActionResetForm returns a new "reset form" action.

func (*PdfActionResetForm) ToPdfObject

func (resetFormAct *PdfActionResetForm) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionSetOCGState

PdfActionSetOCGState represents a SetOCGState action.

type PdfActionSetOCGState struct {
    *PdfAction
    State      core.PdfObject
    PreserveRB core.PdfObject
}

func NewPdfActionSetOCGState

func NewPdfActionSetOCGState() *PdfActionSetOCGState

NewPdfActionSetOCGState returns a new "named" action.

func (*PdfActionSetOCGState) ToPdfObject

func (setOCGStateAct *PdfActionSetOCGState) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionSound

PdfActionSound represents a sound action.

type PdfActionSound struct {
    *PdfAction
    Sound       core.PdfObject
    Volume      core.PdfObject
    Synchronous core.PdfObject
    Repeat      core.PdfObject
    Mix         core.PdfObject
}

func NewPdfActionSound

func NewPdfActionSound() *PdfActionSound

NewPdfActionSound returns a new "sound" action.

func (*PdfActionSound) ToPdfObject

func (soundAct *PdfActionSound) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionSubmitForm

PdfActionSubmitForm represents a submitForm action.

type PdfActionSubmitForm struct {
    *PdfAction
    F      *PdfFilespec
    Fields core.PdfObject
    Flags  core.PdfObject
}

func NewPdfActionSubmitForm

func NewPdfActionSubmitForm() *PdfActionSubmitForm

NewPdfActionSubmitForm returns a new "submit form" action.

func (*PdfActionSubmitForm) ToPdfObject

func (submitFormAct *PdfActionSubmitForm) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionThread

PdfActionThread represents a thread action.

type PdfActionThread struct {
    *PdfAction
    F *PdfFilespec
    D core.PdfObject
    B core.PdfObject
}

func NewPdfActionThread

func NewPdfActionThread() *PdfActionThread

NewPdfActionThread returns a new "thread" action.

func (*PdfActionThread) ToPdfObject

func (threadAct *PdfActionThread) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionTrans

PdfActionTrans represents a trans action.

type PdfActionTrans struct {
    *PdfAction
    Trans core.PdfObject
}

func NewPdfActionTrans

func NewPdfActionTrans() *PdfActionTrans

NewPdfActionTrans returns a new "trans" action.

func (*PdfActionTrans) ToPdfObject

func (transAct *PdfActionTrans) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionType

PdfActionType represents an action type in PDF (section 12.6.4 p. 417).

type PdfActionType string

(Section 12.6.4 p. 417). See Table 198 - Action types

const (
    ActionTypeGoTo        PdfActionType = "GoTo"        // Go to a destination in the current document
    ActionTypeGoTo3DView  PdfActionType = "GoTo3DView"  // Set the current view of a 3D annotation
    ActionTypeGoToE       PdfActionType = "GoToE"       // Go to embedded, PDF 1.6, Got to a destination in an embedded file
    ActionTypeGoToR       PdfActionType = "GoToR"       // Go to remote, Go to a destination in another document
    ActionTypeHide        PdfActionType = "Hide"        // Set an annotation's Hidden flag
    ActionTypeImportData  PdfActionType = "ImportData"  // Import field values from a file
    ActionTypeJavaScript  PdfActionType = "JavaScript"  // Execute a JavaScript script
    ActionTypeLaunch      PdfActionType = "Launch"      // Launch an application, usually to open a file
    ActionTypeMovie       PdfActionType = "Movie"       // Play a movie
    ActionTypeNamed       PdfActionType = "Named"       // Execute an action predefined by the conforming reader
    ActionTypeRendition   PdfActionType = "Rendition"   // Controls the playing of multimedia content
    ActionTypeResetForm   PdfActionType = "ResetForm"   // Set fields to their default values
    ActionTypeSetOCGState PdfActionType = "SetOCGState" // Set the states of optional content groups
    ActionTypeSound       PdfActionType = "Sound"       // Play a sound
    ActionTypeSubmitForm  PdfActionType = "SubmitForm"  // Send data to a uniform resource locator
    ActionTypeThread      PdfActionType = "Thread"      // Begin reading an article thread
    ActionTypeTrans       PdfActionType = "Trans"       // Updates the display of a document, using a transition dictionary
    ActionTypeURI         PdfActionType = "URI"         // Resolves a uniform resource identifier
)

type PdfActionURI

PdfActionURI represents an URI action.

type PdfActionURI struct {
    *PdfAction
    URI   core.PdfObject
    IsMap core.PdfObject
}

func NewPdfActionURI

func NewPdfActionURI() *PdfActionURI

NewPdfActionURI returns a new "Uri" action.

func (*PdfActionURI) ToPdfObject

func (uriAct *PdfActionURI) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotation

PdfAnnotation represents an annotation in PDF (section 12.5 p. 389).

type PdfAnnotation struct {
    Rect         core.PdfObject
    Contents     core.PdfObject
    P            core.PdfObject // Reference to page object.
    NM           core.PdfObject
    M            core.PdfObject
    F            core.PdfObject
    AP           core.PdfObject
    AS           core.PdfObject
    Border       core.PdfObject
    C            core.PdfObject
    StructParent core.PdfObject
    OC           core.PdfObject
    // contains filtered or unexported fields
}

func NewPdfAnnotation

func NewPdfAnnotation() *PdfAnnotation

NewPdfAnnotation returns an initialized generic PDF annotation model.

func (*PdfAnnotation) GetContainingPdfObject

func (a *PdfAnnotation) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfAnnotation) GetContext

func (a *PdfAnnotation) GetContext() PdfModel

GetContext returns the annotation context which contains the specific type-dependent context. The context represents the subannotation.

func (*PdfAnnotation) SetContext

func (a *PdfAnnotation) SetContext(ctx PdfModel)

SetContext sets the sub annotation (context).

func (*PdfAnnotation) String

func (a *PdfAnnotation) String() string

func (*PdfAnnotation) ToPdfObject

func (a *PdfAnnotation) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel. Note: Call the sub-annotation's ToPdfObject to set both the generic and non-generic information.

type PdfAnnotation3D

PdfAnnotation3D represents 3D annotations. (Section 13.6.2).

type PdfAnnotation3D struct {
    *PdfAnnotation
    T3DD core.PdfObject
    T3DV core.PdfObject
    T3DA core.PdfObject
    T3DI core.PdfObject
    T3DB core.PdfObject
}

func NewPdfAnnotation3D

func NewPdfAnnotation3D() *PdfAnnotation3D

NewPdfAnnotation3D returns a new 3d annotation.

func (*PdfAnnotation3D) ToPdfObject

func (a3d *PdfAnnotation3D) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationCaret

PdfAnnotationCaret represents Caret annotations. (Section 12.5.6.11).

type PdfAnnotationCaret struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    RD core.PdfObject
    Sy core.PdfObject
}

func NewPdfAnnotationCaret

func NewPdfAnnotationCaret() *PdfAnnotationCaret

NewPdfAnnotationCaret returns a new caret annotation.

func (*PdfAnnotationCaret) ToPdfObject

func (caret *PdfAnnotationCaret) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationCircle

PdfAnnotationCircle represents Circle annotations. (Section 12.5.6.8).

type PdfAnnotationCircle struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    BS core.PdfObject
    IC core.PdfObject
    BE core.PdfObject
    RD core.PdfObject
}

func NewPdfAnnotationCircle

func NewPdfAnnotationCircle() *PdfAnnotationCircle

NewPdfAnnotationCircle returns a new circle annotation.

func (*PdfAnnotationCircle) ToPdfObject

func (circle *PdfAnnotationCircle) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationFileAttachment

PdfAnnotationFileAttachment represents FileAttachment annotations. (Section 12.5.6.15).

type PdfAnnotationFileAttachment struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    FS   core.PdfObject
    Name core.PdfObject
}

func NewPdfAnnotationFileAttachment

func NewPdfAnnotationFileAttachment() *PdfAnnotationFileAttachment

NewPdfAnnotationFileAttachment returns a new file attachment annotation.

func (*PdfAnnotationFileAttachment) ToPdfObject

func (file *PdfAnnotationFileAttachment) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationFreeText

PdfAnnotationFreeText represents FreeText annotations. (Section 12.5.6.6).

type PdfAnnotationFreeText struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    DA core.PdfObject
    Q  core.PdfObject
    RC core.PdfObject
    DS core.PdfObject
    CL core.PdfObject
    IT core.PdfObject
    BE core.PdfObject
    RD core.PdfObject
    BS core.PdfObject
    LE core.PdfObject
}

func NewPdfAnnotationFreeText

func NewPdfAnnotationFreeText() *PdfAnnotationFreeText

NewPdfAnnotationFreeText returns a new free text annotation.

func (*PdfAnnotationFreeText) ToPdfObject

func (ft *PdfAnnotationFreeText) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationHighlight

PdfAnnotationHighlight represents Highlight annotations. (Section 12.5.6.10).

type PdfAnnotationHighlight struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    QuadPoints core.PdfObject
}

func NewPdfAnnotationHighlight

func NewPdfAnnotationHighlight() *PdfAnnotationHighlight

NewPdfAnnotationHighlight returns a new text highlight annotation.

func (*PdfAnnotationHighlight) ToPdfObject

func (hl *PdfAnnotationHighlight) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationInk

PdfAnnotationInk represents Ink annotations. (Section 12.5.6.13).

type PdfAnnotationInk struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    InkList core.PdfObject
    BS      core.PdfObject
}

func NewPdfAnnotationInk

func NewPdfAnnotationInk() *PdfAnnotationInk

NewPdfAnnotationInk returns a new ink annotation.

func (*PdfAnnotationInk) ToPdfObject

func (ink *PdfAnnotationInk) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationLine

PdfAnnotationLine represents Line annotations. (Section 12.5.6.7).

type PdfAnnotationLine struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    L       core.PdfObject
    BS      core.PdfObject
    LE      core.PdfObject
    IC      core.PdfObject
    LL      core.PdfObject
    LLE     core.PdfObject
    Cap     core.PdfObject
    IT      core.PdfObject
    LLO     core.PdfObject
    CP      core.PdfObject
    Measure core.PdfObject
    CO      core.PdfObject
}

func NewPdfAnnotationLine

func NewPdfAnnotationLine() *PdfAnnotationLine

NewPdfAnnotationLine returns a new line annotation.

func (*PdfAnnotationLine) ToPdfObject

func (line *PdfAnnotationLine) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

PdfAnnotationLink represents Link annotations. (Section 12.5.6.5 p. 403).

type PdfAnnotationLink struct {
    *PdfAnnotation
    A          core.PdfObject
    Dest       core.PdfObject
    H          core.PdfObject
    PA         core.PdfObject
    QuadPoints core.PdfObject
    BS         core.PdfObject
    // contains filtered or unexported fields
}
func NewPdfAnnotationLink() *PdfAnnotationLink

NewPdfAnnotationLink returns a new link annotation.

func (*PdfAnnotationLink) GetAction

func (link *PdfAnnotationLink) GetAction() (*PdfAction, error)

GetAction returns the PDF action for the annotation link.

func (*PdfAnnotationLink) SetAction

func (link *PdfAnnotationLink) SetAction(action *PdfAction)

SetAction sets the PDF action for the annotation link.

func (*PdfAnnotationLink) ToPdfObject

func (link *PdfAnnotationLink) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationMarkup

PdfAnnotationMarkup represents additional fields for mark-up annotations. (Section 12.5.6.2 p. 399).

type PdfAnnotationMarkup struct {
    T            core.PdfObject
    Popup        *PdfAnnotationPopup
    CA           core.PdfObject
    RC           core.PdfObject
    CreationDate core.PdfObject
    IRT          core.PdfObject
    Subj         core.PdfObject
    RT           core.PdfObject
    IT           core.PdfObject
    ExData       core.PdfObject
}

type PdfAnnotationMovie

PdfAnnotationMovie represents Movie annotations. (Section 12.5.6.17).

type PdfAnnotationMovie struct {
    *PdfAnnotation
    T     core.PdfObject
    Movie core.PdfObject
    A     core.PdfObject
}

func NewPdfAnnotationMovie

func NewPdfAnnotationMovie() *PdfAnnotationMovie

NewPdfAnnotationMovie returns a new movie annotation.

func (*PdfAnnotationMovie) ToPdfObject

func (mov *PdfAnnotationMovie) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPolyLine

PdfAnnotationPolyLine represents PolyLine annotations. (Section 12.5.6.9).

type PdfAnnotationPolyLine struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    Vertices core.PdfObject
    LE       core.PdfObject
    BS       core.PdfObject
    IC       core.PdfObject
    BE       core.PdfObject
    IT       core.PdfObject
    Measure  core.PdfObject
}

func NewPdfAnnotationPolyLine

func NewPdfAnnotationPolyLine() *PdfAnnotationPolyLine

NewPdfAnnotationPolyLine returns a new polyline annotation.

func (*PdfAnnotationPolyLine) ToPdfObject

func (polyl *PdfAnnotationPolyLine) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPolygon

PdfAnnotationPolygon represents Polygon annotations. (Section 12.5.6.9).

type PdfAnnotationPolygon struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    Vertices core.PdfObject
    LE       core.PdfObject
    BS       core.PdfObject
    IC       core.PdfObject
    BE       core.PdfObject
    IT       core.PdfObject
    Measure  core.PdfObject
}

func NewPdfAnnotationPolygon

func NewPdfAnnotationPolygon() *PdfAnnotationPolygon

NewPdfAnnotationPolygon returns a new polygon annotation.

func (*PdfAnnotationPolygon) ToPdfObject

func (poly *PdfAnnotationPolygon) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPopup

PdfAnnotationPopup represents Popup annotations. (Section 12.5.6.14).

type PdfAnnotationPopup struct {
    *PdfAnnotation
    Parent core.PdfObject
    Open   core.PdfObject
}

func NewPdfAnnotationPopup

func NewPdfAnnotationPopup() *PdfAnnotationPopup

NewPdfAnnotationPopup returns a new popup annotation.

func (*PdfAnnotationPopup) ToPdfObject

func (popup *PdfAnnotationPopup) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPrinterMark

PdfAnnotationPrinterMark represents PrinterMark annotations. (Section 12.5.6.20).

type PdfAnnotationPrinterMark struct {
    *PdfAnnotation
    MN core.PdfObject
}

func NewPdfAnnotationPrinterMark

func NewPdfAnnotationPrinterMark() *PdfAnnotationPrinterMark

NewPdfAnnotationPrinterMark returns a new printermark annotation.

func (*PdfAnnotationPrinterMark) ToPdfObject

func (pm *PdfAnnotationPrinterMark) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationProjection

PdfAnnotationProjection represents Projection annotations.

type PdfAnnotationProjection struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
}

func NewPdfAnnotationProjection

func NewPdfAnnotationProjection() *PdfAnnotationProjection

NewPdfAnnotationProjection returns a new projection annotation.

func (*PdfAnnotationProjection) ToPdfObject

func (proj *PdfAnnotationProjection) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationRedact

PdfAnnotationRedact represents Redact annotations. (Section 12.5.6.23).

type PdfAnnotationRedact struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    QuadPoints  core.PdfObject
    IC          core.PdfObject
    RO          core.PdfObject
    OverlayText core.PdfObject
    Repeat      core.PdfObject
    DA          core.PdfObject
    Q           core.PdfObject
}

func NewPdfAnnotationRedact

func NewPdfAnnotationRedact() *PdfAnnotationRedact

NewPdfAnnotationRedact returns a new redact annotation.

func (*PdfAnnotationRedact) ToPdfObject

func (redact *PdfAnnotationRedact) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationRichMedia

PdfAnnotationRichMedia represents Rich Media annotations.

type PdfAnnotationRichMedia struct {
    *PdfAnnotation
    RichMediaSettings core.PdfObject
    RichMediaContent  core.PdfObject
}

func NewPdfAnnotationRichMedia

func NewPdfAnnotationRichMedia() *PdfAnnotationRichMedia

NewPdfAnnotationRichMedia returns a new rich media annotation.

func (*PdfAnnotationRichMedia) ToPdfObject

func (rm *PdfAnnotationRichMedia) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationScreen

PdfAnnotationScreen represents Screen annotations. (Section 12.5.6.18).

type PdfAnnotationScreen struct {
    *PdfAnnotation
    T  core.PdfObject
    MK core.PdfObject
    A  core.PdfObject
    AA core.PdfObject
}

func NewPdfAnnotationScreen

func NewPdfAnnotationScreen() *PdfAnnotationScreen

NewPdfAnnotationScreen returns a new screen annotation.

func (*PdfAnnotationScreen) ToPdfObject

func (scr *PdfAnnotationScreen) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationSound

PdfAnnotationSound represents Sound annotations. (Section 12.5.6.16).

type PdfAnnotationSound struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    Sound core.PdfObject
    Name  core.PdfObject
}

func NewPdfAnnotationSound

func NewPdfAnnotationSound() *PdfAnnotationSound

NewPdfAnnotationSound returns a new sound annotation.

func (*PdfAnnotationSound) ToPdfObject

func (snd *PdfAnnotationSound) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationSquare

PdfAnnotationSquare represents Square annotations. (Section 12.5.6.8).

type PdfAnnotationSquare struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    BS core.PdfObject
    IC core.PdfObject
    BE core.PdfObject
    RD core.PdfObject
}

func NewPdfAnnotationSquare

func NewPdfAnnotationSquare() *PdfAnnotationSquare

NewPdfAnnotationSquare returns a new square annotation.

func (*PdfAnnotationSquare) ToPdfObject

func (sq *PdfAnnotationSquare) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationSquiggly

PdfAnnotationSquiggly represents Squiggly annotations. (Section 12.5.6.10).

type PdfAnnotationSquiggly struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    QuadPoints core.PdfObject
}

func NewPdfAnnotationSquiggly

func NewPdfAnnotationSquiggly() *PdfAnnotationSquiggly

NewPdfAnnotationSquiggly returns a new text squiggly annotation.

func (*PdfAnnotationSquiggly) ToPdfObject

func (squiggly *PdfAnnotationSquiggly) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationStamp

PdfAnnotationStamp represents Stamp annotations. (Section 12.5.6.12).

type PdfAnnotationStamp struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    Name core.PdfObject
}

func NewPdfAnnotationStamp

func NewPdfAnnotationStamp() *PdfAnnotationStamp

NewPdfAnnotationStamp returns a new stamp annotation.

func (*PdfAnnotationStamp) ToPdfObject

func (stamp *PdfAnnotationStamp) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationStrikeOut

PdfAnnotationStrikeOut represents StrikeOut annotations. (Section 12.5.6.10).

type PdfAnnotationStrikeOut struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    QuadPoints core.PdfObject
}

func NewPdfAnnotationStrikeOut

func NewPdfAnnotationStrikeOut() *PdfAnnotationStrikeOut

NewPdfAnnotationStrikeOut returns a new text strikeout annotation.

func (*PdfAnnotationStrikeOut) ToPdfObject

func (strikeo *PdfAnnotationStrikeOut) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationText

PdfAnnotationText represents Text annotations. (Section 12.5.6.4 p. 402).

type PdfAnnotationText struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    Open       core.PdfObject
    Name       core.PdfObject
    State      core.PdfObject
    StateModel core.PdfObject
}

func NewPdfAnnotationText

func NewPdfAnnotationText() *PdfAnnotationText

NewPdfAnnotationText returns a new text annotation.

func (*PdfAnnotationText) ToPdfObject

func (text *PdfAnnotationText) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationTrapNet

PdfAnnotationTrapNet represents TrapNet annotations. (Section 12.5.6.21).

type PdfAnnotationTrapNet struct {
    *PdfAnnotation
}

func NewPdfAnnotationTrapNet

func NewPdfAnnotationTrapNet() *PdfAnnotationTrapNet

NewPdfAnnotationTrapNet returns a new trapnet annotation.

func (*PdfAnnotationTrapNet) ToPdfObject

func (trapn *PdfAnnotationTrapNet) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationUnderline

PdfAnnotationUnderline represents Underline annotations. (Section 12.5.6.10).

type PdfAnnotationUnderline struct {
    *PdfAnnotation
    *PdfAnnotationMarkup
    QuadPoints core.PdfObject
}

func NewPdfAnnotationUnderline

func NewPdfAnnotationUnderline() *PdfAnnotationUnderline

NewPdfAnnotationUnderline returns a new text underline annotation.

func (*PdfAnnotationUnderline) ToPdfObject

func (underline *PdfAnnotationUnderline) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationWatermark

PdfAnnotationWatermark represents Watermark annotations. (Section 12.5.6.22).

type PdfAnnotationWatermark struct {
    *PdfAnnotation
    FixedPrint core.PdfObject
}

func NewPdfAnnotationWatermark

func NewPdfAnnotationWatermark() *PdfAnnotationWatermark

NewPdfAnnotationWatermark returns a new watermark annotation.

func (*PdfAnnotationWatermark) ToPdfObject

func (wm *PdfAnnotationWatermark) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationWidget

PdfAnnotationWidget represents Widget annotations. Note: Widget annotations are used to display form fields. (Section 12.5.6.19).

type PdfAnnotationWidget struct {
    *PdfAnnotation
    H      core.PdfObject
    MK     core.PdfObject
    A      core.PdfObject
    AA     core.PdfObject
    BS     core.PdfObject
    Parent core.PdfObject
    // contains filtered or unexported fields
}

func NewPdfAnnotationWidget

func NewPdfAnnotationWidget() *PdfAnnotationWidget

NewPdfAnnotationWidget returns an initialized annotation widget.

func (*PdfAnnotationWidget) Field

func (widget *PdfAnnotationWidget) Field() *PdfField

Field returns the parent form field of the widget annotation, if one exists. NOTE: the method returns nil if the parent form field has not been parsed.

func (*PdfAnnotationWidget) ToPdfObject

func (widget *PdfAnnotationWidget) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAppender

PdfAppender appends new PDF content to an existing PDF document via incremental updates.

type PdfAppender struct {
    Reader *PdfReader
    // contains filtered or unexported fields
}

func NewPdfAppender

func NewPdfAppender(reader *PdfReader) (*PdfAppender, error)

NewPdfAppender creates a new Pdf appender from a Pdf reader.

func NewPdfAppenderWithOpts

func NewPdfAppenderWithOpts(reader *PdfReader, opts *ReaderOpts, encryptOptions *EncryptOptions) (*PdfAppender, error)

NewPdfAppenderWithOpts creates a new Pdf appender from a Pdf reader with options.

func (*PdfAppender) AddPages

func (a *PdfAppender) AddPages(pages ...*PdfPage)

AddPages adds pages to be appended to the end of the source PDF.

func (*PdfAppender) GetDSS

func (a *PdfAppender) GetDSS() (dss *DSS)

GetDSS gets the DSS dictionary (ETSI TS 102 778-4 V1.1.1) of the current document revision.

func (*PdfAppender) MergePageWith

func (a *PdfAppender) MergePageWith(pageNum int, page *PdfPage) error

MergePageWith appends page content to source Pdf file page content.

func (*PdfAppender) RemovePage

func (a *PdfAppender) RemovePage(pageNum int)

RemovePage removes a page by number.

func (*PdfAppender) ReplaceAcroForm

func (a *PdfAppender) ReplaceAcroForm(acroForm *PdfAcroForm)

ReplaceAcroForm replaces the acrobat form. It appends a new form to the Pdf which replaces the original AcroForm.

func (*PdfAppender) ReplacePage

func (a *PdfAppender) ReplacePage(pageNum int, page *PdfPage)

ReplacePage replaces the original page to a new page.

func (*PdfAppender) SetDSS

func (a *PdfAppender) SetDSS(dss *DSS)

SetDSS sets the DSS dictionary (ETSI TS 102 778-4 V1.1.1) of the current document revision.

func (*PdfAppender) SetDocInfo

func (a *PdfAppender) SetDocInfo(info *PdfInfo)

SetDocInfo sets the document /Info metadata. This will overwrite any globally declared document info.

func (*PdfAppender) Sign

func (a *PdfAppender) Sign(pageNum int, field *PdfFieldSignature) error

Sign signs a specific page with a digital signature. The signature field parameter must have a valid signature dictionary specified by its V field.

func (*PdfAppender) UpdateObject

func (a *PdfAppender) UpdateObject(obj core.PdfObject)

UpdateObject marks `obj` as updated and to be included in the following revision.

func (*PdfAppender) UpdatePage

func (a *PdfAppender) UpdatePage(page *PdfPage)

UpdatePage updates the `page` in the new revision if it has changed.

func (*PdfAppender) Write

func (a *PdfAppender) Write(w io.Writer) error

Write writes the Appender output to io.Writer. It can only be called once and further invocations will result in an error.

func (*PdfAppender) WriteToFile

func (a *PdfAppender) WriteToFile(outputPath string) error

WriteToFile writes the Appender output to file specified by path.

type PdfBorderEffect

PdfBorderEffect represents a PDF border effect.

type PdfBorderEffect struct {
    S *BorderEffect // Border effect type
    I *float64      // Intensity of the effect
}

type PdfBorderStyle

PdfBorderStyle represents a border style dictionary (12.5.4 Border Styles p. 394).

type PdfBorderStyle struct {
    W *float64     // Border width
    S *BorderStyle // Border style
    D *[]int       // Dash array.
    // contains filtered or unexported fields
}

func NewBorderStyle

func NewBorderStyle() *PdfBorderStyle

NewBorderStyle returns an initialized PdfBorderStyle.

func (*PdfBorderStyle) GetBorderWidth

func (bs *PdfBorderStyle) GetBorderWidth() float64

GetBorderWidth returns the border style's width.

func (*PdfBorderStyle) SetBorderWidth

func (bs *PdfBorderStyle) SetBorderWidth(width float64)

SetBorderWidth sets the style's border width.

func (*PdfBorderStyle) ToPdfObject

func (bs *PdfBorderStyle) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfColor

PdfColor interface represents a generic color in PDF.

type PdfColor interface {
}

type PdfColorCalGray

PdfColorCalGray represents a CalGray colorspace.

type PdfColorCalGray float64

func NewPdfColorCalGray

func NewPdfColorCalGray(grayVal float64) *PdfColorCalGray

NewPdfColorCalGray returns a new CalGray color.

func (*PdfColorCalGray) GetNumComponents

func (col *PdfColorCalGray) GetNumComponents() int

GetNumComponents returns the number of color components (1 for CalGray).

func (*PdfColorCalGray) ToInteger

func (col *PdfColorCalGray) ToInteger(bits int) uint32

ToInteger convert to an integer format.

func (*PdfColorCalGray) Val

func (col *PdfColorCalGray) Val() float64

Val returns the value of the color.

type PdfColorCalRGB

PdfColorCalRGB represents a color in the Colorimetric CIE RGB colorspace. A, B, C components Each component is defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.

type PdfColorCalRGB [3]float64

func NewPdfColorCalRGB

func NewPdfColorCalRGB(a, b, c float64) *PdfColorCalRGB

NewPdfColorCalRGB returns a new CalRBG color.

func (*PdfColorCalRGB) A

func (col *PdfColorCalRGB) A() float64

A returns the value of the A component of the color.

func (*PdfColorCalRGB) B

func (col *PdfColorCalRGB) B() float64

B returns the value of the B component of the color.

func (*PdfColorCalRGB) C

func (col *PdfColorCalRGB) C() float64

C returns the value of the C component of the color.

func (*PdfColorCalRGB) GetNumComponents

func (col *PdfColorCalRGB) GetNumComponents() int

GetNumComponents returns the number of color components (3 for CalRGB).

func (*PdfColorCalRGB) ToInteger

func (col *PdfColorCalRGB) ToInteger(bits int) [3]uint32

ToInteger convert to an integer format.

type PdfColorDeviceCMYK

PdfColorDeviceCMYK is a CMYK32 color, where each component is defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.

type PdfColorDeviceCMYK [4]float64

func NewPdfColorDeviceCMYK

func NewPdfColorDeviceCMYK(c, m, y, k float64) *PdfColorDeviceCMYK

NewPdfColorDeviceCMYK returns a new CMYK32 color.

func (*PdfColorDeviceCMYK) C

func (col *PdfColorDeviceCMYK) C() float64

C returns the value of the cyan component of the color.

func (*PdfColorDeviceCMYK) GetNumComponents

func (col *PdfColorDeviceCMYK) GetNumComponents() int

GetNumComponents returns the number of color components (4 for CMYK32).

func (*PdfColorDeviceCMYK) K

func (col *PdfColorDeviceCMYK) K() float64

K returns the value of the key component of the color.

func (*PdfColorDeviceCMYK) M

func (col *PdfColorDeviceCMYK) M() float64

M returns the value of the magenta component of the color.

func (*PdfColorDeviceCMYK) ToInteger

func (col *PdfColorDeviceCMYK) ToInteger(bits int) [4]uint32

ToInteger convert to an integer format.

func (*PdfColorDeviceCMYK) Y

func (col *PdfColorDeviceCMYK) Y() float64

Y returns the value of the yellow component of the color.

type PdfColorDeviceGray

PdfColorDeviceGray represents a grayscale color value that shall be represented by a single number in the range 0.0 to 1.0 where 0.0 corresponds to black and 1.0 to white.

type PdfColorDeviceGray float64

func NewPdfColorDeviceGray

func NewPdfColorDeviceGray(grayVal float64) *PdfColorDeviceGray

NewPdfColorDeviceGray returns a new grayscale color based on an input grayscale float value in range [0-1].

func (*PdfColorDeviceGray) GetNumComponents

func (col *PdfColorDeviceGray) GetNumComponents() int

GetNumComponents returns the number of color components (1 for grayscale).

func (*PdfColorDeviceGray) ToInteger

func (col *PdfColorDeviceGray) ToInteger(bits int) uint32

ToInteger convert to an integer format.

func (*PdfColorDeviceGray) Val

func (col *PdfColorDeviceGray) Val() float64

Val returns the color value.

type PdfColorDeviceRGB

PdfColorDeviceRGB represents a color in DeviceRGB colorspace with R, G, B components, where component is defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.

type PdfColorDeviceRGB [3]float64

func NewPdfColorDeviceRGB

func NewPdfColorDeviceRGB(r, g, b float64) *PdfColorDeviceRGB

NewPdfColorDeviceRGB returns a new PdfColorDeviceRGB based on the r,g,b component values.

func (*PdfColorDeviceRGB) B

func (col *PdfColorDeviceRGB) B() float64

B returns the value of the blue component of the color.

func (*PdfColorDeviceRGB) G

func (col *PdfColorDeviceRGB) G() float64

G returns the value of the green component of the color.

func (*PdfColorDeviceRGB) GetNumComponents

func (col *PdfColorDeviceRGB) GetNumComponents() int

GetNumComponents returns the number of color components (3 for RGB).

func (*PdfColorDeviceRGB) R

func (col *PdfColorDeviceRGB) R() float64

R returns the value of the red component of the color.

func (*PdfColorDeviceRGB) ToGray

func (col *PdfColorDeviceRGB) ToGray() *PdfColorDeviceGray

ToGray returns a PdfColorDeviceGray color based on the current RGB color.

func (*PdfColorDeviceRGB) ToInteger

func (col *PdfColorDeviceRGB) ToInteger(bits int) [3]uint32

ToInteger convert to an integer format.

type PdfColorLab

PdfColorLab represents a color in the L*, a*, b* 3 component colorspace. Each component is defined in the range 0.0 - 1.0 where 1.0 is the primary intensity.

type PdfColorLab [3]float64

func NewPdfColorLab

func NewPdfColorLab(l, a, b float64) *PdfColorLab

NewPdfColorLab returns a new Lab color.

func (*PdfColorLab) A

func (col *PdfColorLab) A() float64

A returns the value of the A component of the color.

func (*PdfColorLab) B

func (col *PdfColorLab) B() float64

B returns the value of the B component of the color.

func (*PdfColorLab) GetNumComponents

func (col *PdfColorLab) GetNumComponents() int

GetNumComponents returns the number of color components (3 for Lab).

func (*PdfColorLab) L

func (col *PdfColorLab) L() float64

L returns the value of the L component of the color.

func (*PdfColorLab) ToInteger

func (col *PdfColorLab) ToInteger(bits int) [3]uint32

ToInteger convert to an integer format.

type PdfColorPattern

PdfColorPattern represents a pattern color.

type PdfColorPattern struct {
    Color       PdfColor           // Color defined in underlying colorspace.
    PatternName core.PdfObjectName // Name of the pattern (reference via resource dicts).
}

func NewPdfColorPattern

func NewPdfColorPattern() *PdfColorPattern

NewPdfColorPattern returns an empty color pattern.

type PdfColorPatternType2

PdfColorPatternType2 represents a color shading pattern type 2 (Axial).

type PdfColorPatternType2 struct {
    Color       PdfColor           // Color defined in underlying colorspace.
    PatternName core.PdfObjectName // Name of the pattern (reference via resource dicts).
}

func NewPdfColorPatternType2

func NewPdfColorPatternType2() *PdfColorPatternType2

NewPdfColorPatternType2 returns an empty color shading pattern type 2 (Axial).

type PdfColorPatternType3

PdfColorPatternType3 represents a color shading pattern type 3 (Radial).

type PdfColorPatternType3 struct {
    Color       PdfColor           // Color defined in underlying colorspace.
    PatternName core.PdfObjectName // Name of the pattern (reference via resource dicts).
}

func NewPdfColorPatternType3

func NewPdfColorPatternType3() *PdfColorPatternType3

NewPdfColorPatternType3 returns an empty color shading pattern type 3 (Radial).

type PdfColorspace

PdfColorspace interface defines the common methods of a PDF colorspace. The colorspace defines the data storage format for each color and color representation.

Device based colorspace, specified by name - /DeviceGray - /DeviceRGB - /DeviceCMYK

CIE based colorspace specified by [name, dictionary] - [/CalGray dict] - [/CalRGB dict] - [/Lab dict] - [/ICCBased dict]

Special colorspaces - /Pattern - /Indexed - /Separation - /DeviceN

Work is in progress to support all colorspaces. At the moment ICCBased color spaces fall back to the alternate colorspace which works OK in most cases. For full color support, will need fully featured ICC support.

type PdfColorspace interface {
    // String returns the PdfColorspace's name.
    String() string
    // ImageToRGB converts an Image in a given PdfColorspace to an RGB image.
    ImageToRGB(Image) (Image, error)
    // ColorToRGB converts a single color in a given PdfColorspace to an RGB color.
    ColorToRGB(color PdfColor) (PdfColor, error)
    // GetNumComponents returns the number of components in the PdfColorspace.
    GetNumComponents() int
    // ToPdfObject returns a PdfObject representation of the PdfColorspace.
    ToPdfObject() core.PdfObject
    // ColorFromPdfObjects returns a PdfColor in the given PdfColorspace from an array of PdfObject where each
    // PdfObject represents a numeric value.
    ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)
    // ColorFromFloats returns a new PdfColor based on input color components for a given PdfColorspace.
    ColorFromFloats(vals []float64) (PdfColor, error)
    // DecodeArray returns the Decode array for the PdfColorSpace, i.e. the range of each component.
    DecodeArray() []float64
}

func NewPdfColorspaceFromPdfObject

func NewPdfColorspaceFromPdfObject(obj core.PdfObject) (PdfColorspace, error)

NewPdfColorspaceFromPdfObject loads a PdfColorspace from a PdfObject. Returns an error if there is a failure in loading.

type PdfColorspaceCalGray

PdfColorspaceCalGray represents CalGray color space.

type PdfColorspaceCalGray struct {
    WhitePoint []float64 // [XW, YW, ZW]: Required
    BlackPoint []float64 // [XB, YB, ZB]
    Gamma      float64
    // contains filtered or unexported fields
}

func NewPdfColorspaceCalGray

func NewPdfColorspaceCalGray() *PdfColorspaceCalGray

NewPdfColorspaceCalGray returns a new CalGray colorspace object.

func (*PdfColorspaceCalGray) ColorFromFloats

func (cs *PdfColorspaceCalGray) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components. The slice should contain a single element between 0 and 1.

func (*PdfColorspaceCalGray) ColorFromPdfObjects

func (cs *PdfColorspaceCalGray) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on the input slice of color components. The slice should contain a single PdfObjectFloat element in range 0-1.

func (*PdfColorspaceCalGray) ColorToRGB

func (cs *PdfColorspaceCalGray) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a CalGray color to an RGB color.

func (*PdfColorspaceCalGray) DecodeArray

func (cs *PdfColorspaceCalGray) DecodeArray() []float64

DecodeArray returns the range of color component values in CalGray colorspace.

func (*PdfColorspaceCalGray) GetNumComponents

func (cs *PdfColorspaceCalGray) GetNumComponents() int

GetNumComponents returns the number of color components of the colorspace device. Returns 1 for a CalGray device.

func (*PdfColorspaceCalGray) ImageToRGB

func (cs *PdfColorspaceCalGray) ImageToRGB(img Image) (Image, error)

ImageToRGB converts image in CalGray color space to RGB (A, B, C -> X, Y, Z).

func (*PdfColorspaceCalGray) String

func (cs *PdfColorspaceCalGray) String() string

func (*PdfColorspaceCalGray) ToPdfObject

func (cs *PdfColorspaceCalGray) ToPdfObject() core.PdfObject

ToPdfObject return the CalGray colorspace as a PDF object (name dictionary).

type PdfColorspaceCalRGB

PdfColorspaceCalRGB stores A, B, C components

type PdfColorspaceCalRGB struct {
    WhitePoint []float64
    BlackPoint []float64
    Gamma      []float64
    Matrix     []float64 // [XA YA ZA XB YB ZB XC YC ZC] ; default value identity [1 0 0 0 1 0 0 0 1]
    // contains filtered or unexported fields
}

func NewPdfColorspaceCalRGB

func NewPdfColorspaceCalRGB() *PdfColorspaceCalRGB

NewPdfColorspaceCalRGB returns a new CalRGB colorspace object.

func (*PdfColorspaceCalRGB) ColorFromFloats

func (cs *PdfColorspaceCalRGB) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components. The slice should contain three elements representing the A, B and C components of the color. The values of the elements should be between 0 and 1.

func (*PdfColorspaceCalRGB) ColorFromPdfObjects

func (cs *PdfColorspaceCalRGB) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on the input slice of color components. The slice should contain three PdfObjectFloat elements representing the A, B and C components of the color.

func (*PdfColorspaceCalRGB) ColorToRGB

func (cs *PdfColorspaceCalRGB) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a CalRGB color to an RGB color.

func (*PdfColorspaceCalRGB) DecodeArray

func (cs *PdfColorspaceCalRGB) DecodeArray() []float64

DecodeArray returns the range of color component values in CalRGB colorspace.

func (*PdfColorspaceCalRGB) GetNumComponents

func (cs *PdfColorspaceCalRGB) GetNumComponents() int

GetNumComponents returns the number of color components of the colorspace device. Returns 3 for a CalRGB device.

func (*PdfColorspaceCalRGB) ImageToRGB

func (cs *PdfColorspaceCalRGB) ImageToRGB(img Image) (Image, error)

ImageToRGB converts CalRGB colorspace image to RGB and returns the result.

func (*PdfColorspaceCalRGB) String

func (cs *PdfColorspaceCalRGB) String() string

func (*PdfColorspaceCalRGB) ToPdfObject

func (cs *PdfColorspaceCalRGB) ToPdfObject() core.PdfObject

ToPdfObject returns colorspace in a PDF object format [name dictionary]

type PdfColorspaceDeviceCMYK

PdfColorspaceDeviceCMYK represents a CMYK32 colorspace.

type PdfColorspaceDeviceCMYK struct{}

func NewPdfColorspaceDeviceCMYK

func NewPdfColorspaceDeviceCMYK() *PdfColorspaceDeviceCMYK

NewPdfColorspaceDeviceCMYK returns a new CMYK32 colorspace object.

func (*PdfColorspaceDeviceCMYK) ColorFromFloats

func (cs *PdfColorspaceDeviceCMYK) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColorDevice based on the input slice of color components. The slice should contain four elements representing the cyan, magenta, yellow and key components of the color. The values of the elements should be between 0 and 1.

func (*PdfColorspaceDeviceCMYK) ColorFromPdfObjects

func (cs *PdfColorspaceDeviceCMYK) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects gets the color from a series of pdf objects (4 for cmyk).

func (*PdfColorspaceDeviceCMYK) ColorToRGB

func (cs *PdfColorspaceDeviceCMYK) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a CMYK32 color to an RGB color.

func (*PdfColorspaceDeviceCMYK) DecodeArray

func (cs *PdfColorspaceDeviceCMYK) DecodeArray() []float64

DecodeArray returns the range of color component values in DeviceCMYK colorspace.

func (*PdfColorspaceDeviceCMYK) GetNumComponents

func (cs *PdfColorspaceDeviceCMYK) GetNumComponents() int

GetNumComponents returns the number of color components of the colorspace device. Returns 4 for a CMYK32 device.

func (*PdfColorspaceDeviceCMYK) ImageToRGB

func (cs *PdfColorspaceDeviceCMYK) ImageToRGB(img Image) (Image, error)

ImageToRGB converts an image in CMYK32 colorspace to an RGB image.

func (*PdfColorspaceDeviceCMYK) String

func (cs *PdfColorspaceDeviceCMYK) String() string

func (*PdfColorspaceDeviceCMYK) ToPdfObject

func (cs *PdfColorspaceDeviceCMYK) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceDeviceGray

PdfColorspaceDeviceGray represents a grayscale colorspace.

type PdfColorspaceDeviceGray struct{}

func NewPdfColorspaceDeviceGray

func NewPdfColorspaceDeviceGray() *PdfColorspaceDeviceGray

NewPdfColorspaceDeviceGray returns a new grayscale colorspace.

func (*PdfColorspaceDeviceGray) ColorFromFloats

func (cs *PdfColorspaceDeviceGray) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components. The slice should contain a single element between 0 and 1.

func (*PdfColorspaceDeviceGray) ColorFromPdfObjects

func (cs *PdfColorspaceDeviceGray) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on the input slice of color components. The slice should contain a single PdfObjectFloat element in range 0-1.

func (*PdfColorspaceDeviceGray) ColorToRGB

func (cs *PdfColorspaceDeviceGray) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts gray -> rgb for a single color component.

func (*PdfColorspaceDeviceGray) DecodeArray

func (cs *PdfColorspaceDeviceGray) DecodeArray() []float64

DecodeArray returns the range of color component values in DeviceGray colorspace.

func (*PdfColorspaceDeviceGray) GetNumComponents

func (cs *PdfColorspaceDeviceGray) GetNumComponents() int

GetNumComponents returns the number of color components of the colorspace device. Returns 1 for a grayscale device.

func (*PdfColorspaceDeviceGray) ImageToRGB

func (cs *PdfColorspaceDeviceGray) ImageToRGB(img Image) (Image, error)

ImageToRGB convert 1-component grayscale data to 3-component RGB.

func (*PdfColorspaceDeviceGray) String

func (cs *PdfColorspaceDeviceGray) String() string

func (*PdfColorspaceDeviceGray) ToPdfObject

func (cs *PdfColorspaceDeviceGray) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceDeviceN

PdfColorspaceDeviceN represents a DeviceN color space. DeviceN color spaces are similar to Separation color spaces, except they can contain an arbitrary number of color components.

	Format: [/DeviceN names alternateSpace tintTransform]
        or: [/DeviceN names alternateSpace tintTransform attributes]
type PdfColorspaceDeviceN struct {
    ColorantNames  *core.PdfObjectArray
    AlternateSpace PdfColorspace
    TintTransform  PdfFunction
    Attributes     *PdfColorspaceDeviceNAttributes
    // contains filtered or unexported fields
}

func NewPdfColorspaceDeviceN

func NewPdfColorspaceDeviceN() *PdfColorspaceDeviceN

NewPdfColorspaceDeviceN returns an initialized PdfColorspaceDeviceN.

func (*PdfColorspaceDeviceN) ColorFromFloats

func (cs *PdfColorspaceDeviceN) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on input color components.

func (*PdfColorspaceDeviceN) ColorFromPdfObjects

func (cs *PdfColorspaceDeviceN) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on input color components. The input PdfObjects should be numeric.

func (*PdfColorspaceDeviceN) ColorToRGB

func (cs *PdfColorspaceDeviceN) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a DeviceN color to an RGB color.

func (*PdfColorspaceDeviceN) DecodeArray

func (cs *PdfColorspaceDeviceN) DecodeArray() []float64

DecodeArray returns the component range values for the DeviceN colorspace. [0 1.0 0 1.0 ...] for each color component.

func (*PdfColorspaceDeviceN) GetNumComponents

func (cs *PdfColorspaceDeviceN) GetNumComponents() int

GetNumComponents returns the number of input color components, i.e. that are input to the tint transform.

func (*PdfColorspaceDeviceN) ImageToRGB

func (cs *PdfColorspaceDeviceN) ImageToRGB(img Image) (Image, error)

ImageToRGB converts an Image in a given PdfColorspace to an RGB image.

func (*PdfColorspaceDeviceN) String

func (cs *PdfColorspaceDeviceN) String() string

String returns the name of the colorspace (DeviceN).

func (*PdfColorspaceDeviceN) ToPdfObject

func (cs *PdfColorspaceDeviceN) ToPdfObject() core.PdfObject

ToPdfObject returns a *PdfIndirectObject containing a *PdfObjectArray representation of the DeviceN colorspace.

Format: [/DeviceN names alternateSpace tintTransform]
    or: [/DeviceN names alternateSpace tintTransform attributes]

type PdfColorspaceDeviceNAttributes

PdfColorspaceDeviceNAttributes contains additional information about the components of colour space that conforming readers may use. Conforming readers need not use the alternateSpace and tintTransform parameters, and may instead use a custom blending algorithms, along with other information provided in the attributes dictionary if present.

type PdfColorspaceDeviceNAttributes struct {
    Subtype     *core.PdfObjectName // DeviceN or NChannel (DeviceN default)
    Colorants   core.PdfObject
    Process     core.PdfObject
    MixingHints core.PdfObject
    // contains filtered or unexported fields
}

func (*PdfColorspaceDeviceNAttributes) ToPdfObject

func (cs *PdfColorspaceDeviceNAttributes) ToPdfObject() core.PdfObject

ToPdfObject returns a PdfObject representation of PdfColorspaceDeviceNAttributes as a PdfObjectDictionary directly or indirectly within an indirect object container.

type PdfColorspaceDeviceRGB

PdfColorspaceDeviceRGB represents an RGB colorspace.

type PdfColorspaceDeviceRGB struct{}

func NewPdfColorspaceDeviceRGB

func NewPdfColorspaceDeviceRGB() *PdfColorspaceDeviceRGB

NewPdfColorspaceDeviceRGB returns a new RGB colorspace object.

func (*PdfColorspaceDeviceRGB) ColorFromFloats

func (cs *PdfColorspaceDeviceRGB) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components. The slice should contain three elements representing the red, green and blue components of the color. The values of the elements should be between 0 and 1.

func (*PdfColorspaceDeviceRGB) ColorFromPdfObjects

func (cs *PdfColorspaceDeviceRGB) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects gets the color from a series of pdf objects (3 for rgb).

func (*PdfColorspaceDeviceRGB) ColorToRGB

func (cs *PdfColorspaceDeviceRGB) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB verifies that the input color is an RGB color. Method exists in order to satisfy the PdfColorspace interface.

func (*PdfColorspaceDeviceRGB) DecodeArray

func (cs *PdfColorspaceDeviceRGB) DecodeArray() []float64

DecodeArray returns the range of color component values in DeviceRGB colorspace.

func (*PdfColorspaceDeviceRGB) GetNumComponents

func (cs *PdfColorspaceDeviceRGB) GetNumComponents() int

GetNumComponents returns the number of color components of the colorspace device. Returns 3 for an RGB device.

func (*PdfColorspaceDeviceRGB) ImageToGray

func (cs *PdfColorspaceDeviceRGB) ImageToGray(img Image) (Image, error)

ImageToGray returns a new grayscale image based on the passed in RGB image.

func (*PdfColorspaceDeviceRGB) ImageToRGB

func (cs *PdfColorspaceDeviceRGB) ImageToRGB(img Image) (Image, error)

ImageToRGB returns the passed in image. Method exists in order to satisfy the PdfColorspace interface.

func (*PdfColorspaceDeviceRGB) String

func (cs *PdfColorspaceDeviceRGB) String() string

func (*PdfColorspaceDeviceRGB) ToPdfObject

func (cs *PdfColorspaceDeviceRGB) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceICCBased

PdfColorspaceICCBased format [/ICCBased stream]

The stream shall contain the ICC profile. A conforming reader shall support ICC.1:2004:10 as required by PDF 1.7, which will enable it to properly render all embedded ICC profiles regardless of the PDF version

In the current implementation, we rely on the alternative colormap provided.

type PdfColorspaceICCBased struct {
    N         int           // Number of color components (Required). Can be 1,3, or 4.
    Alternate PdfColorspace // Alternate colorspace for non-conforming readers.
    // If omitted ICC not supported: then use DeviceGray,
    // DeviceRGB or DeviceCMYK for N=1,3,4 respectively.
    Range    []float64             // Array of 2xN numbers, specifying range of each color component.
    Metadata *core.PdfObjectStream // Metadata stream.
    Data     []byte                // ICC colormap data.
    // contains filtered or unexported fields
}

func NewPdfColorspaceICCBased

func NewPdfColorspaceICCBased(N int) (*PdfColorspaceICCBased, error)

NewPdfColorspaceICCBased returns a new ICCBased colorspace object.

func (*PdfColorspaceICCBased) ColorFromFloats

func (cs *PdfColorspaceICCBased) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components.

func (*PdfColorspaceICCBased) ColorFromPdfObjects

func (cs *PdfColorspaceICCBased) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on the input slice of color component PDF objects.

func (*PdfColorspaceICCBased) ColorToRGB

func (cs *PdfColorspaceICCBased) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a ICCBased color to an RGB color.

func (*PdfColorspaceICCBased) DecodeArray

func (cs *PdfColorspaceICCBased) DecodeArray() []float64

DecodeArray returns the range of color component values in the ICCBased colorspace.

func (*PdfColorspaceICCBased) GetContainingPdfObject

func (cs *PdfColorspaceICCBased) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject gets the primitive used to parse the color space.

func (*PdfColorspaceICCBased) GetNumComponents

func (cs *PdfColorspaceICCBased) GetNumComponents() int

GetNumComponents returns the number of color components.

func (*PdfColorspaceICCBased) ImageToRGB

func (cs *PdfColorspaceICCBased) ImageToRGB(img Image) (Image, error)

ImageToRGB converts ICCBased colorspace image to RGB and returns the result.

func (*PdfColorspaceICCBased) String

func (cs *PdfColorspaceICCBased) String() string

func (*PdfColorspaceICCBased) ToPdfObject

func (cs *PdfColorspaceICCBased) ToPdfObject() core.PdfObject

ToPdfObject returns colorspace in a PDF object format [name stream]

type PdfColorspaceLab

PdfColorspaceLab is a L*, a*, b* 3 component colorspace.

type PdfColorspaceLab struct {
    WhitePoint []float64 // Required.
    BlackPoint []float64
    Range      []float64 // [amin amax bmin bmax]
    // contains filtered or unexported fields
}

func NewPdfColorspaceLab

func NewPdfColorspaceLab() *PdfColorspaceLab

NewPdfColorspaceLab returns a new Lab colorspace object.

func (*PdfColorspaceLab) ColorFromFloats

func (cs *PdfColorspaceLab) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components. The slice should contain three elements representing the L (range 0-100), A (range -100-100) and B (range -100-100) components of the color.

func (*PdfColorspaceLab) ColorFromPdfObjects

func (cs *PdfColorspaceLab) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on the input slice of color components. The slice should contain three PdfObjectFloat elements representing the L, A and B components of the color.

func (*PdfColorspaceLab) ColorToRGB

func (cs *PdfColorspaceLab) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a Lab color to an RGB color.

func (*PdfColorspaceLab) DecodeArray

func (cs *PdfColorspaceLab) DecodeArray() []float64

DecodeArray returns the range of color component values in the Lab colorspace.

func (*PdfColorspaceLab) GetNumComponents

func (cs *PdfColorspaceLab) GetNumComponents() int

GetNumComponents returns the number of color components of the colorspace device. Returns 3 for a Lab device.

func (*PdfColorspaceLab) ImageToRGB

func (cs *PdfColorspaceLab) ImageToRGB(img Image) (Image, error)

ImageToRGB converts Lab colorspace image to RGB and returns the result.

func (*PdfColorspaceLab) String

func (cs *PdfColorspaceLab) String() string

func (*PdfColorspaceLab) ToPdfObject

func (cs *PdfColorspaceLab) ToPdfObject() core.PdfObject

ToPdfObject returns colorspace in a PDF object format [name dictionary]

type PdfColorspaceSpecialIndexed

PdfColorspaceSpecialIndexed is an indexed color space is a lookup table, where the input element is an index to the lookup table and the output is a color defined in the lookup table in the Base colorspace. [/Indexed base hival lookup]

type PdfColorspaceSpecialIndexed struct {
    Base   PdfColorspace
    HiVal  int
    Lookup core.PdfObject
    // contains filtered or unexported fields
}

func NewPdfColorspaceSpecialIndexed

func NewPdfColorspaceSpecialIndexed() *PdfColorspaceSpecialIndexed

NewPdfColorspaceSpecialIndexed returns a new Indexed color.

func (*PdfColorspaceSpecialIndexed) ColorFromFloats

func (cs *PdfColorspaceSpecialIndexed) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components. The slice should contain a single element.

func (*PdfColorspaceSpecialIndexed) ColorFromPdfObjects

func (cs *PdfColorspaceSpecialIndexed) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on the input slice of color components. The slice should contain a single PdfObjectFloat element.

func (*PdfColorspaceSpecialIndexed) ColorToRGB

func (cs *PdfColorspaceSpecialIndexed) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts an Indexed color to an RGB color.

func (*PdfColorspaceSpecialIndexed) DecodeArray

func (cs *PdfColorspaceSpecialIndexed) DecodeArray() []float64

DecodeArray returns the component range values for the Indexed colorspace.

func (*PdfColorspaceSpecialIndexed) GetNumComponents

func (cs *PdfColorspaceSpecialIndexed) GetNumComponents() int

GetNumComponents returns the number of color components (1 for Indexed).

func (*PdfColorspaceSpecialIndexed) ImageToRGB

func (cs *PdfColorspaceSpecialIndexed) ImageToRGB(img Image) (Image, error)

ImageToRGB convert an indexed image to RGB.

func (*PdfColorspaceSpecialIndexed) String

func (cs *PdfColorspaceSpecialIndexed) String() string

func (*PdfColorspaceSpecialIndexed) ToPdfObject

func (cs *PdfColorspaceSpecialIndexed) ToPdfObject() core.PdfObject

ToPdfObject converts colorspace to a PDF object. [/Indexed base hival lookup]

type PdfColorspaceSpecialPattern

PdfColorspaceSpecialPattern is a Pattern colorspace. Can be defined either as /Pattern or with an underlying colorspace [/Pattern cs].

type PdfColorspaceSpecialPattern struct {
    UnderlyingCS PdfColorspace
    // contains filtered or unexported fields
}

func NewPdfColorspaceSpecialPattern

func NewPdfColorspaceSpecialPattern() *PdfColorspaceSpecialPattern

NewPdfColorspaceSpecialPattern returns a new pattern color.

func (*PdfColorspaceSpecialPattern) ColorFromFloats

func (cs *PdfColorspaceSpecialPattern) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components.

func (*PdfColorspaceSpecialPattern) ColorFromPdfObjects

func (cs *PdfColorspaceSpecialPattern) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects loads the color from PDF objects. The first objects (if present) represent the color in underlying colorspace. The last one represents the name of the pattern.

func (*PdfColorspaceSpecialPattern) ColorToRGB

func (cs *PdfColorspaceSpecialPattern) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB only converts color used with uncolored patterns (defined in underlying colorspace). Does not go into the pattern objects and convert those. If that is desired, needs to be done separately. See for example grayscale conversion example in unidoc-examples repo.

func (*PdfColorspaceSpecialPattern) DecodeArray

func (cs *PdfColorspaceSpecialPattern) DecodeArray() []float64

DecodeArray returns an empty slice as there are no components associated with pattern colorspace.

func (*PdfColorspaceSpecialPattern) GetNumComponents

func (cs *PdfColorspaceSpecialPattern) GetNumComponents() int

GetNumComponents returns the number of color components of the underlying colorspace device.

func (*PdfColorspaceSpecialPattern) ImageToRGB

func (cs *PdfColorspaceSpecialPattern) ImageToRGB(img Image) (Image, error)

ImageToRGB returns an error since an image cannot be defined in a pattern colorspace.

func (*PdfColorspaceSpecialPattern) String

func (cs *PdfColorspaceSpecialPattern) String() string

func (*PdfColorspaceSpecialPattern) ToPdfObject

func (cs *PdfColorspaceSpecialPattern) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceSpecialSeparation

PdfColorspaceSpecialSeparation is a Separation colorspace. At the moment the colour space is set to a Separation space, the conforming reader shall determine whether the device has an available colorant (e.g. dye) corresponding to the name of the requested space. If so, the conforming reader shall ignore the alternateSpace and tintTransform parameters; subsequent painting operations within the space shall apply the designated colorant directly, according to the tint values supplied.

Format: [/Separation name alternateSpace tintTransform]

type PdfColorspaceSpecialSeparation struct {
    ColorantName   *core.PdfObjectName
    AlternateSpace PdfColorspace
    TintTransform  PdfFunction
    // contains filtered or unexported fields
}

func NewPdfColorspaceSpecialSeparation

func NewPdfColorspaceSpecialSeparation() *PdfColorspaceSpecialSeparation

NewPdfColorspaceSpecialSeparation returns a new separation color.

func (*PdfColorspaceSpecialSeparation) ColorFromFloats

func (cs *PdfColorspaceSpecialSeparation) ColorFromFloats(vals []float64) (PdfColor, error)

ColorFromFloats returns a new PdfColor based on the input slice of color components. The slice should contain a single element.

func (*PdfColorspaceSpecialSeparation) ColorFromPdfObjects

func (cs *PdfColorspaceSpecialSeparation) ColorFromPdfObjects(objects []core.PdfObject) (PdfColor, error)

ColorFromPdfObjects returns a new PdfColor based on the input slice of color components. The slice should contain a single PdfObjectFloat element.

func (*PdfColorspaceSpecialSeparation) ColorToRGB

func (cs *PdfColorspaceSpecialSeparation) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a color in Separation colorspace to RGB colorspace.

func (*PdfColorspaceSpecialSeparation) DecodeArray

func (cs *PdfColorspaceSpecialSeparation) DecodeArray() []float64

DecodeArray returns the component range values for the Separation colorspace.

func (*PdfColorspaceSpecialSeparation) GetNumComponents

func (cs *PdfColorspaceSpecialSeparation) GetNumComponents() int

GetNumComponents returns the number of color components (1 for Separation).

func (*PdfColorspaceSpecialSeparation) ImageToRGB

func (cs *PdfColorspaceSpecialSeparation) ImageToRGB(img Image) (Image, error)

ImageToRGB converts an image with samples in Separation CS to an image with samples specified in DeviceRGB CS.

func (*PdfColorspaceSpecialSeparation) String

func (cs *PdfColorspaceSpecialSeparation) String() string

func (*PdfColorspaceSpecialSeparation) ToPdfObject

func (cs *PdfColorspaceSpecialSeparation) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfDate

PdfDate represents a date, which is a PDF string of the form: (D:YYYYMMDDHHmmSSOHH'mm)

type PdfDate struct {
    // contains filtered or unexported fields
}

func NewPdfDate

func NewPdfDate(dateStr string) (PdfDate, error)

NewPdfDate returns a new PdfDate object from a PDF date string (see 7.9.4 Dates). format: "D: YYYYMMDDHHmmSSOHH'mm"

func NewPdfDateFromTime

func NewPdfDateFromTime(timeObj time.Time) (PdfDate, error)

NewPdfDateFromTime will create a PdfDate based on the given time

func (PdfDate) ToGoTime

func (d PdfDate) ToGoTime() time.Time

ToGoTime returns the date in time.Time format.

func (*PdfDate) ToPdfObject

func (d *PdfDate) ToPdfObject() core.PdfObject

ToPdfObject converts date to a PDF string object.

type PdfField

PdfField contains the common attributes of a form field. The context object contains the specific field data which can represent a button, text, choice or signature. The PdfField is typically not used directly, but is encapsulated by the more specific field types such as PdfFieldButton etc (i.e. the context attribute).

type PdfField struct {
    Parent      *PdfField
    Annotations []*PdfAnnotationWidget
    Kids        []*PdfField

    FT           *core.PdfObjectName
    T            *core.PdfObjectString
    TU           *core.PdfObjectString
    TM           *core.PdfObjectString
    Ff           *core.PdfObjectInteger
    V            core.PdfObject
    DV           core.PdfObject
    AA           core.PdfObject
    VariableText *VariableText
    // contains filtered or unexported fields
}

func NewPdfField

func NewPdfField() *PdfField

NewPdfField returns an initialized PdfField.

func (*PdfField) Flags

func (f *PdfField) Flags() FieldFlag

Flags returns the field flags for the field accounting for any inherited flags.

func (*PdfField) FullName

func (f *PdfField) FullName() (string, error)

FullName returns the full name of the field as in rootname.parentname.partialname.

func (*PdfField) GetContainingPdfObject

func (f *PdfField) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the containing object for the PdfField, i.e. an indirect object containing the field dictionary.

func (*PdfField) GetContext

func (f *PdfField) GetContext() PdfModel

GetContext returns the PdfField context which is the more specific field data type, e.g. PdfFieldButton for a button field.

func (*PdfField) IsTerminal

func (f *PdfField) IsTerminal() bool

IsTerminal returns true for terminal fields, false otherwise. Terminal fields are fields whose descendants are only widget annotations.

func (*PdfField) PartialName

func (f *PdfField) PartialName() string

PartialName returns the partial name of the field.

func (*PdfField) SetContext

func (f *PdfField) SetContext(ctx PdfModel)

SetContext sets the specific fielddata type, e.g. would be PdfFieldButton for a button field.

func (*PdfField) SetFlag

func (f *PdfField) SetFlag(flag FieldFlag)

SetFlag sets the flag for the field.

func (*PdfField) String

func (f *PdfField) String() string

String returns a string representation of the field.

func (*PdfField) ToPdfObject

func (f *PdfField) ToPdfObject() core.PdfObject

ToPdfObject sets the common field elements. Note: Call the more field context's ToPdfObject to set both the generic and non-generic information.

type PdfFieldButton

PdfFieldButton represents a button field which includes push buttons, checkboxes, and radio buttons.

type PdfFieldButton struct {
    *PdfField

    Opt *core.PdfObjectArray
    // contains filtered or unexported fields
}

func (*PdfFieldButton) GetFillImage

func (fb *PdfFieldButton) GetFillImage() *Image

GetFillImage get attached model.Image in push button.

func (*PdfFieldButton) GetType

func (fb *PdfFieldButton) GetType() ButtonType

GetType returns the button field type which returns one of the following - PdfFieldButtonPush for push button fields - PdfFieldButtonCheckbox for checkbox fields - PdfFieldButtonRadio for radio button fields

func (*PdfFieldButton) IsCheckbox

func (fb *PdfFieldButton) IsCheckbox() bool

IsCheckbox returns true if the button field represents a checkbox, false otherwise.

func (*PdfFieldButton) IsPush

func (fb *PdfFieldButton) IsPush() bool

IsPush returns true if the button field represents a push button, false otherwise.

func (*PdfFieldButton) IsRadio

func (fb *PdfFieldButton) IsRadio() bool

IsRadio returns true if the button field represents a radio button, false otherwise.

func (*PdfFieldButton) SetFillImage

func (fb *PdfFieldButton) SetFillImage(image *Image)

SetFillImage attach a model.Image to push button.

func (*PdfFieldButton) SetType

func (fb *PdfFieldButton) SetType(btype ButtonType)

SetType sets the field button's type. Can be one of: - PdfFieldButtonPush for push button fields - PdfFieldButtonCheckbox for checkbox fields - PdfFieldButtonRadio for radio button fields This sets the field's flag appropriately.

func (*PdfFieldButton) ToPdfObject

func (fb *PdfFieldButton) ToPdfObject() core.PdfObject

ToPdfObject returns the button field dictionary within an indirect object.

type PdfFieldChoice

PdfFieldChoice represents a choice field which includes scrollable list boxes and combo boxes.

type PdfFieldChoice struct {
    *PdfField
    Opt *core.PdfObjectArray
    TI  *core.PdfObjectInteger
    I   *core.PdfObjectArray
}

func (*PdfFieldChoice) ToPdfObject

func (ch *PdfFieldChoice) ToPdfObject() core.PdfObject

ToPdfObject returns the choice field dictionary within an indirect object (container).

type PdfFieldSignature

PdfFieldSignature signature field represents digital signatures and optional data for authenticating the name of the signer and verifying document contents.

type PdfFieldSignature struct {
    *PdfField
    *PdfAnnotationWidget

    V    *PdfSignature
    Lock *core.PdfIndirectObject
    SV   *core.PdfIndirectObject
}

func NewPdfFieldSignature

func NewPdfFieldSignature(signature *PdfSignature) *PdfFieldSignature

NewPdfFieldSignature returns an initialized signature field.

func (*PdfFieldSignature) ToPdfObject

func (sig *PdfFieldSignature) ToPdfObject() core.PdfObject

ToPdfObject returns an indirect object containing the signature field dictionary.

type PdfFieldText

PdfFieldText represents a text field where user can enter text.

type PdfFieldText struct {
    *PdfField
    DA     *core.PdfObjectString
    Q      *core.PdfObjectInteger
    DS     *core.PdfObjectString
    RV     core.PdfObject
    MaxLen *core.PdfObjectInteger
}

func (*PdfFieldText) ToPdfObject

func (ft *PdfFieldText) ToPdfObject() core.PdfObject

ToPdfObject returns the text field dictionary within an indirect object (container).

type PdfFilespec

PdfFilespec represents a file specification which can either refer to an external or embedded file.

type PdfFilespec struct {
    Type           core.PdfObject
    FS             core.PdfObject
    F              core.PdfObject // A file specification string
    UF             core.PdfObject // A Unicode text string that provides file specification
    DOS            core.PdfObject // A file specification string representing a DOS file name. OBSOLETE
    Mac            core.PdfObject // A file specification string representing a Mac OS file name. OBSOLETE
    Unix           core.PdfObject // A file specification string representing a UNIX file name. OBSOLETE
    ID             core.PdfObject // An array of two byte strings constituting a file identifier
    V              core.PdfObject // A flag indicating whether the file referenced by the file specification is volatile (changes frequently with time).
    EF             core.PdfObject // A dictionary containing a subset of the keys F, UF, DOS, Mac, and Unix, corresponding to the entries by those names in the file specification dictionary
    RF             core.PdfObject
    Desc           core.PdfObject // Descriptive text associated with the file specification
    CI             core.PdfObject // A collection item dictionary, which shall be used to create the user interface for portable collections
    AFRelationship core.PdfObject // A value that represents the relationship of this object to the source that points to it.
    // contains filtered or unexported fields
}

func NewPdfFileSpecFromEmbeddedFile

func NewPdfFileSpecFromEmbeddedFile(file *EmbeddedFile) *PdfFilespec

NewPdfFileSpecFromEmbeddedFile construct a new PdfFileSpec that contains an embedded file.

func NewPdfFilespec

func NewPdfFilespec() *PdfFilespec

NewPdfFilespec returns an initialized generic PDF filespec model.

func NewPdfFilespecFromObj

func NewPdfFilespecFromObj(obj core.PdfObject) (*PdfFilespec, error)

NewPdfFilespecFromObj creates and returns a new PdfFilespec object.

func (*PdfFilespec) GetContainingPdfObject

func (f *PdfFilespec) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfFilespec) ToPdfObject

func (f *PdfFilespec) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfFont

PdfFont represents an underlying font structure which can be of type: - Type0 - Type1 - TrueType etc.

type PdfFont struct {
    // contains filtered or unexported fields
}

func DefaultFont

func DefaultFont() *PdfFont

DefaultFont returns the default font, which is currently the built in Helvetica.

func NewCompositePdfFontFromTTF

func NewCompositePdfFontFromTTF(r io.ReadSeeker) (*PdfFont, error)

NewCompositePdfFontFromTTF loads a composite TTF font. Composite fonts can be used to represent unicode fonts which can have multi-byte character codes, representing a wide range of values. They are often used for symbolic languages, including Chinese, Japanese and Korean. It is represented by a Type0 Font with an underlying CIDFontType2 and an Identity-H encoding map. TODO: May be extended in the future to support a larger variety of CMaps and vertical fonts. NOTE: For simple fonts, use NewPdfFontFromTTF.

func NewCompositePdfFontFromTTFFile

func NewCompositePdfFontFromTTFFile(filePath string) (*PdfFont, error)

NewCompositePdfFontFromTTFFile loads a composite font from a TTF font file. Composite fonts can be used to represent unicode fonts which can have multi-byte character codes, representing a wide range of values. They are often used for symbolic languages, including Chinese, Japanese and Korean. It is represented by a Type0 Font with an underlying CIDFontType2 and an Identity-H encoding map. TODO: May be extended in the future to support a larger variety of CMaps and vertical fonts. NOTE: For simple fonts, use NewPdfFontFromTTFFile.

func NewPdfFontFromPdfObject

func NewPdfFontFromPdfObject(fontObj core.PdfObject) (*PdfFont, error)

NewPdfFontFromPdfObject loads a PdfFont from the dictionary `fontObj`. If there is a problem an error is returned.

func NewPdfFontFromTTF

func NewPdfFontFromTTF(r io.ReadSeeker) (*PdfFont, error)

NewPdfFontFromTTF loads a TTF font and returns a PdfFont type that can be used in text styling functions. Uses a WinAnsiTextEncoder and loads only character codes 32-255. NOTE: For composite fonts such as used in symbolic languages, use NewCompositePdfFontFromTTF.

func NewPdfFontFromTTFFile

func NewPdfFontFromTTFFile(filePath string) (*PdfFont, error)

NewPdfFontFromTTFFile loads a TTF font file and returns a PdfFont type that can be used in text styling functions. Uses a WinAnsiTextEncoder and loads only character codes 32-255. NOTE: For composite fonts such as used in symbolic languages, use NewCompositePdfFontFromTTFFile.

func NewStandard14Font

func NewStandard14Font(basefont StdFontName) (*PdfFont, error)

NewStandard14Font returns the standard 14 font named `basefont` as a *PdfFont, or an error if it `basefont` is not one of the standard 14 font names.

func NewStandard14FontMustCompile

func NewStandard14FontMustCompile(basefont StdFontName) *PdfFont

NewStandard14FontMustCompile returns the standard 14 font named `basefont` as a *PdfFont. If `basefont` is one of the 14 Standard14Font values defined above then NewStandard14FontMustCompile is guaranteed to succeed.

func NewStandard14FontWithEncoding

func NewStandard14FontWithEncoding(basefont StdFontName, alphabet map[rune]int) (*PdfFont,
    textencoding.SimpleEncoder, error)

NewStandard14FontWithEncoding returns the standard 14 font named `basefont` as a *PdfFont and a TextEncoder that encodes all the runes in `alphabet`, or an error if this is not possible. An error can occur if `basefont` is not one the standard 14 font names.

func (*PdfFont) BaseFont

func (font *PdfFont) BaseFont() string

BaseFont returns the font's "BaseFont" field.

func (*PdfFont) BytesToCharcodes

func (font *PdfFont) BytesToCharcodes(data []byte) []textencoding.CharCode

BytesToCharcodes converts the bytes in a PDF string to character codes.

func (*PdfFont) CharcodeBytesToUnicode

func (font *PdfFont) CharcodeBytesToUnicode(data []byte) (string, int, int)

CharcodeBytesToUnicode converts PDF character codes `data` to a Go unicode string.

9.10 Extraction of Text Content (page 292) The process of finding glyph descriptions in OpenType fonts by a conforming reader shall be the following:

- For Type 1 fonts using “CFF” tables, the process shall be as described in 9.6.6.2, "Encodings
  for Type 1 Fonts".
- For TrueType fonts using “glyf” tables, the process shall be as described in 9.6.6.4,
  "Encodings for TrueType Fonts". Since this process sometimes produces ambiguous results,
  conforming writers, instead of using a simple font, shall use a Type 0 font with an Identity-H
  encoding and use the glyph indices as character codes, as described following Table 118.

func (*PdfFont) CharcodesToStrings

func (font *PdfFont) CharcodesToStrings(charcodes []textencoding.CharCode, replacementText string) ([]string, int, int)

CharcodesToStrings returns the unicode strings corresponding to `charcodes`. The int returns are the number of strings and the number of unconvereted codes. NOTE: The number of strings returned is equal to the number of charcodes

func (*PdfFont) CharcodesToUnicode

func (font *PdfFont) CharcodesToUnicode(charcodes []textencoding.CharCode) []rune

CharcodesToUnicode converts the character codes `charcodes` to a slice of runes. How it works:

1. Use the ToUnicode CMap if there is one.
2. Use the underlying font's encoding.

func (*PdfFont) CharcodesToUnicodeWithStats

func (font *PdfFont) CharcodesToUnicodeWithStats(charcodes []textencoding.CharCode) (runelist []rune, numHits, numMisses int)

CharcodesToUnicodeWithStats is identical to CharcodesToUnicode except it returns more statistical information about hits and misses from the reverse mapping process. NOTE: The number of runes returned may be greater than the number of charcodes. TODO(peterwilliams97): Deprecate in v4 and use only CharcodesToStrings()

func (*PdfFont) Encoder

func (font *PdfFont) Encoder() textencoding.TextEncoder

Encoder returns the font's text encoder.

func (*PdfFont) FontDescriptor

func (font *PdfFont) FontDescriptor() *PdfFontDescriptor

FontDescriptor returns font's PdfFontDescriptor. This may be a builtin descriptor for standard 14 fonts but must be an explicit descriptor for other fonts.

func (*PdfFont) GetCIDToGIDMapObject

func (font *PdfFont) GetCIDToGIDMapObject() core.PdfObject

GetCIDToGIDMapObject get the underlying CIDToGIDMap object if the font type is CIDFontType2.

func (*PdfFont) GetCharMetrics

func (font *PdfFont) GetCharMetrics(code textencoding.CharCode) (CharMetrics, bool)

GetCharMetrics returns the char metrics for character code `code`. How it works:

1. It calls the GetCharMetrics function for the underlying font, either a simple font or
   a Type0 font. The underlying font GetCharMetrics() functions do direct charcode ➞  metrics
   mappings.
2. If the underlying font's GetCharMetrics() doesn't have a CharMetrics for `code` then a
   a CharMetrics with the FontDescriptor's /MissingWidth is returned.
3. If there is no /MissingWidth then a failure is returned.

TODO(peterwilliams97) There is nothing callers can do if no CharMetrics are found so we might as well give them 0 width. There is no need for the bool return.

TODO(gunnsth): Reconsider whether needed or if can map via GlyphName.

func (PdfFont) GetFontDescriptor

func (font PdfFont) GetFontDescriptor() (*PdfFontDescriptor, error)

GetFontDescriptor returns the font descriptor for `font`.

func (*PdfFont) GetRuneMetrics

func (font *PdfFont) GetRuneMetrics(r rune) (CharMetrics, bool)

GetRuneMetrics returns the char metrics for a rune. TODO(peterwilliams97) There is nothing callers can do if no CharMetrics are found so we might as well give them 0 width. There is no need for the bool return.

func (*PdfFont) IsCID

func (font *PdfFont) IsCID() bool

IsCID returns true if the underlying font is CID.

func (*PdfFont) IsSimple

func (font *PdfFont) IsSimple() bool

IsSimple returns true if `font` is a simple font.

func (*PdfFont) RunesToCharcodeBytes

func (font *PdfFont) RunesToCharcodeBytes(data []rune) ([]byte, int)

RunesToCharcodeBytes maps the provided runes to charcode bytes and it returns the resulting slice of bytes, along with the number of runes which could not be converted. If the number of misses is 0, all runes were successfully converted.

func (*PdfFont) String

func (font *PdfFont) String() string

String returns a string that describes `font`.

func (*PdfFont) StringToCharcodeBytes

func (font *PdfFont) StringToCharcodeBytes(str string) ([]byte, int)

StringToCharcodeBytes maps the provided string runes to charcode bytes and it returns the resulting slice of bytes, along with the number of runes which could not be converted. If the number of misses is 0, all string runes were successfully converted.

func (*PdfFont) SubsetRegistered

func (font *PdfFont) SubsetRegistered() error

SubsetRegistered subsets the font to only the glyphs that have been registered by the encoder.

NOTE: This only works on fonts that support subsetting. For unsupported fonts this is a no-op, although a debug message is emitted. Currently supported fonts are embedded Truetype CID fonts (type 0).

NOTE: Make sure to call this soon before writing (once all needed runes have been registered). If using package creator, use its EnableFontSubsetting method instead.

func (*PdfFont) Subtype

func (font *PdfFont) Subtype() string

Subtype returns the font's "Subtype" field.

func (*PdfFont) ToPdfObject

func (font *PdfFont) ToPdfObject() core.PdfObject

ToPdfObject converts the PdfFont object to its PDF representation.

func (*PdfFont) ToUnicode

func (font *PdfFont) ToUnicode() string

ToUnicode returns the name of the font's "ToUnicode" field if there is one, or "" if there isn't.

type PdfFontDescriptor

PdfFontDescriptor specifies metrics and other attributes of a font and can refer to a FontFile for embedded fonts. 9.8 Font Descriptors (page 281)

type PdfFontDescriptor struct {
    FontName     core.PdfObject
    FontFamily   core.PdfObject
    FontStretch  core.PdfObject
    FontWeight   core.PdfObject
    Flags        core.PdfObject
    FontBBox     core.PdfObject
    ItalicAngle  core.PdfObject
    Ascent       core.PdfObject
    Descent      core.PdfObject
    Leading      core.PdfObject
    CapHeight    core.PdfObject
    XHeight      core.PdfObject
    StemV        core.PdfObject
    StemH        core.PdfObject
    AvgWidth     core.PdfObject
    MaxWidth     core.PdfObject
    MissingWidth core.PdfObject
    FontFile     core.PdfObject // PFB
    FontFile2    core.PdfObject // TTF
    FontFile3    core.PdfObject // OTF / CFF
    CharSet      core.PdfObject

    // Additional entries for CIDFonts
    Style  core.PdfObject
    Lang   core.PdfObject
    FD     core.PdfObject
    CIDSet core.PdfObject
    // contains filtered or unexported fields
}

func (*PdfFontDescriptor) GetAscent

func (desc *PdfFontDescriptor) GetAscent() (float64, error)

GetAscent returns the Ascent of the font `descriptor`.

func (*PdfFontDescriptor) GetCapHeight

func (desc *PdfFontDescriptor) GetCapHeight() (float64, error)

GetCapHeight returns the CapHeight of the font `descriptor`.

func (*PdfFontDescriptor) GetDescent

func (desc *PdfFontDescriptor) GetDescent() (float64, error)

GetDescent returns the Descent of the font `descriptor`.

func (*PdfFontDescriptor) GetXHeight

func (desc *PdfFontDescriptor) GetXHeight() (float64, error)

GetXHeight returns the XHeight of the font `descriptor`.

func (*PdfFontDescriptor) String

func (desc *PdfFontDescriptor) String() string

String returns a string describing the font descriptor.

func (*PdfFontDescriptor) ToPdfObject

func (desc *PdfFontDescriptor) ToPdfObject() core.PdfObject

ToPdfObject returns the PdfFontDescriptor as a PDF dictionary inside an indirect object.

type PdfFunction

PdfFunction interface represents the common methods of a function in PDF.

type PdfFunction interface {
    Evaluate([]float64) ([]float64, error)
    ToPdfObject() core.PdfObject
}

type PdfFunctionType0

PdfFunctionType0 uses a sequence of sample values (contained in a stream) to provide an approximation for functions whose domains and ranges are bounded. The samples are organized as an m-dimensional table in which each entry has n components

type PdfFunctionType0 struct {
    Domain []float64 // required; 2*m length; where m is the number of input values
    Range  []float64 // required (type 0); 2*n length; where n is the number of output values

    NumInputs  int
    NumOutputs int

    Size          []int
    BitsPerSample int
    Order         int // Values 1 or 3 (linear or cubic spline interpolation)
    Encode        []float64
    Decode        []float64
    // contains filtered or unexported fields
}

func (*PdfFunctionType0) Evaluate

func (f *PdfFunctionType0) Evaluate(x []float64) ([]float64, error)

Evaluate runs the function on the passed in slice and returns the results.

func (*PdfFunctionType0) ToPdfObject

func (f *PdfFunctionType0) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfFunctionType2

PdfFunctionType2 defines an exponential interpolation of one input value and n output values:

f(x) = y_0, ..., y_(n-1)

y_j = C0_j + x^N * (C1_j - C0_j); for 0 <= j < n When N=1 ; linear interpolation between C0 and C1.

type PdfFunctionType2 struct {
    Domain []float64
    Range  []float64

    C0 []float64
    C1 []float64
    N  float64
    // contains filtered or unexported fields
}

func (*PdfFunctionType2) Evaluate

func (f *PdfFunctionType2) Evaluate(x []float64) ([]float64, error)

Evaluate runs the function on the passed in slice and returns the results.

func (*PdfFunctionType2) ToPdfObject

func (f *PdfFunctionType2) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfFunctionType3

PdfFunctionType3 defines stitching of the subdomains of several 1-input functions to produce a single new 1-input function.

type PdfFunctionType3 struct {
    Domain []float64
    Range  []float64

    Functions []PdfFunction // k-1 input functions
    Bounds    []float64     // k-1 numbers; defines the intervals where each function applies
    Encode    []float64     // Array of 2k numbers..
    // contains filtered or unexported fields
}

func (*PdfFunctionType3) Evaluate

func (f *PdfFunctionType3) Evaluate(x []float64) ([]float64, error)

Evaluate runs the function on the passed in slice and returns the results.

func (*PdfFunctionType3) ToPdfObject

func (f *PdfFunctionType3) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfFunctionType4

PdfFunctionType4 is a Postscript calculator functions.

type PdfFunctionType4 struct {
    Domain  []float64
    Range   []float64
    Program *ps.PSProgram
    // contains filtered or unexported fields
}

func (*PdfFunctionType4) Evaluate

func (f *PdfFunctionType4) Evaluate(xVec []float64) ([]float64, error)

Evaluate runs the function. Input is [x1 x2 x3].

func (*PdfFunctionType4) ToPdfObject

func (f *PdfFunctionType4) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfInfo

PdfInfo holds document information that will overwrite document information global variables defined above.

type PdfInfo struct {
    Title        *core.PdfObjectString
    Author       *core.PdfObjectString
    Subject      *core.PdfObjectString
    Keywords     *core.PdfObjectString
    Creator      *core.PdfObjectString
    Producer     *core.PdfObjectString
    CreationDate *PdfDate
    ModifiedDate *PdfDate
    Trapped      *core.PdfObjectName
    // contains filtered or unexported fields
}

func NewPdfInfoFromObject

func NewPdfInfoFromObject(obj core.PdfObject) (*PdfInfo, error)

NewPdfInfoFromObject creates a new PdfInfo from the input core.PdfObject.

func (*PdfInfo) AddCustomInfo

func (info *PdfInfo) AddCustomInfo(name string, value string) error

AddCustomInfo adds a custom info into document info dictionary.

func (*PdfInfo) CustomKeys

func (info *PdfInfo) CustomKeys() []string

CustomKeys returns all custom info keys as list.

func (*PdfInfo) GetCustomInfo

func (info *PdfInfo) GetCustomInfo(name string) *core.PdfObjectString

GetCustomInfo returns a custom info value for the specified name.

func (*PdfInfo) ToPdfObject

func (info *PdfInfo) ToPdfObject() core.PdfObject

ToPdfObject convert PdfInfo to pdf object.

type PdfInfoTrapped

PdfInfoTrapped specifies pdf trapped information.

type PdfInfoTrapped string
const (
    // TrappedUnknown specifies that either it is unknown whether the document has been trapped or
    // it has been partly but not yet fully trapped;
    // some additional trapping may still be needed.
    // This is the default value.
    TrappedUnknown PdfInfoTrapped = "Unknown"

    // TrappedTrue specifies that the document has been fully trapped;
    // no further trapping shall be needed.
    TrappedTrue PdfInfoTrapped = "True"

    // TrappedFalse specifies that the document has not yet been trapped.
    TrappedFalse PdfInfoTrapped = "False"
)

type PdfModel

PdfModel is a higher level PDF construct which can be collapsed into a PdfObject. Each PdfModel has an underlying PdfObject and vice versa (one-to-one). Under normal circumstances there should only be one copy of each. Copies can be made, but care must be taken to do it properly.

type PdfModel interface {
    ToPdfObject() core.PdfObject
    GetContainingPdfObject() core.PdfObject
}

type PdfOutline

PdfOutline represents a PDF outline dictionary (Table 152 - p. 376).

type PdfOutline struct {
    PdfOutlineTreeNode
    Parent *PdfOutlineTreeNode
    Count  *int64
    // contains filtered or unexported fields
}

func NewPdfOutline

func NewPdfOutline() *PdfOutline

NewPdfOutline returns an initialized PdfOutline.

func NewPdfOutlineTree

func NewPdfOutlineTree() *PdfOutline

NewPdfOutlineTree returns an initialized PdfOutline tree.

func (*PdfOutline) GetContainingPdfObject

func (o *PdfOutline) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the outline (indirect object).

func (*PdfOutline) ToPdfObject

func (o *PdfOutline) ToPdfObject() core.PdfObject

ToPdfObject recursively builds the Outline tree PDF object.

type PdfOutlineItem

PdfOutlineItem represents an outline item dictionary (Table 153 - pp. 376 - 377).

type PdfOutlineItem struct {
    PdfOutlineTreeNode
    Title  *core.PdfObjectString
    Parent *PdfOutlineTreeNode
    Prev   *PdfOutlineTreeNode
    Next   *PdfOutlineTreeNode
    Count  *int64
    Dest   core.PdfObject
    A      core.PdfObject
    SE     core.PdfObject
    C      core.PdfObject
    F      core.PdfObject
    // contains filtered or unexported fields
}

func NewOutlineBookmark

func NewOutlineBookmark(title string, page *core.PdfIndirectObject) *PdfOutlineItem

NewOutlineBookmark returns an initialized PdfOutlineItem for a given bookmark title and page.

func NewPdfOutlineItem

func NewPdfOutlineItem() *PdfOutlineItem

NewPdfOutlineItem returns an initialized PdfOutlineItem.

func (*PdfOutlineItem) GetContainingPdfObject

func (oi *PdfOutlineItem) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the outline item (indirect object).

func (*PdfOutlineItem) ToPdfObject

func (oi *PdfOutlineItem) ToPdfObject() core.PdfObject

ToPdfObject recursively builds the Outline tree PDF object.

type PdfOutlineTreeNode

PdfOutlineTreeNode contains common fields used by the outline and outline item objects.

type PdfOutlineTreeNode struct {
    First *PdfOutlineTreeNode
    Last  *PdfOutlineTreeNode
    // contains filtered or unexported fields
}

func (*PdfOutlineTreeNode) GetContainingPdfObject

func (n *PdfOutlineTreeNode) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the outline tree node (indirect object).

func (*PdfOutlineTreeNode) GetContext

func (n *PdfOutlineTreeNode) GetContext() PdfModel

GetContext returns the context of the outline tree node, which is either a *PdfOutline or a *PdfOutlineItem. The method returns nil for uninitialized tree nodes.

func (*PdfOutlineTreeNode) ToPdfObject

func (n *PdfOutlineTreeNode) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the outline tree node.

type PdfOutputIntent

PdfOutputIntent provides a means for matching the color characteristics of a PDF document with those of a target output device. Multiple PdfOutputIntents allows the production process to be customized to the expected workflow and the specific tools available.

type PdfOutputIntent struct {
    // Type is an optional PDF object that this dictionary describes.
    // If present, must be OutputIntent for an output intent dictionary.
    Type string
    // S defines the OutputIntent subtype which should match the standard used in given document i.e:
    // for PDF/X use PdfOutputIntentTypeX.
    S PdfOutputIntentType
    // OutputCondition is an optional field that is identifying the intended output device or production condition in
    // human-readable form. This is preferred method of defining such a string for presentation to the user.
    OutputCondition string
    // OutputConditionIdentifier is a required field identifying the intended output device or production condition in
    // human or machine-readable form. If human-readable, this string may be used
    // in lieu of an OutputCondition for presentation to the user.
    // A typical value for this entry would be the name of a production condition  maintained
    // in  an  industry-standard registry such  as the ICC Characterization Data Registry
    // If the intended production condition is not a recognized standard, the value Custom is recommended for this entry.
    // the DestOutputProfile entry defines the ICC profile, and the Info entry is used for further
    // human-readable identification.
    OutputConditionIdentifier string
    // RegistryName is an optional string field (conventionally URI) identifying the registry in which the condition
    // designated by OutputConditionIdentifier is defined.
    RegistryName string
    // Info is a required field if OutputConditionIdentifier does not specify a standard production condition.
    // A human-readable text string containing additional information  or comments about intended
    // target device or production condition.
    Info string
    // DestOutputProfile is required if OutputConditionIdentifier does not specify a standard production condition.
    // It is an ICC profile stream defining the transformation from the PDF document's source colors to output device colorants.
    DestOutputProfile []byte
    // ColorComponents is the number of color components supported by given output profile.
    ColorComponents int
    // contains filtered or unexported fields
}

func NewCustomPdfOutputIntent

func NewCustomPdfOutputIntent(outputCondition, outputConditionIdentifier, info string, destOutputProfile []byte, colorComponents int) *PdfOutputIntent

NewCustomPdfOutputIntent creates a new custom PdfOutputIntent.

func NewPdfOutputIntentFromPdfObject

func NewPdfOutputIntentFromPdfObject(object core.PdfObject) (*PdfOutputIntent, error)

NewPdfOutputIntentFromPdfObject creates a new PdfOutputIntent from the input core.PdfObject.

func NewStandardPdfOutputIntent

func NewStandardPdfOutputIntent(outputCondition, outputConditionIdentifier, registryName string, destOutputProfile []byte, colorComponents int) *PdfOutputIntent

NewStandardPdfOutputIntent creates a new standard PdfOutputIntent.

func (*PdfOutputIntent) GetContainingPdfObject

func (p *PdfOutputIntent) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject implements model.PdfModel interface.

func (*PdfOutputIntent) ParsePdfObject

func (p *PdfOutputIntent) ParsePdfObject(object core.PdfObject) error

ParsePdfObject parses input pdf object into given output intent.

func (*PdfOutputIntent) SetSubtype

func (p *PdfOutputIntent) SetSubtype(subtype PdfOutputIntentType) error

SetSubtype sets the Subtype S for given PdfOutputIntent.

func (*PdfOutputIntent) ToPdfObject

func (p *PdfOutputIntent) ToPdfObject() core.PdfObject

ToPdfObject implements model.PdfModel interface.

type PdfOutputIntentType

PdfOutputIntentType is the subtype of the given PdfOutputIntent.

type PdfOutputIntentType int
const (

    // PdfOutputIntentTypeA1 is the PdfOutputIntentType used with the standard PDF/A-1
    PdfOutputIntentTypeA1 PdfOutputIntentType
    // PdfOutputIntentTypeA2 is the PdfOutputIntentType used with the standard PDF/A-2
    PdfOutputIntentTypeA2
    // PdfOutputIntentTypeA3 is the PdfOutputIntentType used with the standard PDF/A-3
    PdfOutputIntentTypeA3
    // PdfOutputIntentTypeA4 is the PdfOutputIntentType used with the standard PDF/A-4
    PdfOutputIntentTypeA4
    // PdfOutputIntentTypeX is the PdfOutputIntentType used with the standard PDF/X
    PdfOutputIntentTypeX
)

func (PdfOutputIntentType) IsValid

func (p PdfOutputIntentType) IsValid() bool

IsValid checks if the given pdf output intent type is valid.

func (PdfOutputIntentType) String

func (p PdfOutputIntentType) String() string

String returns string value of output intent for given type ISO_19005-2 6.2.3: GTS_PDFA1 value should be used for PDF/A-1, A-2 and A-3 at least

type PdfPage

PdfPage represents a page in a PDF document. (7.7.3.3 - Table 30).

type PdfPage struct {
    Parent               core.PdfObject
    LastModified         *PdfDate
    Resources            *PdfPageResources
    CropBox              *PdfRectangle
    MediaBox             *PdfRectangle
    BleedBox             *PdfRectangle
    TrimBox              *PdfRectangle
    ArtBox               *PdfRectangle
    BoxColorInfo         core.PdfObject
    Contents             core.PdfObject
    Rotate               *int64
    Group                core.PdfObject
    Thumb                core.PdfObject
    B                    core.PdfObject
    Dur                  core.PdfObject
    Trans                core.PdfObject
    AA                   core.PdfObject
    Metadata             core.PdfObject
    PieceInfo            core.PdfObject
    StructParents        core.PdfObject
    ID                   core.PdfObject
    PZ                   core.PdfObject
    SeparationInfo       core.PdfObject
    Tabs                 core.PdfObject
    TemplateInstantiated core.PdfObject
    PresSteps            core.PdfObject
    UserUnit             core.PdfObject
    VP                   core.PdfObject
    Annots               core.PdfObject
    // contains filtered or unexported fields
}

func NewPdfPage

func NewPdfPage() *PdfPage

NewPdfPage returns a new PDF page.

func (*PdfPage) AddAnnotation

func (p *PdfPage) AddAnnotation(annot *PdfAnnotation)

AddAnnotation appends `annot` to the list of page annotations.

func (*PdfPage) AddContentStreamByString

func (p *PdfPage) AddContentStreamByString(contentStr string) error

AddContentStreamByString adds content stream by string. Puts the content string into a stream object and points the content stream towards it.

func (*PdfPage) AddExtGState

func (p *PdfPage) AddExtGState(name core.PdfObjectName, egs *core.PdfObjectDictionary) error

AddExtGState adds a graphics state to the XObject resources.

func (*PdfPage) AddFont

func (p *PdfPage) AddFont(name core.PdfObjectName, font core.PdfObject) error

AddFont adds a font dictionary to the Font resources.

func (*PdfPage) AddImageResource

func (p *PdfPage) AddImageResource(name core.PdfObjectName, ximg *XObjectImage) error

AddImageResource adds an image to the XObject resources.

func (*PdfPage) AddWatermarkImage

func (p *PdfPage) AddWatermarkImage(ximg *XObjectImage, opt WatermarkImageOptions) error

AddWatermarkImage adds a watermark to the page.

func (*PdfPage) AppendContentBytes

func (p *PdfPage) AppendContentBytes(cs []byte, wrapContents bool) error

AppendContentBytes creates a PDF stream from `cs` and appends it to the array of streams specified by the pages's Contents entry. If `wrapContents` is true, the content stream of the page is wrapped using a `q/Q` operator pair, so that its state does not affect the appended content stream.

func (*PdfPage) AppendContentStream

func (p *PdfPage) AppendContentStream(contentStr string) error

AppendContentStream adds content stream by string. Appends to the last contentstream instance if many.

func (*PdfPage) Duplicate

func (p *PdfPage) Duplicate() *PdfPage

Duplicate creates a duplicate page based on the current one and returns it.

func (*PdfPage) FlattenFieldsWithOpts

func (page *PdfPage) FlattenFieldsWithOpts(appgen FieldAppearanceGenerator, opts *FieldFlattenOpts) error

FlattenFieldsWithOpts flattens the AcroForm fields of the page using the provided field appearance generator and the specified options. If no options are specified, all form fields are flattened for the page. If a filter function is provided using the opts parameter, only the filtered fields are flattened. Otherwise, all form fields are flattened.

func (*PdfPage) GetAllContentStreams

func (p *PdfPage) GetAllContentStreams() (string, error)

GetAllContentStreams gets all the content streams for a page as one string.

func (*PdfPage) GetAnnotations

func (p *PdfPage) GetAnnotations() ([]*PdfAnnotation, error)

GetAnnotations returns the list of page annotations for `page`. If not loaded attempts to load the annotations, otherwise returns the loaded list.

func (*PdfPage) GetContainingPdfObject

func (p *PdfPage) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the page as a dictionary within an PdfIndirectObject.

func (*PdfPage) GetContentStreamObjs

func (p *PdfPage) GetContentStreamObjs() []core.PdfObject

GetContentStreamObjs returns a slice of PDF objects containing the content streams of the page.

func (*PdfPage) GetContentStreams

func (p *PdfPage) GetContentStreams() ([]string, error)

GetContentStreams returns the content stream as an array of strings.

func (*PdfPage) GetMediaBox

func (p *PdfPage) GetMediaBox() (*PdfRectangle, error)

GetMediaBox gets the inheritable media box value, either from the page or a higher up page/pages struct.

func (*PdfPage) GetPageAsIndirectObject

func (p *PdfPage) GetPageAsIndirectObject() *core.PdfIndirectObject

GetPageAsIndirectObject returns the page as a dictionary within an PdfIndirectObject.

func (*PdfPage) GetPageDict

func (p *PdfPage) GetPageDict() *core.PdfObjectDictionary

GetPageDict converts the Page to a PDF object dictionary.

func (*PdfPage) GetRotate

func (p *PdfPage) GetRotate() (int64, error)

GetRotate gets the inheritable rotate value, either from the page or a higher up page/pages struct.

func (*PdfPage) GetStructParentsKey

func (p *PdfPage) GetStructParentsKey() int

GetStructParentsKey returns the StructParents key. If not set, returns -1.

func (*PdfPage) GetStructTreeRoot

func (p *PdfPage) GetStructTreeRoot() (*core.PdfObject, bool)

GetStructRoot gets the StructTreeRoot object

func (*PdfPage) GetXObjectByName

func (p *PdfPage) GetXObjectByName(name core.PdfObjectName) (core.PdfObject, bool)

GetXObjectByName gets XObject by name.

func (*PdfPage) HasExtGState

func (p *PdfPage) HasExtGState(name core.PdfObjectName) bool

HasExtGState checks if ExtGState name is available.

func (*PdfPage) HasFontByName

func (p *PdfPage) HasFontByName(name core.PdfObjectName) bool

HasFontByName checks if has font resource by name.

func (*PdfPage) HasXObjectByName

func (p *PdfPage) HasXObjectByName(name core.PdfObjectName) bool

HasXObjectByName checks if has XObject resource by name.

func (*PdfPage) RemoveStructParentsKey

func (p *PdfPage) RemoveStructParentsKey()

RemoveStructParentsKey removes the StructParents key.

func (*PdfPage) RemoveTabOrder

func (p *PdfPage) RemoveTabOrder()

RemveTabOrder removes the tab order for the page.

func (*PdfPage) SetAnnotations

func (p *PdfPage) SetAnnotations(annotations []*PdfAnnotation)

SetAnnotations sets the annotations list.

func (*PdfPage) SetContentStreams

func (p *PdfPage) SetContentStreams(cStreams []string, encoder core.StreamEncoder) error

SetContentStreams sets the content streams based on a string array. Will make 1 object stream for each string and reference from the page Contents. Each stream will be encoded using the encoding specified by the StreamEncoder, if empty, will use identity encoding (raw data).

func (*PdfPage) SetStructParentsKey

func (p *PdfPage) SetStructParentsKey(key int)

SetStructParentsKey sets the StructParents key.

func (*PdfPage) SetTabOrder

func (p *PdfPage) SetTabOrder(order TabOrderType)

SetTabOrder sets the tab order for the page.

func (*PdfPage) Size

func (p *PdfPage) Size() (float64, float64, error)

Size returns the width and the height of the page. The method reports the page dimensions as displayed by a PDF viewer (i.e. page rotation is taken into account).

func (*PdfPage) ToPdfObject

func (p *PdfPage) ToPdfObject() core.PdfObject

ToPdfObject converts the PdfPage to a dictionary within an indirect object container.

type PdfPageResources

PdfPageResources is a Page resources model. Implements PdfModel.

type PdfPageResources struct {
    ExtGState  core.PdfObject
    ColorSpace core.PdfObject
    Pattern    core.PdfObject
    Shading    core.PdfObject
    XObject    core.PdfObject
    Font       core.PdfObject
    ProcSet    core.PdfObject
    Properties core.PdfObject
    // contains filtered or unexported fields
}

func NewPdfPageResources

func NewPdfPageResources() *PdfPageResources

NewPdfPageResources returns a new PdfPageResources object.

func NewPdfPageResourcesFromDict

func NewPdfPageResourcesFromDict(dict *core.PdfObjectDictionary) (*PdfPageResources, error)

NewPdfPageResourcesFromDict creates and returns a new PdfPageResources object from the input dictionary.

func (*PdfPageResources) AddExtGState

func (r *PdfPageResources) AddExtGState(gsName core.PdfObjectName, gsDict core.PdfObject) error

AddExtGState add External Graphics State (GState). The gsDict can be specified either directly as a dictionary or an indirect object containing a dictionary.

func (*PdfPageResources) GenerateXObjectName

func (r *PdfPageResources) GenerateXObjectName() core.PdfObjectName

GenerateXObjectName generates an unused XObject name that can be used for adding new XObjects. Uses format XObj1, XObj2, ...

func (*PdfPageResources) GetColorspaceByName

func (r *PdfPageResources) GetColorspaceByName(keyName core.PdfObjectName) (PdfColorspace, bool)

GetColorspaceByName returns the colorspace with the specified name from the page resources.

func (*PdfPageResources) GetColorspaces

func (r *PdfPageResources) GetColorspaces() (*PdfPageResourcesColorspaces, error)

GetColorspaces loads PdfPageResourcesColorspaces from `r.ColorSpace` and returns an error if there is a problem loading. Once loaded, the same object is returned on multiple calls.

func (*PdfPageResources) GetContainingPdfObject

func (r *PdfPageResources) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the resources object (indirect object).

func (*PdfPageResources) GetExtGState

func (r *PdfPageResources) GetExtGState(keyName core.PdfObjectName) (core.PdfObject, bool)

GetExtGState gets the ExtGState specified by keyName. Returns a bool indicating whether it was found or not.

func (*PdfPageResources) GetFontByName

func (r *PdfPageResources) GetFontByName(keyName core.PdfObjectName) (core.PdfObject, bool)

GetFontByName gets the font specified by keyName. Returns the PdfObject which the entry refers to. Returns a bool value indicating whether or not the entry was found.

func (*PdfPageResources) GetPatternByName

func (r *PdfPageResources) GetPatternByName(keyName core.PdfObjectName) (*PdfPattern, bool)

GetPatternByName gets the pattern specified by keyName. Returns nil if not existing. The bool flag indicated whether it was found or not.

func (*PdfPageResources) GetShadingByName

func (r *PdfPageResources) GetShadingByName(keyName core.PdfObjectName) (*PdfShading, bool)

GetShadingByName gets the shading specified by keyName. Returns nil if not existing. The bool flag indicated whether it was found or not.

func (*PdfPageResources) GetXObjectByName

func (r *PdfPageResources) GetXObjectByName(keyName core.PdfObjectName) (*core.PdfObjectStream, XObjectType)

GetXObjectByName returns the XObject with the specified keyName and the object type.

func (*PdfPageResources) GetXObjectFormByName

func (r *PdfPageResources) GetXObjectFormByName(keyName core.PdfObjectName) (*XObjectForm, error)

GetXObjectFormByName returns the XObjectForm with the specified name from the page resources, if it exists.

func (*PdfPageResources) GetXObjectImageByName

func (r *PdfPageResources) GetXObjectImageByName(keyName core.PdfObjectName) (*XObjectImage, error)

GetXObjectImageByName returns the XObjectImage with the specified name from the page resources, if it exists.

func (*PdfPageResources) HasColorspaceByName

func (r *PdfPageResources) HasColorspaceByName(keyName core.PdfObjectName) bool

HasColorspaceByName checks if the colorspace with the specified name exists in the page resources.

func (*PdfPageResources) HasExtGState

func (r *PdfPageResources) HasExtGState(keyName core.PdfObjectName) bool

HasExtGState checks whether a font is defined by the specified keyName.

func (*PdfPageResources) HasFontByName

func (r *PdfPageResources) HasFontByName(keyName core.PdfObjectName) bool

HasFontByName checks whether a font is defined by the specified keyName.

func (*PdfPageResources) HasPatternByName

func (r *PdfPageResources) HasPatternByName(keyName core.PdfObjectName) bool

HasPatternByName checks whether a pattern object is defined by the specified keyName.

func (*PdfPageResources) HasShadingByName

func (r *PdfPageResources) HasShadingByName(keyName core.PdfObjectName) bool

HasShadingByName checks whether a shading is defined by the specified keyName.

func (*PdfPageResources) HasXObjectByName

func (r *PdfPageResources) HasXObjectByName(keyName core.PdfObjectName) bool

HasXObjectByName checks if an XObject with a specified keyName is defined.

func (*PdfPageResources) SetColorSpace

func (r *PdfPageResources) SetColorSpace(colorspace *PdfPageResourcesColorspaces)

SetColorSpace sets `r` colorspace object to `colorspace`.

func (*PdfPageResources) SetColorspaceByName

func (r *PdfPageResources) SetColorspaceByName(keyName core.PdfObjectName, cs PdfColorspace) error

SetColorspaceByName adds the provided colorspace to the page resources.

func (*PdfPageResources) SetFontByName

func (r *PdfPageResources) SetFontByName(keyName core.PdfObjectName, obj core.PdfObject) error

SetFontByName sets the font specified by keyName to the given object.

func (*PdfPageResources) SetPatternByName

func (r *PdfPageResources) SetPatternByName(keyName core.PdfObjectName, pattern core.PdfObject) error

SetPatternByName sets a pattern resource specified by keyName.

func (*PdfPageResources) SetShadingByName

func (r *PdfPageResources) SetShadingByName(keyName core.PdfObjectName, shadingObj core.PdfObject) error

SetShadingByName sets a shading resource specified by keyName.

func (*PdfPageResources) SetXObjectByName

func (r *PdfPageResources) SetXObjectByName(keyName core.PdfObjectName, stream *core.PdfObjectStream) error

SetXObjectByName adds the XObject from the passed in stream to the page resources. The added XObject is identified by the specified name.

func (*PdfPageResources) SetXObjectFormByName

func (r *PdfPageResources) SetXObjectFormByName(keyName core.PdfObjectName, xform *XObjectForm) error

SetXObjectFormByName adds the provided XObjectForm to the page resources. The added XObjectForm is identified by the specified name.

func (*PdfPageResources) SetXObjectImageByName

func (r *PdfPageResources) SetXObjectImageByName(keyName core.PdfObjectName, ximg *XObjectImage) error

SetXObjectImageByName adds the provided XObjectImage to the page resources. The added XObjectImage is identified by the specified name.

func (*PdfPageResources) SetXObjectImageByNameLazy

func (r *PdfPageResources) SetXObjectImageByNameLazy(keyName core.PdfObjectName, ximg *XObjectImage, lazy bool) error

SetXObjectImageByNameLazy adds the provided XObjectImage to the page resources. The added XObjectImage is identified by the specified name.

func (*PdfPageResources) ToPdfObject

func (r *PdfPageResources) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the page resources.

type PdfPageResourcesColorspaces

PdfPageResourcesColorspaces contains the colorspace in the PdfPageResources. Needs to have matching name and colorspace map entry. The Names define the order.

type PdfPageResourcesColorspaces struct {
    Names       []string
    Colorspaces map[string]PdfColorspace
    // contains filtered or unexported fields
}

func NewPdfPageResourcesColorspaces

func NewPdfPageResourcesColorspaces() *PdfPageResourcesColorspaces

NewPdfPageResourcesColorspaces returns a new PdfPageResourcesColorspaces object.

func (*PdfPageResourcesColorspaces) Set

func (rcs *PdfPageResourcesColorspaces) Set(key core.PdfObjectName, val PdfColorspace)

Set sets the colorspace corresponding to key. Add to Names if not set.

func (*PdfPageResourcesColorspaces) ToPdfObject

func (rcs *PdfPageResourcesColorspaces) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfPattern

A PdfPattern can represent a Pattern, either a tiling pattern or a shading pattern. Note that all patterns shall be treated as colours; a Pattern colour space shall be established with the CS or cs operator just like other colour spaces, and a particular pattern shall be installed as the current colour with the SCN or scn operator.

type PdfPattern struct {
    // Type: Pattern
    PatternType int64
    // contains filtered or unexported fields
}

func (*PdfPattern) GetAsShadingPattern

func (p *PdfPattern) GetAsShadingPattern() *PdfShadingPattern

GetAsShadingPattern returns a shading pattern. Check with IsShading() prior to using this.

func (*PdfPattern) GetAsTilingPattern

func (p *PdfPattern) GetAsTilingPattern() *PdfTilingPattern

GetAsTilingPattern returns a tiling pattern. Check with IsTiling() prior to using this.

func (*PdfPattern) GetContainingPdfObject

func (p *PdfPattern) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the pattern object (indirect object).

func (*PdfPattern) GetContext

func (p *PdfPattern) GetContext() PdfModel

GetContext returns a reference to the subpattern entry: either PdfTilingPattern or PdfShadingPattern.

func (*PdfPattern) IsShading

func (p *PdfPattern) IsShading() bool

IsShading specifies if the pattern is a shading pattern.

func (*PdfPattern) IsTiling

func (p *PdfPattern) IsTiling() bool

IsTiling specifies if the pattern is a tiling pattern.

func (*PdfPattern) SetContext

func (p *PdfPattern) SetContext(ctx PdfModel)

SetContext sets the sub pattern (context). Either PdfTilingPattern or PdfShadingPattern.

func (*PdfPattern) ToPdfObject

func (p *PdfPattern) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the pattern.

type PdfReader

PdfReader represents a PDF file reader. It is a frontend to the lower level parsing mechanism and provides a higher level access to work with PDF structure and information, such as the page structure etc.

type PdfReader struct {
    PageList []*PdfPage

    AcroForm *PdfAcroForm
    DSS      *DSS
    Rotate   *int64
    // contains filtered or unexported fields
}

func NewPdfReader

func NewPdfReader(rs io.ReadSeeker) (*PdfReader, error)

NewPdfReader returns a new PdfReader for an input io.ReadSeeker interface. Can be used to read PDF from memory or file. Immediately loads and traverses the PDF structure including pages and page contents (if not encrypted). Loads entire document structure into memory. Alternatively a lazy-loading reader can be created with NewPdfReaderLazy which loads only references, and references are loaded from disk into memory on an as-needed basis.

func NewPdfReaderFromFile

func NewPdfReaderFromFile(pdfFile string, opts *ReaderOpts) (*PdfReader, *os.File, error)

NewPdfReaderFromFile creates a new PdfReader from the speficied PDF file. If ReaderOpts is nil it will be set to default value from NewReaderOpts.

func NewPdfReaderLazy

func NewPdfReaderLazy(rs io.ReadSeeker) (*PdfReader, error)

NewPdfReaderLazy creates a new PdfReader for `rs` in lazy-loading mode. The difference from NewPdfReader is that in lazy-loading mode, objects are only loaded into memory when needed rather than entire structure being loaded into memory on reader creation. Note that it may make sense to use the lazy-load reader when processing only parts of files, rather than loading entire file into memory. Example: splitting a few pages from a large PDF file.

func NewPdfReaderWithOpts

func NewPdfReaderWithOpts(rs io.ReadSeeker, opts *ReaderOpts) (*PdfReader, error)

NewPdfReaderWithOpts creates a new PdfReader for an input io.ReadSeeker interface with a ReaderOpts. If ReaderOpts is nil it will be set to default value from NewReaderOpts.

func NewReaderForText

func NewReaderForText(txt string) *PdfReader

NewReaderForText makes a new PdfReader for an input PDF content string. For use in testing.

func (*PdfReader) AcroFormNeedsRepair

func (r *PdfReader) AcroFormNeedsRepair() (bool, error)

AcroFormNeedsRepair returns true if the document contains widget annotations linked to fields which are not referenced in the AcroForm. The AcroForm can be repaired using the RepairAcroForm method of the reader.

func (*PdfReader) CheckAccessRights

func (r *PdfReader) CheckAccessRights(password []byte) (bool, security.Permissions, error)

CheckAccessRights checks access rights and permissions for a specified password. If either user/owner password is specified, full rights are granted, otherwise the access rights are specified by the Permissions flag.

The bool flag indicates that the user can access and view the file. The AccessPermissions shows what access the user has for editing etc. An error is returned if there was a problem performing the authentication.

func (*PdfReader) Decrypt

func (r *PdfReader) Decrypt(password []byte) (bool, error)

Decrypt decrypts the PDF file with a specified password. Also tries to decrypt with an empty password. Returns true if successful, false otherwise.

func (*PdfReader) FlattenFields

func (r *PdfReader) FlattenFields(allannots bool, appgen FieldAppearanceGenerator) error

FlattenFields flattens the form fields and annotations for the PDF loaded in `pdf` and makes non-editable. Looks up all widget annotations corresponding to form fields and flattens them by drawing the content through the content stream rather than annotations. References to flattened annotations will be removed from Page Annots array. For fields the AcroForm entry will be emptied. When `allannots` is true, all annotations will be flattened. Keep false if want to keep non-form related annotations intact. When `appgen` is not nil, it will be used to generate appearance streams for the field annotations.

func (*PdfReader) FlattenFieldsWithOpts

func (r *PdfReader) FlattenFieldsWithOpts(appgen FieldAppearanceGenerator, opts *FieldFlattenOpts) error

FlattenFieldsWithOpts flattens the AcroForm fields of the reader using the provided field appearance generator and the specified options. If no options are specified, all form fields are flattened. If a filter function is provided using the opts parameter, only the filtered fields are flattened. Otherwise, all form fields are flattened. At the end of the process, the AcroForm contains all the fields which were not flattened. If all fields are flattened, the reader's AcroForm field is set to nil.

func (*PdfReader) GetAttachedFiles

func (r *PdfReader) GetAttachedFiles() ([]*EmbeddedFile, error)

GetAttachedFiles retrieves all the attached files info and content.

func (*PdfReader) GetCatalogLanguage

func (r *PdfReader) GetCatalogLanguage() (core.PdfObject, bool)

GetCatalogLanguage gets catalog Language object.

func (*PdfReader) GetCatalogMarkInfo

func (r *PdfReader) GetCatalogMarkInfo() (core.PdfObject, bool)

GetCatalogMarkInfo gets catalog MarkInfo object.

func (*PdfReader) GetCatalogMetadata

func (r *PdfReader) GetCatalogMetadata() (core.PdfObject, bool)

GetCatalogMetadata gets the catalog defined XMP Metadata.

func (*PdfReader) GetCatalogStructTreeRoot

func (r *PdfReader) GetCatalogStructTreeRoot() (core.PdfObject, bool)

GetCatalogStructTreeRoot gets the catalog StructTreeRoot object.

func (*PdfReader) GetCatalogViewerPreferences

func (r *PdfReader) GetCatalogViewerPreferences() (core.PdfObject, bool)

GetCatalogViewerPreferences gets catalog ViewerPreferences object.

func (*PdfReader) GetEncryptionMethod

func (r *PdfReader) GetEncryptionMethod() string

GetEncryptionMethod returns a descriptive information string about the encryption method used.

func (*PdfReader) GetIndirectObjectByNumber

func (r *PdfReader) GetIndirectObjectByNumber(number int) (core.PdfObject, error)

GetIndirectObjectByNumber retrieves and returns a specific PdfObject by object number.

func (*PdfReader) GetNameDictionary

func (r *PdfReader) GetNameDictionary() (core.PdfObject, error)

GetNameDictionary returns the Names entry in the PDF catalog. See section 7.7.4 "Name Dictionary" (p. 80 PDF32000_2008).

func (*PdfReader) GetNamedDestinations

func (r *PdfReader) GetNamedDestinations() (core.PdfObject, error)

GetNamedDestinations returns the Dests entry in the PDF catalog. See section 12.3.2.3 "Named Destinations" (p. 367 PDF32000_2008).

func (*PdfReader) GetNumPages

func (r *PdfReader) GetNumPages() (int, error)

GetNumPages returns the number of pages in the document.

func (*PdfReader) GetOCProperties

func (r *PdfReader) GetOCProperties() (core.PdfObject, error)

GetOCProperties returns the optional content properties PdfObject.

func (*PdfReader) GetObjectNums

func (r *PdfReader) GetObjectNums() []int

GetObjectNums returns the object numbers of the PDF objects in the file Numbered objects are either indirect objects or stream objects. e.g. objNums := pdfReader.GetObjectNums() The underlying objects can then be accessed with pdfReader.GetIndirectObjectByNumber(objNums[0]) for the first available object.

func (*PdfReader) GetOutlineTree

func (r *PdfReader) GetOutlineTree() *PdfOutlineTreeNode

GetOutlineTree returns the outline tree.

func (*PdfReader) GetOutlines

func (r *PdfReader) GetOutlines() (*Outline, error)

GetOutlines returns a high-level Outline object, based on the outline tree of the reader.

func (*PdfReader) GetOutlinesFlattened

func (r *PdfReader) GetOutlinesFlattened() ([]*PdfOutlineTreeNode, []string, error)

GetOutlinesFlattened returns a flattened list of tree nodes and titles. NOTE: for most use cases, it is recommended to use the high-level GetOutlines method instead, which also provides information regarding the destination of the outline items.

func (*PdfReader) GetPage

func (r *PdfReader) GetPage(pageNumber int) (*PdfPage, error)

GetPage returns the PdfPage model for the specified page number.

func (*PdfReader) GetPageLabels

func (r *PdfReader) GetPageLabels() (core.PdfObject, error)

GetPageLabels returns the PageLabels entry in the PDF catalog. See section 12.4.2 "Page Labels" (p. 382 PDF32000_2008).

func (*PdfReader) GetPdfInfo

func (r *PdfReader) GetPdfInfo() (*PdfInfo, error)

GetPdfInfo returns the PDF info dictionary.

func (*PdfReader) GetPerms

func (r *PdfReader) GetPerms() *Permissions

GetPerms returns the Permissions dictionary

func (*PdfReader) GetPreviousRevision

func (r *PdfReader) GetPreviousRevision() (*PdfReader, error)

GetPreviousRevision returns the previous revision of PdfReader for the Pdf document

func (*PdfReader) GetRevision

func (r *PdfReader) GetRevision(revisionNumber int) (*PdfReader, error)

GetRevision returns the specific version of the PdfReader for the current Pdf document

func (*PdfReader) GetRevisionNumber

func (r *PdfReader) GetRevisionNumber() int

GetRevisionNumber returns the version of the current Pdf document

func (*PdfReader) GetTrailer

func (r *PdfReader) GetTrailer() (*core.PdfObjectDictionary, error)

GetTrailer returns the PDF's trailer dictionary.

func (*PdfReader) Inspect

func (r *PdfReader) Inspect() (map[string]int, error)

Inspect inspects the object types, subtypes and content in the PDF file returning a map of object type to number of instances of each.

func (*PdfReader) IsEncrypted

func (r *PdfReader) IsEncrypted() (bool, error)

IsEncrypted returns true if the PDF file is encrypted.

func (*PdfReader) PageFromIndirectObject

func (r *PdfReader) PageFromIndirectObject(ind *core.PdfIndirectObject) (*PdfPage, int, error)

PageFromIndirectObject returns the PdfPage and page number for a given indirect object.

func (*PdfReader) PdfVersion

func (r *PdfReader) PdfVersion() core.Version

PdfVersion returns version of the PDF file.

func (*PdfReader) RepairAcroForm

func (r *PdfReader) RepairAcroForm(opts *AcroFormRepairOptions) error

RepairAcroForm attempts to rebuild the AcroForm fields using the widget annotations present in the document pages. Pass nil for the opts parameter in order to use the default options. NOTE: Currently, the opts parameter is declared in order to enable adding future options, but passing nil will always result in the default options being used.

func (*PdfReader) ToWriter

func (r *PdfReader) ToWriter(opts *ReaderToWriterOpts) (*PdfWriter, error)

ToWriter creates a new writer from the current reader, based on the specified options. If no options are provided, all reader properties are copied to the writer.

func (*PdfReader) ValidateSignatures

func (r *PdfReader) ValidateSignatures(handlers []SignatureHandler) ([]SignatureValidationResult, error)

ValidateSignatures validates digital signatures in the document.

type PdfRectangle

PdfRectangle is a definition of a rectangle.

type PdfRectangle struct {
    Llx float64 // Lower left corner (ll).
    Lly float64
    Urx float64 // Upper right corner (ur).
    Ury float64
}

func NewPdfRectangle

func NewPdfRectangle(arr core.PdfObjectArray) (*PdfRectangle, error)

NewPdfRectangle creates a PDF rectangle object based on an input array of 4 integers. Defining the lower left (LL) and upper right (UR) corners with floating point numbers.

func (*PdfRectangle) Height

func (rect *PdfRectangle) Height() float64

Height returns the height of `rect`.

func (*PdfRectangle) Normalize

func (rect *PdfRectangle) Normalize()

Normalize swaps (Llx,Urx) if Urx < Llx, and (Lly,Ury) if Ury < Lly.

func (*PdfRectangle) ToPdfObject

func (rect *PdfRectangle) ToPdfObject() core.PdfObject

ToPdfObject converts rectangle to a PDF object.

func (*PdfRectangle) Transform

func (rect *PdfRectangle) Transform(transformMatrix transform.Matrix)

Transform rectangle with the supplied matrix.

func (*PdfRectangle) Width

func (rect *PdfRectangle) Width() float64

Width returns the width of `rect`.

type PdfShading

PdfShading represents a shading dictionary. There are 7 types of shading, indicatedby the shading type variable: 1: Function-based shading. 2: Axial shading. 3: Radial shading. 4: Free-form Gouraud-shaded triangle mesh. 5: Lattice-form Gouraud-shaded triangle mesh. 6: Coons patch mesh. 7: Tensor-product patch mesh. types 4-7 are contained in a stream object, where the dictionary is given by the stream dictionary.

type PdfShading struct {
    ShadingType *core.PdfObjectInteger
    ColorSpace  PdfColorspace
    Background  *core.PdfObjectArray
    BBox        *PdfRectangle
    AntiAlias   *core.PdfObjectBool
    // contains filtered or unexported fields
}

func (*PdfShading) GetContainingPdfObject

func (s *PdfShading) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the shading object (indirect object).

func (*PdfShading) GetContext

func (s *PdfShading) GetContext() PdfModel

GetContext returns a reference to the subshading entry as represented by PdfShadingType1-7.

func (*PdfShading) SetContext

func (s *PdfShading) SetContext(ctx PdfModel)

SetContext set the sub annotation (context).

func (*PdfShading) ToPdfObject

func (s *PdfShading) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingPattern

PdfShadingPattern is a Shading patterns that provide a smooth transition between colors across an area to be painted, i.e. color(x,y) = f(x,y) at each point. It is a type 2 pattern (PatternType = 2).

type PdfShadingPattern struct {
    *PdfPattern
    Shading   *PdfShading
    Matrix    *core.PdfObjectArray
    ExtGState core.PdfObject
}

func (*PdfShadingPattern) ToPdfObject

func (p *PdfShadingPattern) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading pattern.

type PdfShadingPatternType2

PdfShadingPatternType2 is shading patterns that will use a Type 2 shading pattern (Axial).

type PdfShadingPatternType2 struct {
    *PdfPattern
    Shading   *PdfShadingType2
    Matrix    *core.PdfObjectArray
    ExtGState core.PdfObject
}

func NewPdfShadingPatternType2

func NewPdfShadingPatternType2() *PdfShadingPatternType2

NewPdfShadingPatternType2 creates an empty shading pattern type 2 object.

func (*PdfShadingPatternType2) ToPdfObject

func (p *PdfShadingPatternType2) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading pattern.

type PdfShadingPatternType3

PdfShadingPatternType3 is shading patterns that will use a Type 3 shading pattern (Radial).

type PdfShadingPatternType3 struct {
    *PdfPattern
    Shading   *PdfShadingType3
    Matrix    *core.PdfObjectArray
    ExtGState core.PdfObject
}

func NewPdfShadingPatternType3

func NewPdfShadingPatternType3() *PdfShadingPatternType3

NewPdfShadingPatternType3 creates an empty shading pattern type 3 object.

func (*PdfShadingPatternType3) ToPdfObject

func (p *PdfShadingPatternType3) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading pattern.

type PdfShadingType1

PdfShadingType1 is a Function-based shading.

type PdfShadingType1 struct {
    *PdfShading
    Domain   *core.PdfObjectArray
    Matrix   *core.PdfObjectArray
    Function []PdfFunction
}

func (*PdfShadingType1) ToPdfObject

func (s *PdfShadingType1) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType2

PdfShadingType2 is an Axial shading.

type PdfShadingType2 struct {
    *PdfShading
    Coords   *core.PdfObjectArray
    Domain   *core.PdfObjectArray
    Function []PdfFunction
    Extend   *core.PdfObjectArray
}

func NewPdfShadingType2

func NewPdfShadingType2() *PdfShadingType2

NewPdfShadingType2 creates an empty shading type 2 dictionary.

func (*PdfShadingType2) ToPdfObject

func (s *PdfShadingType2) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType3

PdfShadingType3 is a Radial shading.

type PdfShadingType3 struct {
    *PdfShading
    Coords   *core.PdfObjectArray
    Domain   *core.PdfObjectArray
    Function []PdfFunction
    Extend   *core.PdfObjectArray
}

func NewPdfShadingType3

func NewPdfShadingType3() *PdfShadingType3

NewPdfShadingType3 creates an empty shading type 3 dictionary.

func (*PdfShadingType3) ToPdfObject

func (s *PdfShadingType3) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType4

PdfShadingType4 is a Free-form Gouraud-shaded triangle mesh.

type PdfShadingType4 struct {
    *PdfShading
    BitsPerCoordinate *core.PdfObjectInteger
    BitsPerComponent  *core.PdfObjectInteger
    BitsPerFlag       *core.PdfObjectInteger
    Decode            *core.PdfObjectArray
    Function          []PdfFunction
}

func (*PdfShadingType4) ToPdfObject

func (s *PdfShadingType4) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType5

PdfShadingType5 is a Lattice-form Gouraud-shaded triangle mesh.

type PdfShadingType5 struct {
    *PdfShading
    BitsPerCoordinate *core.PdfObjectInteger
    BitsPerComponent  *core.PdfObjectInteger
    VerticesPerRow    *core.PdfObjectInteger
    Decode            *core.PdfObjectArray
    Function          []PdfFunction
}

func (*PdfShadingType5) ToPdfObject

func (s *PdfShadingType5) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType6

PdfShadingType6 is a Coons patch mesh.

type PdfShadingType6 struct {
    *PdfShading
    BitsPerCoordinate *core.PdfObjectInteger
    BitsPerComponent  *core.PdfObjectInteger
    BitsPerFlag       *core.PdfObjectInteger
    Decode            *core.PdfObjectArray
    Function          []PdfFunction
}

func (*PdfShadingType6) ToPdfObject

func (s *PdfShadingType6) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType7

PdfShadingType7 is a Tensor-product patch mesh.

type PdfShadingType7 struct {
    *PdfShading
    BitsPerCoordinate *core.PdfObjectInteger
    BitsPerComponent  *core.PdfObjectInteger
    BitsPerFlag       *core.PdfObjectInteger
    Decode            *core.PdfObjectArray
    Function          []PdfFunction
}

func (*PdfShadingType7) ToPdfObject

func (s *PdfShadingType7) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfSignature

PdfSignature represents a PDF signature dictionary and is used for signing via form signature fields. (Section 12.8, Table 252 - Entries in a signature dictionary p. 475 in PDF32000_2008).

type PdfSignature struct {
    Handler SignatureHandler

    // Type: Sig/DocTimeStamp
    Type         *core.PdfObjectName
    Filter       *core.PdfObjectName
    SubFilter    *core.PdfObjectName
    Contents     *core.PdfObjectString
    Cert         core.PdfObject
    ByteRange    *core.PdfObjectArray
    Reference    *core.PdfObjectArray
    Changes      *core.PdfObjectArray
    Name         *core.PdfObjectString
    M            *core.PdfObjectString
    Location     *core.PdfObjectString
    Reason       *core.PdfObjectString
    ContactInfo  *core.PdfObjectString
    R            *core.PdfObjectInteger
    V            *core.PdfObjectInteger
    PropBuild    *core.PdfObjectDictionary
    PropAuthTime *core.PdfObjectInteger
    PropAuthType *core.PdfObjectName
    // contains filtered or unexported fields
}

func NewPdfSignature

func NewPdfSignature(handler SignatureHandler) *PdfSignature

NewPdfSignature creates a new PdfSignature object.

func (*PdfSignature) GetCerts

func (sig *PdfSignature) GetCerts() ([]*x509.Certificate, error)

GetCerts returns the signature certificate chain.

func (*PdfSignature) GetContainingPdfObject

func (sig *PdfSignature) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfSignature) GetDocMDPPermission

func (sig *PdfSignature) GetDocMDPPermission() (mdp.DocMDPPermission, bool)

GetDocMDPPermission returns the DocMDP level of the restrictions

func (*PdfSignature) Initialize

func (sig *PdfSignature) Initialize() error

Initialize initializes the PdfSignature.

func (*PdfSignature) SetDate

func (sig *PdfSignature) SetDate(date time.Time, format string)

SetDate sets the `M` field of the signature.

func (*PdfSignature) SetLocation

func (sig *PdfSignature) SetLocation(location string)

SetLocation sets the `Location` field of the signature.

func (*PdfSignature) SetName

func (sig *PdfSignature) SetName(name string)

SetName sets the `Name` field of the signature.

func (*PdfSignature) SetReason

func (sig *PdfSignature) SetReason(reason string)

SetReason sets the `Reason` field of the signature.

func (*PdfSignature) ToPdfObject

func (sig *PdfSignature) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfSignatureReference

PdfSignatureReference represents a PDF signature reference dictionary and is used for signing via form signature fields. (Section 12.8.1, Table 253 - Entries in a signature reference dictionary p. 469 in PDF32000_2008).

type PdfSignatureReference struct {
    Type            *core.PdfObjectName
    TransformMethod *core.PdfObjectName
    TransformParams core.PdfObject
    Data            core.PdfObject
    DigestMethod    *core.PdfObjectName
    // contains filtered or unexported fields
}

func NewPdfSignatureReferenceDocMDP

func NewPdfSignatureReferenceDocMDP(transformParams *PdfTransformParamsDocMDP) *PdfSignatureReference

NewPdfSignatureReferenceDocMDP returns PdfSignatureReference for the transformParams.

func (*PdfSignatureReference) GetContainingPdfObject

func (sigref *PdfSignatureReference) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfSignatureReference) ToPdfObject

func (sigref *PdfSignatureReference) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PdfTilingPattern

PdfTilingPattern is a Tiling pattern that consists of repetitions of a pattern cell with defined intervals. It is a type 1 pattern. (PatternType = 1). A tiling pattern is represented by a stream object, where the stream content is a content stream that describes the pattern cell.

type PdfTilingPattern struct {
    *PdfPattern
    PaintType  *core.PdfObjectInteger // Colored or uncolored tiling pattern.
    TilingType *core.PdfObjectInteger // Constant spacing, no distortion or constant spacing/faster tiling.
    BBox       *PdfRectangle
    XStep      *core.PdfObjectFloat
    YStep      *core.PdfObjectFloat
    Resources  *PdfPageResources
    Matrix     *core.PdfObjectArray // Pattern matrix (6 numbers).
}

func (*PdfTilingPattern) GetContentStream

func (p *PdfTilingPattern) GetContentStream() ([]byte, error)

GetContentStream returns the pattern cell's content stream

func (*PdfTilingPattern) GetContentStreamWithEncoder

func (p *PdfTilingPattern) GetContentStreamWithEncoder() ([]byte, core.StreamEncoder, error)

GetContentStreamWithEncoder returns the pattern cell's content stream and its encoder

func (*PdfTilingPattern) IsColored

func (p *PdfTilingPattern) IsColored() bool

IsColored specifies if the pattern is colored.

func (*PdfTilingPattern) SetContentStream

func (p *PdfTilingPattern) SetContentStream(content []byte, encoder core.StreamEncoder) error

SetContentStream sets the pattern cell's content stream.

func (*PdfTilingPattern) ToPdfObject

func (p *PdfTilingPattern) ToPdfObject() core.PdfObject

ToPdfObject returns the PDF representation of the tiling pattern.

type PdfTransformParamsDocMDP

PdfTransformParamsDocMDP represents a transform parameters dictionary for the DocMDP method and is used to detect modifications relative to a signature field that is signed by the author of a document. (Section 12.8.2.2, Table 254 - Entries in the DocMDP transform parameters dictionary p. 471 in PDF32000_2008).

type PdfTransformParamsDocMDP struct {
    Type *core.PdfObjectName
    P    *core.PdfObjectInteger
    V    *core.PdfObjectName
}

func NewPdfTransformParamsDocMDP

func NewPdfTransformParamsDocMDP(permission mdp.DocMDPPermission) *PdfTransformParamsDocMDP

NewPdfTransformParamsDocMDP create a PdfTransformParamsDocMDP with the specific permissions.

func (*PdfTransformParamsDocMDP) String

func (sig *PdfTransformParamsDocMDP) String() string

String returns a string representation of PdfTransformParamsDocMDP.

func (*PdfTransformParamsDocMDP) ToPdfObject

func (sig *PdfTransformParamsDocMDP) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

func (*PdfTransformParamsDocMDP) WriteString

func (sig *PdfTransformParamsDocMDP) WriteString() string

WriteString outputs the object as it is to be written to file.

type PdfWriter

PdfWriter handles outputing PDF content.

type PdfWriter struct {
    ObjNumOffset int
    // contains filtered or unexported fields
}

func NewPdfWriter

func NewPdfWriter() PdfWriter

NewPdfWriter initializes a new PdfWriter.

func (*PdfWriter) AddExtension

func (w *PdfWriter) AddExtension(extName, baseVersion string, extLevel int)

AddExtension adds the specified extension to the Extensions dictionary. See section 7.1.2 "Extensions Dictionary" (pp. 108-109 PDF32000_2008).

func (*PdfWriter) AddOutlineTree

func (w *PdfWriter) AddOutlineTree(outlineTree *PdfOutlineTreeNode)

AddOutlineTree adds outlines to a PDF file.

func (*PdfWriter) AddPage

func (w *PdfWriter) AddPage(page *PdfPage) error

AddPage adds a page to the PDF file. The new page should be an indirect object.

func (*PdfWriter) ApplyStandard

func (w *PdfWriter) ApplyStandard(optimizer StandardApplier)

ApplyStandard is used to apply changes required on the document to match the rules required by the input standard. The writer's content would be changed after all the document parts are already established during the Write method. A good example of the StandardApplier could be a PDF/A Profile (i.e.: pdfa.Profile1A). In such a case PdfWriter would set up all rules required by that Profile.

func (*PdfWriter) AttachFile

func (w *PdfWriter) AttachFile(file *EmbeddedFile) error

func (*PdfWriter) Encrypt

func (w *PdfWriter) Encrypt(userPass, ownerPass []byte, options *EncryptOptions) error

Encrypt encrypts the output file with a specified user/owner password.

func (*PdfWriter) GetOptimizer

func (w *PdfWriter) GetOptimizer() Optimizer

GetOptimizer returns current PDF optimizer.

func (*PdfWriter) GetPageIndirectObject

func (w *PdfWriter) GetPageIndirectObject(pageNum int) (*core.PdfIndirectObject, error)

GetPageIndirectObject returns the indirect object of page for the specified page number.

func (*PdfWriter) GetPdfVersion

func (w *PdfWriter) GetPdfVersion() string

GetPdfVersion gets the version of the PDF used within this document.

func (*PdfWriter) GetStandardApplier

func (w *PdfWriter) GetStandardApplier() StandardApplier

GetStandardApplier gets currently used StandardApplier..

func (*PdfWriter) GetVersion

func (w *PdfWriter) GetVersion() core.Version

GetVersion gets the document version.

func (*PdfWriter) SetCatalogLanguage

func (w *PdfWriter) SetCatalogLanguage(lang core.PdfObject) error

SetCatalogLanguage sets the catalog language.

func (*PdfWriter) SetCatalogMarkInfo

func (w *PdfWriter) SetCatalogMarkInfo(info core.PdfObject) error

SetCatalogMarkInfo sets the catalog MarkInfo dictionary.

func (*PdfWriter) SetCatalogMetadata

func (w *PdfWriter) SetCatalogMetadata(meta core.PdfObject) error

SetCatalogMetadata sets the catalog metadata (XMP) stream object.

func (*PdfWriter) SetCatalogStructTreeRoot

func (w *PdfWriter) SetCatalogStructTreeRoot(tree core.PdfObject) error

SetCatalogStructTreeRoot sets the catalog struct tree root object.

func (*PdfWriter) SetCatalogViewerPreferences

func (w *PdfWriter) SetCatalogViewerPreferences(pref core.PdfObject) error

SetCatalogViewerPreferences sets the catalog ViewerPreferences dictionary.

func (*PdfWriter) SetDocInfo

func (w *PdfWriter) SetDocInfo(info *PdfInfo)

SetDocInfo set document info. This will overwrite any globally declared document info.

func (*PdfWriter) SetFileName

func (w *PdfWriter) SetFileName(name string)

SetFileName sets the pdf writer file name for metered usage tracker.

func (*PdfWriter) SetForms

func (w *PdfWriter) SetForms(form *PdfAcroForm) error

SetForms sets the Acroform for a PDF file.

func (*PdfWriter) SetNameDictionary

func (w *PdfWriter) SetNameDictionary(names core.PdfObject) error

SetNameDictionary sets the Names entry in the PDF catalog. See section 7.7.4 "Name Dictionary" (p. 80 PDF32000_2008).

func (*PdfWriter) SetNamedDestinations

func (w *PdfWriter) SetNamedDestinations(dests core.PdfObject) error

SetNamedDestinations sets the Dests entry in the PDF catalog. See section 12.3.2.3 "Named Destinations" (p. 367 PDF32000_2008).

func (*PdfWriter) SetOCProperties

func (w *PdfWriter) SetOCProperties(ocProperties core.PdfObject) error

SetOCProperties sets the optional content properties.

func (*PdfWriter) SetOpenAction

func (w *PdfWriter) SetOpenAction(dest core.PdfObject) error

SetOpenAction sets the OpenAction in the PDF catalog. The value shall be either an array defining a destination (12.3.2 "Destinations" PDF32000_2008), or an action dictionary representing an action (12.6 "Actions" PDF32000_2008).

func (*PdfWriter) SetOptimizer

func (w *PdfWriter) SetOptimizer(optimizer Optimizer)

SetOptimizer sets the optimizer to optimize PDF before writing.

func (*PdfWriter) SetPageLabels

func (w *PdfWriter) SetPageLabels(pageLabels core.PdfObject) error

SetPageLabels sets the PageLabels entry in the PDF catalog. See section 12.4.2 "Page Labels" (p. 382 PDF32000_2008).

func (*PdfWriter) SetRotation

func (w *PdfWriter) SetRotation(rotate int64) error

SetRotation sets the rotation of all pages added to writer. The rotation is specified in degrees and must be a multiple of 90. The Rotate field of individual pages has priority over the global rotation.

func (*PdfWriter) SetVersion

func (w *PdfWriter) SetVersion(majorVersion, minorVersion int)

SetVersion sets the PDF version of the output file.

func (*PdfWriter) Write

func (w *PdfWriter) Write(writer io.Writer) error

Write writes out the PDF.

func (*PdfWriter) WriteToFile

func (w *PdfWriter) WriteToFile(outputFilePath string) error

WriteToFile writes the output PDF to file.

type Permissions

Permissions specify a permissions dictionary (PDF 1.5). (Section 12.8.4, Table 258 - Entries in a permissions dictionary p. 477 in PDF32000_2008).

type Permissions struct {
    DocMDP *PdfSignature
    // contains filtered or unexported fields
}

func NewPermissions

func NewPermissions(docMdp *PdfSignature) *Permissions

NewPermissions returns a new permissions object.

func (*Permissions) GetContainingPdfObject

func (p *Permissions) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*Permissions) ToPdfObject

func (p *Permissions) ToPdfObject() core.PdfObject

ToPdfObject implements interface PdfModel.

type PrintScaling

PrintScaling represents the page scaling option that shall be selected when a print dialog is displayed for this document.

type PrintScaling string

type ReaderOpts

ReaderOpts defines options for creating PdfReader instances.

type ReaderOpts struct {
    // Password password of the PDF file encryption.
    // Default: empty ("").
    Password string

    // LazyLoad set if the PDF file would be loaded using lazy-loading mode.
    // Default: true.
    LazyLoad bool

    // ComplianceMode set if parsed PDF file should contain meta information for the verifiers of the compliance standards like PDF/A.
    ComplianceMode bool
}

func NewReaderOpts

func NewReaderOpts() *ReaderOpts

NewReaderOpts generates a default `ReaderOpts` instance.

type ReaderToWriterOpts

ReaderToWriterOpts options used to generate a PdfWriter.

type ReaderToWriterOpts struct {
    SkipAcroForm          bool
    SkipInfo              bool
    SkipNameDictionary    bool
    SkipNamedDests        bool
    SkipOCProperties      bool
    SkipOutlines          bool
    SkipPageLabels        bool
    SkipRotation          bool
    SkipMetadata          bool
    SkipMarkInfo          bool
    SkipViewerPreferences bool
    SkipLanguage          bool

    PageProcessCallback PageProcessCallback

    // Deprecated: will be removed in v4. Use PageProcessCallback instead.
    PageCallback PageCallback
}

type SignatureHandler

SignatureHandler interface defines the common functionality for PDF signature handlers, which need to be capable of validating digital signatures and signing PDF documents.

type SignatureHandler interface {
    // IsApplicable checks if a given signature dictionary `sig` is applicable for the signature handler.
    // For example a signature of type `adbe.pkcs7.detached` might not fit for a rsa.sha1 handler.
    IsApplicable(sig *PdfSignature) bool

    // Validate validates a PDF signature against a given digest (hash) such as that determined
    // for an input file. Returns validation results.
    Validate(sig *PdfSignature, digest Hasher) (SignatureValidationResult, error)

    // InitSignature prepares the signature dictionary for signing. This involves setting all
    // necessary fields, and also allocating sufficient space to the Contents so that the
    // finalized signature can be inserted once the hash is calculated.
    InitSignature(sig *PdfSignature) error

    // NewDigest creates a new digest/hasher based on the signature dictionary and handler.
    NewDigest(sig *PdfSignature) (Hasher, error)

    // Sign receives the hash `digest` (for example hash of an input file), and signs based
    // on the signature dictionary `sig` and applies the signature data to the signature
    // dictionary Contents field.
    Sign(sig *PdfSignature, digest Hasher) error
}

type SignatureHandlerDocMDP

SignatureHandlerDocMDP extends SignatureHandler with the ValidateWithOpts method for checking the DocMDP policy.

type SignatureHandlerDocMDP interface {
    SignatureHandler
    // ValidateWithOpts validates a PDF signature by checking PdfReader or PdfParser
    // ValidateWithOpts shall contain Validate call
    ValidateWithOpts(sig *PdfSignature, digest Hasher, params SignatureHandlerDocMDPParams) (SignatureValidationResult, error)
}

type SignatureHandlerDocMDPParams

SignatureHandlerDocMDPParams describe the specific parameters for the SignatureHandlerEx These parameters describe how to check the difference between revisions. Revisions of the document get from the PdfParser.

type SignatureHandlerDocMDPParams struct {
    Parser     *core.PdfParser
    DiffPolicy mdp.DiffPolicy
}

type SignatureValidationResult

SignatureValidationResult defines the response from the signature validation handler.

type SignatureValidationResult struct {
    // List of errors when validating the signature.
    Errors      []string
    IsSigned    bool
    IsVerified  bool
    IsTrusted   bool
    Fields      []*PdfField
    Name        string
    Date        PdfDate
    Reason      string
    Location    string
    ContactInfo string
    DiffResults *mdp.DiffResults

    IsCrlFound  bool
    IsOcspFound bool

    // GeneralizedTime is the time at which the time-stamp token has been created by the TSA (RFC 3161).
    GeneralizedTime time.Time
}

func (SignatureValidationResult) String

func (v SignatureValidationResult) String() string

type StandardApplier

StandardApplier is the interface that performs optimization of the whole PDF document. As a result an input document is being changed by the optimizer. The writer than takes back all it's parts and overwrites it. NOTE: This implementation is in experimental development state.

Keep in mind that it might change in the subsequent minor versions.
type StandardApplier interface {
    ApplyStandard(document *docutil.Document) error
}

type StandardImplementer

StandardImplementer is an interface that defines specified PDF standards like PDF/A-1A (pdfa.Profile1A) NOTE: This implementation is in experimental development state.

Keep in mind that it might change in the subsequent minor versions.
type StandardImplementer interface {
    StandardValidator
    StandardApplier
    // StandardName gets the human-readable name of the standard.
    StandardName() string
}

type StandardValidator

StandardValidator is the interface that is used for the PDF StandardImplementer validation for the PDF document. It is using a CompliancePdfReader which is expected to give more Metadata during reading process. NOTE: This implementation is in experimental development state.

Keep in mind that it might change in the subsequent minor versions.
type StandardValidator interface {
    // ValidateStandard checks if the input reader
    ValidateStandard(dr *CompliancePdfReader) error
}

type StdFontName

StdFontName represents name of a standard font.

type StdFontName = fonts.StdFontName

type StructTreeRoot

StructTreeRoot represents the structure tree root dictionary. Reference: PDF documentation chapter 14.7 Logical Structure, table 322.

type StructTreeRoot struct {
    K                 []*KDict
    IDTree            *IDTree
    ParentTree        *core.PdfObjectDictionary
    ParentTreeNextKey int64
    RoleMap           core.PdfObject
    ClassMap          *core.PdfObjectDictionary
    // contains filtered or unexported fields
}

func NewStructTreeRoot

func NewStructTreeRoot() *StructTreeRoot

NewStructTreeRoot creates a new structure tree root dictionary.

func NewStructTreeRootFromPdfObject

func NewStructTreeRootFromPdfObject(obj core.PdfObject) (*StructTreeRoot, error)

NewStructTreeRootFromPdfObject creates a new structure tree root from a PDF object.

func (*StructTreeRoot) AddKDict

func (s *StructTreeRoot) AddKDict(k *KDict)

AddKDict adds a K dictionary object to the structure tree root.

func (*StructTreeRoot) ToPdfObject

func (s *StructTreeRoot) ToPdfObject() core.PdfObject

ToPdfObject converts the structure tree root to a PDF object.

type TabOrderType

Tab order types.

type TabOrderType string
var (
    // TabOrderRow specifies that the tabs are ordered in a row.
    TabOrderRow TabOrderType = "R"

    // TabOrderColumn specifies that the tabs are ordered in a column.
    TabOrderColumn TabOrderType = "C"

    // TabOrderStructure specifies that the tabs are ordered in a structure.
    TabOrderStructure TabOrderType = "S"
)

type VRI

VRI represents a Validation-Related Information dictionary. The VRI dictionary contains validation data in the form of certificates, OCSP and CRL information, for a single signature. See ETSI TS 102 778-4 V1.1.1 for more information.

type VRI struct {
    Cert []*core.PdfObjectStream
    OCSP []*core.PdfObjectStream
    CRL  []*core.PdfObjectStream
    TU   *core.PdfObjectString
    TS   *core.PdfObjectString
}

func (*VRI) ToPdfObject

func (v *VRI) ToPdfObject() *core.PdfObjectDictionary

ToPdfObject returns the PDF representation of the VRI dictionary.

type VariableText

VariableText contains the common attributes of a variable text. The VariableText is typically not used directly, but is can encapsulate by PdfField See section 12.7.3.3 "Variable Text" and Table 222 (pp. 434-436 PDF32000_2008).

type VariableText struct {
    DA *core.PdfObjectString
    Q  *core.PdfObjectInteger
    DS *core.PdfObjectString
    RV core.PdfObject
}

type ViewerPreferences

ViewerPreferences represents the viewer preferences of a PDF document.

type ViewerPreferences struct {
    // contains filtered or unexported fields
}

func NewViewerPreferences

func NewViewerPreferences() *ViewerPreferences

NewViewerPreferences returns a new ViewerPreferences object with default empty values.

func NewViewerPreferencesFromPdfObject

func NewViewerPreferencesFromPdfObject(obj core.PdfObject) (*ViewerPreferences, error)

func (*ViewerPreferences) Direction

func (vp *ViewerPreferences) Direction() Direction

Direction returns the value of the direction.

func (*ViewerPreferences) Duplex

func (vp *ViewerPreferences) Duplex() Duplex

Duplex returns the value of the duplex.

func (*ViewerPreferences) IsCenterWindow

func (vp *ViewerPreferences) IsCenterWindow() bool

IsCenterWindow returns the value of the centerWindow flag.

func (*ViewerPreferences) IsDisplayDocTitle

func (vp *ViewerPreferences) IsDisplayDocTitle() bool

IsDisplayDocTitle returns the value of the displayDocTitle flag.

func (*ViewerPreferences) IsFitWindow

func (vp *ViewerPreferences) IsFitWindow() bool

IsFitWindow returns the value of the fitWindow flag.

func (*ViewerPreferences) IsHideMenubar

func (vp *ViewerPreferences) IsHideMenubar() bool

IsHideMenubar returns the value of the hideMenubar flag.

func (*ViewerPreferences) IsHideToolbar

func (vp *ViewerPreferences) IsHideToolbar() bool

IsHideToolbar returns the value of the hideToolbar flag.

func (*ViewerPreferences) IsHideWindowUI

func (vp *ViewerPreferences) IsHideWindowUI() bool

IsHideWindowUI returns the value of the hideWindowUI flag.

func (*ViewerPreferences) NonFullScreenPageMode

func (vp *ViewerPreferences) NonFullScreenPageMode() NonFullScreenPageMode

NonFullScreenPageMode returns the value of the nonFullScreenPageMode.

func (*ViewerPreferences) NumCopies

func (vp *ViewerPreferences) NumCopies() int

NumCopies returns the value of the numCopies.

func (*ViewerPreferences) PickTrayByPDFSize

func (vp *ViewerPreferences) PickTrayByPDFSize() bool

PickTrayByPDFSize returns the value of the pickTrayByPDFSize flag.

func (*ViewerPreferences) PrintArea

func (vp *ViewerPreferences) PrintArea() PageBoundary

PrintArea returns the value of the printArea.

func (*ViewerPreferences) PrintClip

func (vp *ViewerPreferences) PrintClip() PageBoundary

PrintClip returns the value of the printClip.

func (*ViewerPreferences) PrintPageRange

func (vp *ViewerPreferences) PrintPageRange() []int

PrintPageRange returns the value of the printPageRange.

func (*ViewerPreferences) PrintScaling

func (vp *ViewerPreferences) PrintScaling() PrintScaling

PrintScaling returns the value of the printScaling.

func (*ViewerPreferences) SetCenterWindow

func (vp *ViewerPreferences) SetCenterWindow(centerWindow bool)

SetCenterWindow sets the value of the centerWindow flag.

func (*ViewerPreferences) SetDirection

func (vp *ViewerPreferences) SetDirection(direction Direction)

SetDirection sets the value of the direction.

func (*ViewerPreferences) SetDisplayDocTitle

func (vp *ViewerPreferences) SetDisplayDocTitle(displayDocTitle bool)

SetDisplayDocTitle sets the value of the displayDocTitle flag.

func (*ViewerPreferences) SetDuplex

func (vp *ViewerPreferences) SetDuplex(duplex Duplex)

SetDuplex sets the value of the duplex.

func (*ViewerPreferences) SetFitWindow

func (vp *ViewerPreferences) SetFitWindow(fitWindow bool)

SetFitWindow sets the value of the fitWindow flag.

func (*ViewerPreferences) SetHideMenubar

func (vp *ViewerPreferences) SetHideMenubar(hideMenubar bool)

SetHideMenubar sets the value of the hideMenubar flag.

func (*ViewerPreferences) SetHideToolbar

func (vp *ViewerPreferences) SetHideToolbar(hideToolbar bool)

SetHideToolbar sets the value of the hideToolbar flag.

func (*ViewerPreferences) SetHideWindowUI

func (vp *ViewerPreferences) SetHideWindowUI(hideWindowUI bool)

SetHideWindowUI sets the value of the hideWindowUI flag.

func (*ViewerPreferences) SetNonFullScreenPageMode

func (vp *ViewerPreferences) SetNonFullScreenPageMode(nonFullScreenPageMode NonFullScreenPageMode)

SetNonFullScreenPageMode sets the value of the nonFullScreenPageMode.

func (*ViewerPreferences) SetNumCopies

func (vp *ViewerPreferences) SetNumCopies(numCopies int)

SetNumCopies sets the value of the numCopies.

func (*ViewerPreferences) SetPickTrayByPDFSize

func (vp *ViewerPreferences) SetPickTrayByPDFSize(pickTrayByPDFSize bool)

SetPickTrayByPDFSize sets the value of the pickTrayByPDFSize flag.

func (*ViewerPreferences) SetPrintArea

func (vp *ViewerPreferences) SetPrintArea(printArea PageBoundary)

SetPrintArea sets the value of the printArea.

func (*ViewerPreferences) SetPrintClip

func (vp *ViewerPreferences) SetPrintClip(printClip PageBoundary)

SetPrintClip sets the value of the printClip.

func (*ViewerPreferences) SetPrintPageRange

func (vp *ViewerPreferences) SetPrintPageRange(printPageRange []int)

SetPrintPageRange sets the value of the printPageRange.

func (*ViewerPreferences) SetPrintScaling

func (vp *ViewerPreferences) SetPrintScaling(printScaling PrintScaling)

SetPrintScaling sets the value of the printScaling.

func (*ViewerPreferences) SetViewArea

func (vp *ViewerPreferences) SetViewArea(viewArea PageBoundary)

SetViewArea sets the value of the viewArea.

func (*ViewerPreferences) SetViewClip

func (vp *ViewerPreferences) SetViewClip(viewClip PageBoundary)

SetViewClip sets the value of the viewClip.

func (*ViewerPreferences) ToPdfObject

func (vp *ViewerPreferences) ToPdfObject() core.PdfObject

ToPdfObject returns a PDF object representation of the ViewerPreferences.

func (*ViewerPreferences) ViewArea

func (vp *ViewerPreferences) ViewArea() PageBoundary

ViewArea returns the value of the viewArea.

func (*ViewerPreferences) ViewClip

func (vp *ViewerPreferences) ViewClip() PageBoundary

ViewClip returns the value of the viewClip.

type WatermarkImageOptions

WatermarkImageOptions contains options for configuring the watermark process.

type WatermarkImageOptions struct {
    Alpha               float64
    FitToWidth          bool
    PreserveAspectRatio bool
}

type XObjectForm

XObjectForm (Table 95 in 8.10.2).

type XObjectForm struct {
    Filter core.StreamEncoder

    FormType      core.PdfObject
    BBox          core.PdfObject
    Matrix        core.PdfObject
    Resources     *PdfPageResources
    Group         core.PdfObject
    Ref           core.PdfObject
    MetaData      core.PdfObject
    PieceInfo     core.PdfObject
    LastModified  core.PdfObject
    StructParent  core.PdfObject
    StructParents core.PdfObject
    OPI           core.PdfObject
    OC            core.PdfObject
    Name          core.PdfObject

    // Stream data.
    Stream []byte
    // contains filtered or unexported fields
}

func NewXObjectForm

func NewXObjectForm() *XObjectForm

NewXObjectForm creates a brand new XObject Form. Creates a new underlying PDF object stream primitive.

func NewXObjectFormFromStream

func NewXObjectFormFromStream(stream *core.PdfObjectStream) (*XObjectForm, error)

NewXObjectFormFromStream builds the Form XObject from a stream object. TODO: Should this be exposed? Consider different access points.

func (*XObjectForm) GetContainingPdfObject

func (xform *XObjectForm) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the XObject Form's containing object (indirect object).

func (*XObjectForm) GetContentStream

func (xform *XObjectForm) GetContentStream() ([]byte, error)

GetContentStream returns the XObject Form's content stream.

func (*XObjectForm) SetContentStream

func (xform *XObjectForm) SetContentStream(content []byte, encoder core.StreamEncoder) error

SetContentStream updates the content stream with specified encoding. If encoding is null, will use the xform.Filter object or Raw encoding if not set.

func (*XObjectForm) ToPdfObject

func (xform *XObjectForm) ToPdfObject() core.PdfObject

ToPdfObject returns a stream object.

type XObjectImage

XObjectImage (Table 89 in 8.9.5.1). Implements PdfModel interface.

type XObjectImage struct {
    //ColorSpace       PdfObject
    Width            *int64
    Height           *int64
    ColorSpace       PdfColorspace
    BitsPerComponent *int64
    Filter           core.StreamEncoder

    Intent       core.PdfObject
    ImageMask    core.PdfObject
    Mask         core.PdfObject
    Matte        core.PdfObject
    Decode       core.PdfObject
    Interpolate  core.PdfObject
    Alternatives core.PdfObject
    SMask        core.PdfObject
    SMaskInData  core.PdfObject
    Name         core.PdfObject // Obsolete. Currently read if available and write if available. Not setting on new created files.
    StructParent core.PdfObject
    ID           core.PdfObject
    OPI          core.PdfObject
    Metadata     core.PdfObject
    OC           core.PdfObject
    Stream       []byte
    // contains filtered or unexported fields
}

func NewXObjectImage

func NewXObjectImage() *XObjectImage

NewXObjectImage returns a new XObjectImage.

func NewXObjectImageFromImage

func NewXObjectImageFromImage(img *Image, cs PdfColorspace, encoder core.StreamEncoder) (*XObjectImage, error)

NewXObjectImageFromImage creates a new XObject Image from an image object with default options. If encoder is nil, uses raw encoding (none).

func NewXObjectImageFromImageLazy

func NewXObjectImageFromImageLazy(img *Image, cs PdfColorspace, encoder core.StreamEncoder, lazy bool) (*XObjectImage, error)

NewXObjectImageFromImageLazy creates a new XObject Image from an image object with default options. If encoder is nil, uses raw encoding (none). If lazy is true, then lazy mode is enabled for XObject. Lazy mode allows to reduce memory usage with the help of temporary files.

func NewXObjectImageFromStream

func NewXObjectImageFromStream(stream *core.PdfObjectStream) (*XObjectImage, error)

NewXObjectImageFromStream builds the image xobject from a stream object. An image dictionary is the dictionary portion of a stream object representing an image XObject.

func UpdateXObjectImageFromImage

func UpdateXObjectImageFromImage(xobjIn *XObjectImage, img *Image, cs PdfColorspace,
    encoder core.StreamEncoder) (*XObjectImage, error)

UpdateXObjectImageFromImage creates a new XObject Image from an Image object `img` and default masks from xobjIn. The default masks are overridden if img.hasAlpha If `encoder` is nil, uses raw encoding (none).

func (*XObjectImage) GetContainingPdfObject

func (ximg *XObjectImage) GetContainingPdfObject() core.PdfObject

GetContainingPdfObject returns the container of the image object (indirect object).

func (*XObjectImage) SetFilter

func (ximg *XObjectImage) SetFilter(encoder core.StreamEncoder) error

SetFilter sets compression filter. Decodes with current filter sets and encodes the data with the new filter.

func (*XObjectImage) SetImage

func (ximg *XObjectImage) SetImage(img *Image, cs PdfColorspace) error

SetImage updates XObject Image with new image data.

func (*XObjectImage) ToImage

func (ximg *XObjectImage) ToImage() (*Image, error)

ToImage converts an object to an Image which can be transformed or saved out. The image data is decoded and the Image returned.

func (*XObjectImage) ToPdfObject

func (ximg *XObjectImage) ToPdfObject() core.PdfObject

ToPdfObject returns a stream object.

type XObjectType

XObjectType represents the type of an XObject.

type XObjectType int

XObject types.

const (
    XObjectTypeUndefined XObjectType = iota
    XObjectTypeImage
    XObjectTypeForm
    XObjectTypePS
    XObjectTypeUnknown
)

Subdirectories

Name Synopsis
..
mdp
optimize
tests Package tests provides integration tests for the UniPDF optimizer.
pdfa Package pdfa provides abstraction to optimize and verify documents with respect to the PDF/A standards.
sighandler Package sighandler implements digital signature handlers for PDF signature validation and signing.
sigutil
xmputil Package xmputil provides abstraction used by the pdf document XMP Metadata.
pdfaextension
pdfaid