model

package
v3.0.0-...-55e877b Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: GPL-2.0 Imports: 47 Imported by: 0

Documentation

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

View Source
const (
	RC4_128bit = EncryptionAlgorithm(iota)
	AES_128bit
	AES_256bit
)

Variables

View Source
var (
	ErrRequiredAttributeMissing = _ff.New("\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0064\u0020\u0061\u0074t\u0072\u0069\u0062\u0075\u0074\u0065\u0020\u006d\u0069\u0073s\u0069\u006e\u0067")
	ErrInvalidAttribute         = _ff.New("\u0069\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u0061\u0074\u0074\u0072i\u0062\u0075\u0074\u0065")
	ErrTypeCheck                = _ff.New("\u0074\u0079\u0070\u0065\u0020\u0063\u0068\u0065\u0063\u006b")

	ErrEncrypted              = _ff.New("\u0066\u0069\u006c\u0065\u0020\u006e\u0065\u0065\u0064\u0073\u0020\u0074\u006f\u0020\u0062e\u0020d\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0066\u0069\u0072\u0073\u0074")
	ErrNoFont                 = _ff.New("\u0066\u006fn\u0074\u0020\u006eo\u0074\u0020\u0064\u0065\u0066\u0069\u006e\u0065\u0064")
	ErrFontNotSupported       = _feg.Errorf("u\u006e\u0073\u0075\u0070po\u0072t\u0065\u0064\u0020\u0066\u006fn\u0074\u0020\u0028\u0025\u0077\u0029", _daa.ErrNotSupported)
	ErrType1CFontNotSupported = _feg.Errorf("\u0054y\u0070\u00651\u0043\u0020\u0066o\u006e\u0074\u0073\u0020\u0061\u0072\u0065 \u006e\u006f\u0074\u0020\u0063\u0075r\u0072\u0065\u006e\u0074\u006c\u0079\u0020\u0073\u0075\u0070\u0070o\u0072\u0074\u0065\u0064\u0020\u0028\u0025\u0077\u0029", _daa.ErrNotSupported)
	ErrType3FontNotSupported  = _feg.Errorf("\u0054y\u0070\u00653\u0020\u0066\u006f\u006et\u0073\u0020\u0061r\u0065\u0020\u006e\u006f\u0074\u0020\u0063\u0075\u0072re\u006e\u0074\u006cy\u0020\u0073u\u0070\u0070\u006f\u0072\u0074\u0065d\u0020\u0028%\u0077\u0029", _daa.ErrNotSupported)
	ErrTTCmapNotSupported     = _feg.Errorf("\u0075\u006es\u0075\u0070\u0070\u006fr\u0074\u0065d\u0020\u0054\u0072\u0075\u0065\u0054\u0079\u0070e\u0020\u0063\u006d\u0061\u0070\u0020\u0066\u006f\u0072\u006d\u0061\u0074 \u0028\u0025\u0077\u0029", _daa.ErrNotSupported)
	ErrSignNotEnoughSpace     = _feg.Errorf("\u0069\u006e\u0073\u0075\u0066\u0066\u0069c\u0069\u0065\u006et\u0020\u0073\u0070a\u0063\u0065 \u0061\u006c\u006c\u006f\u0063\u0061t\u0065d \u0066\u006f\u0072\u0020\u0074\u0068\u0065\u0020\u0073\u0069\u0067\u006e\u0061\u0074\u0075\u0072\u0065\u0020\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u0073")
	ErrSignNoCertificates     = _feg.Errorf("\u0063\u006ful\u0064\u0020\u006eo\u0074\u0020\u0072\u0065tri\u0065ve\u0020\u0063\u0065\u0072\u0074\u0069\u0066ic\u0061\u0074\u0065\u0020\u0063\u0068\u0061i\u006e")
)
View Source
var (
	CourierName              = _ec.CourierName
	CourierBoldName          = _ec.CourierBoldName
	CourierObliqueName       = _ec.CourierObliqueName
	CourierBoldObliqueName   = _ec.CourierBoldObliqueName
	HelveticaName            = _ec.HelveticaName
	HelveticaBoldName        = _ec.HelveticaBoldName
	HelveticaObliqueName     = _ec.HelveticaObliqueName
	HelveticaBoldObliqueName = _ec.HelveticaBoldObliqueName
	SymbolName               = _ec.SymbolName
	ZapfDingbatsName         = _ec.ZapfDingbatsName
	TimesRomanName           = _ec.TimesRomanName
	TimesBoldName            = _ec.TimesBoldName
	TimesItalicName          = _ec.TimesItalicName
	TimesBoldItalicName      = _ec.TimesBoldItalicName
)
View Source
var ErrColorOutOfRange = _ff.New("\u0063o\u006co\u0072\u0020\u006f\u0075\u0074 \u006f\u0066 \u0072\u0061\u006e\u0067\u0065")

Functions

func DetermineColorspaceNameFromPdfObject

func DetermineColorspaceNameFromPdfObject(obj _daa.PdfObject) (_daa.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 _d.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 _d.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.

Types

type AcroFormRepairOptions

type AcroFormRepairOptions struct{}

AcroFormRepairOptions contains options for rebuilding the AcroForm.

type AlphaMapFunc

type AlphaMapFunc func(_gcgac byte) byte

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 AnnotFilterFunc

type AnnotFilterFunc func(*PdfAnnotation) bool

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

type BorderEffect

type BorderEffect int

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

const (
	BorderEffectNoEffect BorderEffect = iota
	BorderEffectCloudy   BorderEffect = iota
)

type BorderStyle

type BorderStyle int

BorderStyle defines border type, typically used for annotations.

const (
	BorderStyleSolid     BorderStyle = iota
	BorderStyleDashed    BorderStyle = iota
	BorderStyleBeveled   BorderStyle = iota
	BorderStyleInset     BorderStyle = iota
	BorderStyleUnderline BorderStyle = iota
)

func (*BorderStyle) GetPdfName

func (_ecgg *BorderStyle) GetPdfName() string

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

type ButtonType

type ButtonType int

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

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

type CharMetrics

type CharMetrics = _ec.CharMetrics

CharMetrics represents width and height metrics of a glyph.

type CompliancePdfReader

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

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.

func NewCompliancePdfReader

func NewCompliancePdfReader(rs _dgg.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 (_gbcbg *CompliancePdfReader) ParserMetadata() _daa.ParserMetadata

ParserMetadata gets the parser metadata.

type ContentStreamWrapper

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

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

type DSS

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

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.

func NewDSS

func NewDSS() *DSS

NewDSS returns a new DSS dictionary.

func (*DSS) GetContainingPdfObject

func (_caffc *DSS) GetContainingPdfObject() _daa.PdfObject

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

func (*DSS) ToPdfObject

func (_ccfc *DSS) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the DSS dictionary.

type DefaultImageHandler

type DefaultImageHandler struct{}

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

func (DefaultImageHandler) Compress

func (_cbgc 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 (_fgbc DefaultImageHandler) NewGrayImageFromGoImage(goimg _baa.Image) (*Image, error)

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

func (DefaultImageHandler) NewImageFromGoImage

func (_agfda DefaultImageHandler) NewImageFromGoImage(goimg _baa.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 (_fgde DefaultImageHandler) Read(reader _dgg.Reader) (*Image, error)

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

type EncryptOptions

type EncryptOptions struct {
	Permissions _eef.Permissions
	Algorithm   EncryptionAlgorithm
}

EncryptOptions represents encryption options for an output PDF.

type EncryptionAlgorithm

type EncryptionAlgorithm int

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

type FieldAppearanceGenerator

type FieldAppearanceGenerator interface {
	ContentStreamWrapper
	GenerateAppearanceDict(_fddae *PdfAcroForm, _eefe *PdfField, _gacef *PdfAnnotationWidget) (*_daa.PdfObjectDictionary, error)
}

FieldAppearanceGenerator generates appearance stream for a given field.

type FieldFilterFunc

type FieldFilterFunc func(*PdfField) bool

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

type FieldFlag

type FieldFlag uint32

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

const (
	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 (_fabc FieldFlag) Clear(fl FieldFlag) FieldFlag

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

func (FieldFlag) Has

func (_dgfa 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 (_ecgb FieldFlag) Mask() uint32

Mask returns the uin32 bitmask for the specific flag.

func (FieldFlag) Set

func (_febd FieldFlag) Set(fl FieldFlag) FieldFlag

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

func (FieldFlag) String

func (_geaf FieldFlag) String() string

String returns a string representation of what flags are set.

type FieldFlattenOpts

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
}

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

type FieldImageProvider

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

FieldImageProvider provides fields images for specified fields.

type FieldValueProvider

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

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

type Hasher

type Hasher interface {
	Write(_daegf []byte) (_eebeg int, _eccbg error)
}

Hasher is the interface that wraps the basic Write method.

type Image

type Image struct {
	Width            int64
	Height           int64
	BitsPerComponent int64
	ColorComponents  int
	Data             []byte
	// contains filtered or unexported fields
}

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.

func (*Image) AlphaMap

func (_aagdc *Image) AlphaMap(mapFunc AlphaMapFunc)

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

func (*Image) ColorAt

func (_cabaa *Image) ColorAt(x, y int) (_dg.Color, error)

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

func (*Image) ConvertToBinary

func (_ggaaf *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 (_ebedb *Image) GetParamsDict() *_daa.PdfObjectDictionary

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

func (*Image) GetSamples

func (_ecfdd *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 (_ddcea *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 (_acged *Image) SetAlpha(alpha []byte)

SetAlpha sets the alpha layer for the image.

func (*Image) SetDecode

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

SetDecode sets the decode image float slice.

func (*Image) SetSamples

func (_aagb *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 (_afdgf *Image) ToGoImage() (_baa.Image, error)

ToGoImage converts the unidoc Image to a golang Image structure.

func (*Image) ToJBIG2Image

func (_cafdd *Image) ToJBIG2Image() (*_daa.JBIG2Image, error)

ToJBIG2Image converts current image to the core.JBIG2Image.

type ImageHandler

type ImageHandler interface {

	// Read any image type and load into a new Image object.
	Read(_aacb _dgg.Reader) (*Image, error)

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

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

	// Compress an image.
	Compress(_facga *Image, _dgddg int64) (*Image, error)
}

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.

var ImageHandling ImageHandler = DefaultImageHandler{}

type LTV

type LTV struct {

	// CertClient is the client used to retrieve certificates.
	CertClient *_cde.CertClient

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

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

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

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.

func NewLTV

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

NewLTV returns a new LTV client.

func (*LTV) Enable

func (_gaegc *LTV) Enable(sig *PdfSignature, extraCerts []*_e.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 (_fddad *LTV) EnableAll(extraCerts []*_e.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 (_dacac *LTV) EnableByName(name string, extraCerts []*_e.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 (_acfgb *LTV) EnableChain(chain []*_e.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 Optimizer

type Optimizer interface {
	Optimize(_bcgc []_daa.PdfObject) ([]_daa.PdfObject, error)
}

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 Outline

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

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

func NewOutline

func NewOutline() *Outline

NewOutline returns a new outline instance.

func (*Outline) Add

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

Add appends a top level outline item to the outline.

func (*Outline) Insert

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

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

func (*Outline) Items

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

Items returns all children outline items.

func (*Outline) ToOutlineTree

func (_geggg *Outline) ToOutlineTree() *PdfOutlineTreeNode

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

func (*Outline) ToPdfObject

func (_abfb *Outline) ToPdfObject() _daa.PdfObject

ToPdfObject returns a PDF object representation of the outline.

func (*Outline) ToPdfOutline

func (_fded *Outline) ToPdfOutline() *PdfOutline

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

type OutlineDest

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

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

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 (_ggeg OutlineDest) ToPdfObject() _daa.PdfObject

ToPdfObject returns a PDF object representation of the outline destination.

type OutlineItem

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

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

func NewOutlineItem

func NewOutlineItem(title string, dest OutlineDest) *OutlineItem

NewOutlineItem returns a new outline item instance.

func (*OutlineItem) Add

func (_gaeb *OutlineItem) Add(item *OutlineItem)

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

func (*OutlineItem) Insert

func (_gcca *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 (_ggaga *OutlineItem) Items() []*OutlineItem

Items returns all children outline items.

func (*OutlineItem) ToPdfObject

func (_eedbg *OutlineItem) ToPdfObject() _daa.PdfObject

ToPdfObject returns a PDF object representation of the outline item.

func (*OutlineItem) ToPdfOutlineItem

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

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

type PageCallback deprecated

type PageCallback func(_dfegg int, _dcfbe *PdfPage)

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 PageProcessCallback

type PageProcessCallback func(_abgfc int, _bebcg *PdfPage) error

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 PdfAcroForm

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

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

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

func NewPdfAcroForm

func NewPdfAcroForm() *PdfAcroForm

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

func (*PdfAcroForm) AllFields

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

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

func (*PdfAcroForm) Fill

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

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

func (*PdfAcroForm) FillWithAppearance

func (_bgdb *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 (_ggcbf *PdfAcroForm) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfAcroForm) ToPdfObject

func (_bfef *PdfAcroForm) ToPdfObject() _daa.PdfObject

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

type PdfAction

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

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

func NewPdfAction

func NewPdfAction() *PdfAction

NewPdfAction returns an initialized generic PDF action model.

func (*PdfAction) GetContainingPdfObject

func (_cae *PdfAction) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfAction) GetContext

func (_fcg *PdfAction) GetContext() PdfModel

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

func (*PdfAction) SetContext

func (_bb *PdfAction) SetContext(ctx PdfModel)

SetContext sets the sub action (context).

func (*PdfAction) String

func (_fcb *PdfAction) String() string

String implements interface PdfObject.

func (*PdfAction) ToPdfObject

func (_aca *PdfAction) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoTo

type PdfActionGoTo struct {
	*PdfAction
	D _daa.PdfObject
}

PdfActionGoTo represents a GoTo action.

func NewPdfActionGoTo

func NewPdfActionGoTo() *PdfActionGoTo

NewPdfActionGoTo returns a new "go to" action.

func (*PdfActionGoTo) ToPdfObject

func (_bbf *PdfActionGoTo) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoTo3DView

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

PdfActionGoTo3DView represents a GoTo3DView action.

func NewPdfActionGoTo3DView

func NewPdfActionGoTo3DView() *PdfActionGoTo3DView

NewPdfActionGoTo3DView returns a new "goTo3DView" action.

func (*PdfActionGoTo3DView) ToPdfObject

func (_accc *PdfActionGoTo3DView) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoToE

type PdfActionGoToE struct {
	*PdfAction
	F         *PdfFilespec
	D         _daa.PdfObject
	NewWindow _daa.PdfObject
	T         _daa.PdfObject
}

PdfActionGoToE represents a GoToE action.

func NewPdfActionGoToE

func NewPdfActionGoToE() *PdfActionGoToE

NewPdfActionGoToE returns a new "go to embedded" action.

func (*PdfActionGoToE) ToPdfObject

func (_ebe *PdfActionGoToE) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionGoToR

type PdfActionGoToR struct {
	*PdfAction
	F         *PdfFilespec
	D         _daa.PdfObject
	NewWindow _daa.PdfObject
}

PdfActionGoToR represents a GoToR action.

func NewPdfActionGoToR

func NewPdfActionGoToR() *PdfActionGoToR

NewPdfActionGoToR returns a new "go to remote" action.

func (*PdfActionGoToR) ToPdfObject

func (_efd *PdfActionGoToR) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionHide

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

PdfActionHide represents a hide action.

func NewPdfActionHide

func NewPdfActionHide() *PdfActionHide

NewPdfActionHide returns a new "hide" action.

func (*PdfActionHide) ToPdfObject

func (_caf *PdfActionHide) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionImportData

type PdfActionImportData struct {
	*PdfAction
	F *PdfFilespec
}

PdfActionImportData represents a importData action.

func NewPdfActionImportData

func NewPdfActionImportData() *PdfActionImportData

NewPdfActionImportData returns a new "import data" action.

func (*PdfActionImportData) ToPdfObject

func (_aafe *PdfActionImportData) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionJavaScript

type PdfActionJavaScript struct {
	*PdfAction
	JS _daa.PdfObject
}

PdfActionJavaScript represents a javaScript action.

func NewPdfActionJavaScript

func NewPdfActionJavaScript() *PdfActionJavaScript

NewPdfActionJavaScript returns a new "javaScript" action.

func (*PdfActionJavaScript) ToPdfObject

func (_gcgd *PdfActionJavaScript) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionLaunch

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

PdfActionLaunch represents a launch action.

func NewPdfActionLaunch

func NewPdfActionLaunch() *PdfActionLaunch

NewPdfActionLaunch returns a new "launch" action.

func (*PdfActionLaunch) ToPdfObject

func (_cceg *PdfActionLaunch) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionMovie

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

PdfActionMovie represents a movie action.

func NewPdfActionMovie

func NewPdfActionMovie() *PdfActionMovie

NewPdfActionMovie returns a new "movie" action.

func (*PdfActionMovie) ToPdfObject

func (_bgf *PdfActionMovie) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionNamed

type PdfActionNamed struct {
	*PdfAction
	N _daa.PdfObject
}

PdfActionNamed represents a named action.

func NewPdfActionNamed

func NewPdfActionNamed() *PdfActionNamed

NewPdfActionNamed returns a new "named" action.

func (*PdfActionNamed) ToPdfObject

func (_bc *PdfActionNamed) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionRendition

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

PdfActionRendition represents a Rendition action.

func NewPdfActionRendition

func NewPdfActionRendition() *PdfActionRendition

NewPdfActionRendition returns a new "rendition" action.

func (*PdfActionRendition) ToPdfObject

func (_bcc *PdfActionRendition) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionResetForm

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

PdfActionResetForm represents a resetForm action.

func NewPdfActionResetForm

func NewPdfActionResetForm() *PdfActionResetForm

NewPdfActionResetForm returns a new "reset form" action.

func (*PdfActionResetForm) ToPdfObject

func (_aggd *PdfActionResetForm) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionSetOCGState

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

PdfActionSetOCGState represents a SetOCGState action.

func NewPdfActionSetOCGState

func NewPdfActionSetOCGState() *PdfActionSetOCGState

NewPdfActionSetOCGState returns a new "named" action.

func (*PdfActionSetOCGState) ToPdfObject

func (_dee *PdfActionSetOCGState) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionSound

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

PdfActionSound represents a sound action.

func NewPdfActionSound

func NewPdfActionSound() *PdfActionSound

NewPdfActionSound returns a new "sound" action.

func (*PdfActionSound) ToPdfObject

func (_geg *PdfActionSound) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionSubmitForm

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

PdfActionSubmitForm represents a submitForm action.

func NewPdfActionSubmitForm

func NewPdfActionSubmitForm() *PdfActionSubmitForm

NewPdfActionSubmitForm returns a new "submit form" action.

func (*PdfActionSubmitForm) ToPdfObject

func (_adc *PdfActionSubmitForm) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionThread

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

PdfActionThread represents a thread action.

func NewPdfActionThread

func NewPdfActionThread() *PdfActionThread

NewPdfActionThread returns a new "thread" action.

func (*PdfActionThread) ToPdfObject

func (_bdf *PdfActionThread) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionTrans

type PdfActionTrans struct {
	*PdfAction
	Trans _daa.PdfObject
}

PdfActionTrans represents a trans action.

func NewPdfActionTrans

func NewPdfActionTrans() *PdfActionTrans

NewPdfActionTrans returns a new "trans" action.

func (*PdfActionTrans) ToPdfObject

func (_gae *PdfActionTrans) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfActionType

type PdfActionType string

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

const (
	ActionTypeGoTo        PdfActionType = "\u0047\u006f\u0054\u006f"
	ActionTypeGoTo3DView  PdfActionType = "\u0047\u006f\u0054\u006f\u0033\u0044\u0056\u0069\u0065\u0077"
	ActionTypeGoToE       PdfActionType = "\u0047\u006f\u0054o\u0045"
	ActionTypeGoToR       PdfActionType = "\u0047\u006f\u0054o\u0052"
	ActionTypeHide        PdfActionType = "\u0048\u0069\u0064\u0065"
	ActionTypeImportData  PdfActionType = "\u0049\u006d\u0070\u006f\u0072\u0074\u0044\u0061\u0074\u0061"
	ActionTypeJavaScript  PdfActionType = "\u004a\u0061\u0076\u0061\u0053\u0063\u0072\u0069\u0070\u0074"
	ActionTypeLaunch      PdfActionType = "\u004c\u0061\u0075\u006e\u0063\u0068"
	ActionTypeMovie       PdfActionType = "\u004d\u006f\u0076i\u0065"
	ActionTypeNamed       PdfActionType = "\u004e\u0061\u006de\u0064"
	ActionTypeRendition   PdfActionType = "\u0052e\u006e\u0064\u0069\u0074\u0069\u006fn"
	ActionTypeResetForm   PdfActionType = "\u0052e\u0073\u0065\u0074\u0046\u006f\u0072m"
	ActionTypeSetOCGState PdfActionType = "S\u0065\u0074\u004f\u0043\u0047\u0053\u0074\u0061\u0074\u0065"
	ActionTypeSound       PdfActionType = "\u0053\u006f\u0075n\u0064"
	ActionTypeSubmitForm  PdfActionType = "\u0053\u0075\u0062\u006d\u0069\u0074\u0046\u006f\u0072\u006d"
	ActionTypeThread      PdfActionType = "\u0054\u0068\u0072\u0065\u0061\u0064"
	ActionTypeTrans       PdfActionType = "\u0054\u0072\u0061n\u0073"
	ActionTypeURI         PdfActionType = "\u0055\u0052\u0049"
)

type PdfActionURI

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

PdfActionURI represents an URI action.

func NewPdfActionURI

func NewPdfActionURI() *PdfActionURI

NewPdfActionURI returns a new "Uri" action.

func (*PdfActionURI) ToPdfObject

func (_egab *PdfActionURI) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotation

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

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

func NewPdfAnnotation

func NewPdfAnnotation() *PdfAnnotation

NewPdfAnnotation returns an initialized generic PDF annotation model.

func (*PdfAnnotation) GetContainingPdfObject

func (_ebbc *PdfAnnotation) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfAnnotation) GetContext

func (_ddc *PdfAnnotation) GetContext() PdfModel

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

func (*PdfAnnotation) SetContext

func (_cbc *PdfAnnotation) SetContext(ctx PdfModel)

SetContext sets the sub annotation (context).

func (*PdfAnnotation) String

func (_cff *PdfAnnotation) String() string

func (*PdfAnnotation) ToPdfObject

func (_cfgg *PdfAnnotation) ToPdfObject() _daa.PdfObject

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

type PdfAnnotation3D

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

PdfAnnotation3D represents 3D annotations. (Section 13.6.2).

func NewPdfAnnotation3D

func NewPdfAnnotation3D() *PdfAnnotation3D

NewPdfAnnotation3D returns a new 3d annotation.

func (*PdfAnnotation3D) ToPdfObject

func (_cebf *PdfAnnotation3D) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationCaret

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

PdfAnnotationCaret represents Caret annotations. (Section 12.5.6.11).

func NewPdfAnnotationCaret

func NewPdfAnnotationCaret() *PdfAnnotationCaret

NewPdfAnnotationCaret returns a new caret annotation.

func (*PdfAnnotationCaret) ToPdfObject

func (_acac *PdfAnnotationCaret) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationCircle

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

PdfAnnotationCircle represents Circle annotations. (Section 12.5.6.8).

func NewPdfAnnotationCircle

func NewPdfAnnotationCircle() *PdfAnnotationCircle

NewPdfAnnotationCircle returns a new circle annotation.

func (*PdfAnnotationCircle) ToPdfObject

func (_ggc *PdfAnnotationCircle) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationFileAttachment

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

PdfAnnotationFileAttachment represents FileAttachment annotations. (Section 12.5.6.15).

func NewPdfAnnotationFileAttachment

func NewPdfAnnotationFileAttachment() *PdfAnnotationFileAttachment

NewPdfAnnotationFileAttachment returns a new file attachment annotation.

func (*PdfAnnotationFileAttachment) ToPdfObject

func (_abba *PdfAnnotationFileAttachment) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationFreeText

PdfAnnotationFreeText represents FreeText annotations. (Section 12.5.6.6).

func NewPdfAnnotationFreeText

func NewPdfAnnotationFreeText() *PdfAnnotationFreeText

NewPdfAnnotationFreeText returns a new free text annotation.

func (*PdfAnnotationFreeText) ToPdfObject

func (_bcad *PdfAnnotationFreeText) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationHighlight

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

PdfAnnotationHighlight represents Highlight annotations. (Section 12.5.6.10).

func NewPdfAnnotationHighlight

func NewPdfAnnotationHighlight() *PdfAnnotationHighlight

NewPdfAnnotationHighlight returns a new text highlight annotation.

func (*PdfAnnotationHighlight) ToPdfObject

func (_fedc *PdfAnnotationHighlight) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationInk

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

PdfAnnotationInk represents Ink annotations. (Section 12.5.6.13).

func NewPdfAnnotationInk

func NewPdfAnnotationInk() *PdfAnnotationInk

NewPdfAnnotationInk returns a new ink annotation.

func (*PdfAnnotationInk) ToPdfObject

func (_cbef *PdfAnnotationInk) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationLine

PdfAnnotationLine represents Line annotations. (Section 12.5.6.7).

func NewPdfAnnotationLine

func NewPdfAnnotationLine() *PdfAnnotationLine

NewPdfAnnotationLine returns a new line annotation.

func (*PdfAnnotationLine) ToPdfObject

func (_ffgf *PdfAnnotationLine) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationLink struct {
	*PdfAnnotation
	A          _daa.PdfObject
	Dest       _daa.PdfObject
	H          _daa.PdfObject
	PA         _daa.PdfObject
	QuadPoints _daa.PdfObject
	BS         _daa.PdfObject
	// contains filtered or unexported fields
}

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

func NewPdfAnnotationLink() *PdfAnnotationLink

NewPdfAnnotationLink returns a new link annotation.

func (*PdfAnnotationLink) GetAction

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

GetAction returns the PDF action for the annotation link.

func (*PdfAnnotationLink) SetAction

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

SetAction sets the PDF action for the annotation link.

func (*PdfAnnotationLink) ToPdfObject

func (_bbg *PdfAnnotationLink) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationMarkup

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

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

type PdfAnnotationMovie

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

PdfAnnotationMovie represents Movie annotations. (Section 12.5.6.17).

func NewPdfAnnotationMovie

func NewPdfAnnotationMovie() *PdfAnnotationMovie

NewPdfAnnotationMovie returns a new movie annotation.

func (*PdfAnnotationMovie) ToPdfObject

func (_bbbc *PdfAnnotationMovie) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPolyLine

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

PdfAnnotationPolyLine represents PolyLine annotations. (Section 12.5.6.9).

func NewPdfAnnotationPolyLine

func NewPdfAnnotationPolyLine() *PdfAnnotationPolyLine

NewPdfAnnotationPolyLine returns a new polyline annotation.

func (*PdfAnnotationPolyLine) ToPdfObject

func (_faffe *PdfAnnotationPolyLine) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPolygon

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

PdfAnnotationPolygon represents Polygon annotations. (Section 12.5.6.9).

func NewPdfAnnotationPolygon

func NewPdfAnnotationPolygon() *PdfAnnotationPolygon

NewPdfAnnotationPolygon returns a new polygon annotation.

func (*PdfAnnotationPolygon) ToPdfObject

func (_fafa *PdfAnnotationPolygon) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPopup

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

PdfAnnotationPopup represents Popup annotations. (Section 12.5.6.14).

func NewPdfAnnotationPopup

func NewPdfAnnotationPopup() *PdfAnnotationPopup

NewPdfAnnotationPopup returns a new popup annotation.

func (*PdfAnnotationPopup) ToPdfObject

func (_ddeg *PdfAnnotationPopup) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationPrinterMark

type PdfAnnotationPrinterMark struct {
	*PdfAnnotation
	MN _daa.PdfObject
}

PdfAnnotationPrinterMark represents PrinterMark annotations. (Section 12.5.6.20).

func NewPdfAnnotationPrinterMark

func NewPdfAnnotationPrinterMark() *PdfAnnotationPrinterMark

NewPdfAnnotationPrinterMark returns a new printermark annotation.

func (*PdfAnnotationPrinterMark) ToPdfObject

func (_bec *PdfAnnotationPrinterMark) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationProjection

type PdfAnnotationProjection struct {
	*PdfAnnotation
	*PdfAnnotationMarkup
}

PdfAnnotationProjection represents Projection annotations.

func NewPdfAnnotationProjection

func NewPdfAnnotationProjection() *PdfAnnotationProjection

NewPdfAnnotationProjection returns a new projection annotation.

func (*PdfAnnotationProjection) ToPdfObject

func (_add *PdfAnnotationProjection) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationRedact

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

PdfAnnotationRedact represents Redact annotations. (Section 12.5.6.23).

func NewPdfAnnotationRedact

func NewPdfAnnotationRedact() *PdfAnnotationRedact

NewPdfAnnotationRedact returns a new redact annotation.

func (*PdfAnnotationRedact) ToPdfObject

func (_fcfg *PdfAnnotationRedact) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationRichMedia

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

PdfAnnotationRichMedia represents Rich Media annotations.

func NewPdfAnnotationRichMedia

func NewPdfAnnotationRichMedia() *PdfAnnotationRichMedia

NewPdfAnnotationRichMedia returns a new rich media annotation.

func (*PdfAnnotationRichMedia) ToPdfObject

func (_edcc *PdfAnnotationRichMedia) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationScreen

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

PdfAnnotationScreen represents Screen annotations. (Section 12.5.6.18).

func NewPdfAnnotationScreen

func NewPdfAnnotationScreen() *PdfAnnotationScreen

NewPdfAnnotationScreen returns a new screen annotation.

func (*PdfAnnotationScreen) ToPdfObject

func (_eaaaf *PdfAnnotationScreen) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationSound

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

PdfAnnotationSound represents Sound annotations. (Section 12.5.6.16).

func NewPdfAnnotationSound

func NewPdfAnnotationSound() *PdfAnnotationSound

NewPdfAnnotationSound returns a new sound annotation.

func (*PdfAnnotationSound) ToPdfObject

func (_fgc *PdfAnnotationSound) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationSquare

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

PdfAnnotationSquare represents Square annotations. (Section 12.5.6.8).

func NewPdfAnnotationSquare

func NewPdfAnnotationSquare() *PdfAnnotationSquare

NewPdfAnnotationSquare returns a new square annotation.

func (*PdfAnnotationSquare) ToPdfObject

func (_dde *PdfAnnotationSquare) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationSquiggly

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

PdfAnnotationSquiggly represents Squiggly annotations. (Section 12.5.6.10).

func NewPdfAnnotationSquiggly

func NewPdfAnnotationSquiggly() *PdfAnnotationSquiggly

NewPdfAnnotationSquiggly returns a new text squiggly annotation.

func (*PdfAnnotationSquiggly) ToPdfObject

func (_gdc *PdfAnnotationSquiggly) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationStamp

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

PdfAnnotationStamp represents Stamp annotations. (Section 12.5.6.12).

func NewPdfAnnotationStamp

func NewPdfAnnotationStamp() *PdfAnnotationStamp

NewPdfAnnotationStamp returns a new stamp annotation.

func (*PdfAnnotationStamp) ToPdfObject

func (_gcab *PdfAnnotationStamp) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationStrikeOut

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

PdfAnnotationStrikeOut represents StrikeOut annotations. (Section 12.5.6.10).

func NewPdfAnnotationStrikeOut

func NewPdfAnnotationStrikeOut() *PdfAnnotationStrikeOut

NewPdfAnnotationStrikeOut returns a new text strikeout annotation.

func (*PdfAnnotationStrikeOut) ToPdfObject

func (_gdd *PdfAnnotationStrikeOut) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationText

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

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

func NewPdfAnnotationText

func NewPdfAnnotationText() *PdfAnnotationText

NewPdfAnnotationText returns a new text annotation.

func (*PdfAnnotationText) ToPdfObject

func (_fadge *PdfAnnotationText) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationTrapNet

type PdfAnnotationTrapNet struct{ *PdfAnnotation }

PdfAnnotationTrapNet represents TrapNet annotations. (Section 12.5.6.21).

func NewPdfAnnotationTrapNet

func NewPdfAnnotationTrapNet() *PdfAnnotationTrapNet

NewPdfAnnotationTrapNet returns a new trapnet annotation.

func (*PdfAnnotationTrapNet) ToPdfObject

func (_dada *PdfAnnotationTrapNet) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationUnderline

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

PdfAnnotationUnderline represents Underline annotations. (Section 12.5.6.10).

func NewPdfAnnotationUnderline

func NewPdfAnnotationUnderline() *PdfAnnotationUnderline

NewPdfAnnotationUnderline returns a new text underline annotation.

func (*PdfAnnotationUnderline) ToPdfObject

func (_dbfg *PdfAnnotationUnderline) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationWatermark

type PdfAnnotationWatermark struct {
	*PdfAnnotation
	FixedPrint _daa.PdfObject
}

PdfAnnotationWatermark represents Watermark annotations. (Section 12.5.6.22).

func NewPdfAnnotationWatermark

func NewPdfAnnotationWatermark() *PdfAnnotationWatermark

NewPdfAnnotationWatermark returns a new watermark annotation.

func (*PdfAnnotationWatermark) ToPdfObject

func (_deed *PdfAnnotationWatermark) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAnnotationWidget

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

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

func NewPdfAnnotationWidget

func NewPdfAnnotationWidget() *PdfAnnotationWidget

NewPdfAnnotationWidget returns an initialized annotation widget.

func (*PdfAnnotationWidget) Field

func (_fdfc *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 (_cfe *PdfAnnotationWidget) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfAppender

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

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

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 (_dcba *PdfAppender) AddPages(pages ...*PdfPage)

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

func (*PdfAppender) MergePageWith

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

MergePageWith appends page content to source Pdf file page content.

func (*PdfAppender) RemovePage

func (_gggd *PdfAppender) RemovePage(pageNum int)

RemovePage removes a page by number.

func (*PdfAppender) ReplaceAcroForm

func (_bgee *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 (_cac *PdfAppender) ReplacePage(pageNum int, page *PdfPage)

ReplacePage replaces the original page to a new page.

func (*PdfAppender) SetDSS

func (_bdab *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 (_dfe *PdfAppender) SetDocInfo(info *PdfInfo)

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

func (*PdfAppender) Sign

func (_feaf *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 (_gfdd *PdfAppender) UpdateObject(obj _daa.PdfObject)

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

func (*PdfAppender) UpdatePage

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

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

func (*PdfAppender) Write

func (_bfge *PdfAppender) Write(w _dgg.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 (_baf *PdfAppender) WriteToFile(outputPath string) error

WriteToFile writes the Appender output to file specified by path.

type PdfBorderEffect

type PdfBorderEffect struct {
	S *BorderEffect
	I *float64
}

PdfBorderEffect represents a PDF border effect.

type PdfBorderStyle

type PdfBorderStyle struct {
	W *float64
	S *BorderStyle
	D *[]int
	// contains filtered or unexported fields
}

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

func NewBorderStyle

func NewBorderStyle() *PdfBorderStyle

NewBorderStyle returns an initialized PdfBorderStyle.

func (*PdfBorderStyle) GetBorderWidth

func (_gecb *PdfBorderStyle) GetBorderWidth() float64

GetBorderWidth returns the border style's width.

func (*PdfBorderStyle) SetBorderWidth

func (_bdbc *PdfBorderStyle) SetBorderWidth(width float64)

SetBorderWidth sets the style's border width.

func (*PdfBorderStyle) ToPdfObject

func (_fdgd *PdfBorderStyle) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfColor

type PdfColor interface{}

PdfColor interface represents a generic color in PDF.

type PdfColorCalGray

type PdfColorCalGray float64

PdfColorCalGray represents a CalGray colorspace.

func NewPdfColorCalGray

func NewPdfColorCalGray(grayVal float64) *PdfColorCalGray

NewPdfColorCalGray returns a new CalGray color.

func (*PdfColorCalGray) GetNumComponents

func (_ebee *PdfColorCalGray) GetNumComponents() int

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

func (*PdfColorCalGray) ToInteger

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

ToInteger convert to an integer format.

func (*PdfColorCalGray) Val

func (_efbcf *PdfColorCalGray) Val() float64

Val returns the value of the color.

type PdfColorCalRGB

type PdfColorCalRGB [3]float64

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.

func NewPdfColorCalRGB

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

NewPdfColorCalRGB returns a new CalRBG color.

func (*PdfColorCalRGB) A

func (_fbge *PdfColorCalRGB) A() float64

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

func (*PdfColorCalRGB) B

func (_bbbe *PdfColorCalRGB) B() float64

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

func (*PdfColorCalRGB) C

func (_gaeca *PdfColorCalRGB) C() float64

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

func (*PdfColorCalRGB) GetNumComponents

func (_accd *PdfColorCalRGB) GetNumComponents() int

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

func (*PdfColorCalRGB) ToInteger

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

ToInteger convert to an integer format.

type PdfColorDeviceCMYK

type PdfColorDeviceCMYK [4]float64

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

func NewPdfColorDeviceCMYK

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

NewPdfColorDeviceCMYK returns a new CMYK32 color.

func (*PdfColorDeviceCMYK) C

func (_abbab *PdfColorDeviceCMYK) C() float64

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

func (*PdfColorDeviceCMYK) GetNumComponents

func (_eaef *PdfColorDeviceCMYK) GetNumComponents() int

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

func (*PdfColorDeviceCMYK) K

func (_dfff *PdfColorDeviceCMYK) K() float64

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

func (*PdfColorDeviceCMYK) M

func (_bbcc *PdfColorDeviceCMYK) M() float64

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

func (*PdfColorDeviceCMYK) ToInteger

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

ToInteger convert to an integer format.

func (*PdfColorDeviceCMYK) Y

func (_ggdge *PdfColorDeviceCMYK) Y() float64

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

type PdfColorDeviceGray

type PdfColorDeviceGray float64

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.

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 (_efaf *PdfColorDeviceGray) GetNumComponents() int

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

func (*PdfColorDeviceGray) ToInteger

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

ToInteger convert to an integer format.

func (*PdfColorDeviceGray) Val

func (_cccc *PdfColorDeviceGray) Val() float64

Val returns the color value.

type PdfColorDeviceRGB

type PdfColorDeviceRGB [3]float64

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.

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 (_gbfbc *PdfColorDeviceRGB) B() float64

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

func (*PdfColorDeviceRGB) G

func (_ebfa *PdfColorDeviceRGB) G() float64

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

func (*PdfColorDeviceRGB) GetNumComponents

func (_dgad *PdfColorDeviceRGB) GetNumComponents() int

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

func (*PdfColorDeviceRGB) R

func (_bdcc *PdfColorDeviceRGB) R() float64

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

func (*PdfColorDeviceRGB) ToGray

func (_abab *PdfColorDeviceRGB) ToGray() *PdfColorDeviceGray

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

func (*PdfColorDeviceRGB) ToInteger

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

ToInteger convert to an integer format.

type PdfColorLab

type PdfColorLab [3]float64

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.

func NewPdfColorLab

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

NewPdfColorLab returns a new Lab color.

func (*PdfColorLab) A

func (_dagc *PdfColorLab) A() float64

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

func (*PdfColorLab) B

func (_bbgec *PdfColorLab) B() float64

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

func (*PdfColorLab) GetNumComponents

func (_adcbg *PdfColorLab) GetNumComponents() int

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

func (*PdfColorLab) L

func (_fedcf *PdfColorLab) L() float64

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

func (*PdfColorLab) ToInteger

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

ToInteger convert to an integer format.

type PdfColorPattern

type PdfColorPattern struct {
	Color       PdfColor
	PatternName _daa.PdfObjectName
}

PdfColorPattern represents a pattern color.

func NewPdfColorPattern

func NewPdfColorPattern() *PdfColorPattern

NewPdfColorPattern returns an empty color pattern.

type PdfColorPatternType2

type PdfColorPatternType2 struct {
	Color       PdfColor
	PatternName _daa.PdfObjectName
}

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

func NewPdfColorPatternType2

func NewPdfColorPatternType2() *PdfColorPatternType2

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

type PdfColorPatternType3

type PdfColorPatternType3 struct {
	Color       PdfColor
	PatternName _daa.PdfObjectName
}

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

func NewPdfColorPatternType3

func NewPdfColorPatternType3() *PdfColorPatternType3

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

type PdfColorspace

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(_cdbfc PdfColor) (PdfColor, error)

	// GetNumComponents returns the number of components in the PdfColorspace.
	GetNumComponents() int

	// ToPdfObject returns a PdfObject representation of the PdfColorspace.
	ToPdfObject() _daa.PdfObject

	// ColorFromPdfObjects returns a PdfColor in the given PdfColorspace from an array of PdfObject where each
	// PdfObject represents a numeric value.
	ColorFromPdfObjects(_ffbd []_daa.PdfObject) (PdfColor, error)

	// ColorFromFloats returns a new PdfColor based on input color components for a given PdfColorspace.
	ColorFromFloats(_bfdf []float64) (PdfColor, error)

	// DecodeArray returns the Decode array for the PdfColorSpace, i.e. the range of each component.
	DecodeArray() []float64
}

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.

func NewPdfColorspaceFromPdfObject

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

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

type PdfColorspaceCalGray

type PdfColorspaceCalGray struct {
	WhitePoint []float64
	BlackPoint []float64
	Gamma      float64
	// contains filtered or unexported fields
}

PdfColorspaceCalGray represents CalGray color space.

func NewPdfColorspaceCalGray

func NewPdfColorspaceCalGray() *PdfColorspaceCalGray

NewPdfColorspaceCalGray returns a new CalGray colorspace object.

func (*PdfColorspaceCalGray) ColorFromFloats

func (_gedf *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 (_efgba *PdfColorspaceCalGray) ColorFromPdfObjects(objects []_daa.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 (_cecd *PdfColorspaceCalGray) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a CalGray color to an RGB color.

func (*PdfColorspaceCalGray) DecodeArray

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

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

func (*PdfColorspaceCalGray) GetNumComponents

func (_bbdf *PdfColorspaceCalGray) GetNumComponents() int

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

func (*PdfColorspaceCalGray) ImageToRGB

func (_defd *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 (_bgef *PdfColorspaceCalGray) String() string

func (*PdfColorspaceCalGray) ToPdfObject

func (_afge *PdfColorspaceCalGray) ToPdfObject() _daa.PdfObject

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

type PdfColorspaceCalRGB

type PdfColorspaceCalRGB struct {
	WhitePoint []float64
	BlackPoint []float64
	Gamma      []float64
	Matrix     []float64
	// contains filtered or unexported fields
}

PdfColorspaceCalRGB stores A, B, C components

func NewPdfColorspaceCalRGB

func NewPdfColorspaceCalRGB() *PdfColorspaceCalRGB

NewPdfColorspaceCalRGB returns a new CalRGB colorspace object.

func (*PdfColorspaceCalRGB) ColorFromFloats

func (_bcadd *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 (_ebad *PdfColorspaceCalRGB) ColorFromPdfObjects(objects []_daa.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 (_aaecb *PdfColorspaceCalRGB) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a CalRGB color to an RGB color.

func (*PdfColorspaceCalRGB) DecodeArray

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

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

func (*PdfColorspaceCalRGB) GetNumComponents

func (_gbfbcc *PdfColorspaceCalRGB) GetNumComponents() int

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

func (*PdfColorspaceCalRGB) ImageToRGB

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

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

func (*PdfColorspaceCalRGB) String

func (_cecf *PdfColorspaceCalRGB) String() string

func (*PdfColorspaceCalRGB) ToPdfObject

func (_abgba *PdfColorspaceCalRGB) ToPdfObject() _daa.PdfObject

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

type PdfColorspaceDeviceCMYK

type PdfColorspaceDeviceCMYK struct{}

PdfColorspaceDeviceCMYK represents a CMYK32 colorspace.

func NewPdfColorspaceDeviceCMYK

func NewPdfColorspaceDeviceCMYK() *PdfColorspaceDeviceCMYK

NewPdfColorspaceDeviceCMYK returns a new CMYK32 colorspace object.

func (*PdfColorspaceDeviceCMYK) ColorFromFloats

func (_ebaa *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 (_aagf *PdfColorspaceDeviceCMYK) ColorFromPdfObjects(objects []_daa.PdfObject) (PdfColor, error)

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

func (*PdfColorspaceDeviceCMYK) ColorToRGB

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

ColorToRGB converts a CMYK32 color to an RGB color.

func (*PdfColorspaceDeviceCMYK) DecodeArray

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

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

func (*PdfColorspaceDeviceCMYK) GetNumComponents

func (_bfcd *PdfColorspaceDeviceCMYK) GetNumComponents() int

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

func (*PdfColorspaceDeviceCMYK) ImageToRGB

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

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

func (*PdfColorspaceDeviceCMYK) String

func (_fbaaf *PdfColorspaceDeviceCMYK) String() string

func (*PdfColorspaceDeviceCMYK) ToPdfObject

func (_daad *PdfColorspaceDeviceCMYK) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceDeviceGray

type PdfColorspaceDeviceGray struct{}

PdfColorspaceDeviceGray represents a grayscale colorspace.

func NewPdfColorspaceDeviceGray

func NewPdfColorspaceDeviceGray() *PdfColorspaceDeviceGray

NewPdfColorspaceDeviceGray returns a new grayscale colorspace.

func (*PdfColorspaceDeviceGray) ColorFromFloats

func (_babf *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 (_aceba *PdfColorspaceDeviceGray) ColorFromPdfObjects(objects []_daa.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 (_fgd *PdfColorspaceDeviceGray) ColorToRGB(color PdfColor) (PdfColor, error)

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

func (*PdfColorspaceDeviceGray) DecodeArray

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

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

func (*PdfColorspaceDeviceGray) GetNumComponents

func (_eafdg *PdfColorspaceDeviceGray) GetNumComponents() int

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

func (*PdfColorspaceDeviceGray) ImageToRGB

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

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

func (*PdfColorspaceDeviceGray) String

func (_gced *PdfColorspaceDeviceGray) String() string

func (*PdfColorspaceDeviceGray) ToPdfObject

func (_agbe *PdfColorspaceDeviceGray) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceDeviceN

type PdfColorspaceDeviceN struct {
	ColorantNames  *_daa.PdfObjectArray
	AlternateSpace PdfColorspace
	TintTransform  PdfFunction
	Attributes     *PdfColorspaceDeviceNAttributes
	// contains filtered or unexported fields
}

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]

func NewPdfColorspaceDeviceN

func NewPdfColorspaceDeviceN() *PdfColorspaceDeviceN

NewPdfColorspaceDeviceN returns an initialized PdfColorspaceDeviceN.

func (*PdfColorspaceDeviceN) ColorFromFloats

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

ColorFromFloats returns a new PdfColor based on input color components.

func (*PdfColorspaceDeviceN) ColorFromPdfObjects

func (_egfd *PdfColorspaceDeviceN) ColorFromPdfObjects(objects []_daa.PdfObject) (PdfColor, error)

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

func (*PdfColorspaceDeviceN) ColorToRGB

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

ColorToRGB converts a DeviceN color to an RGB color.

func (*PdfColorspaceDeviceN) DecodeArray

func (_ebeb *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 (_faad *PdfColorspaceDeviceN) GetNumComponents() int

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

func (*PdfColorspaceDeviceN) ImageToRGB

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

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

func (*PdfColorspaceDeviceN) String

func (_caaff *PdfColorspaceDeviceN) String() string

String returns the name of the colorspace (DeviceN).

func (*PdfColorspaceDeviceN) ToPdfObject

func (_aaafe *PdfColorspaceDeviceN) ToPdfObject() _daa.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

type PdfColorspaceDeviceNAttributes struct {
	Subtype     *_daa.PdfObjectName
	Colorants   _daa.PdfObject
	Process     _daa.PdfObject
	MixingHints _daa.PdfObject
	// contains filtered or unexported fields
}

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.

func (*PdfColorspaceDeviceNAttributes) ToPdfObject

func (_cffb *PdfColorspaceDeviceNAttributes) ToPdfObject() _daa.PdfObject

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

type PdfColorspaceDeviceRGB

type PdfColorspaceDeviceRGB struct{}

PdfColorspaceDeviceRGB represents an RGB colorspace.

func NewPdfColorspaceDeviceRGB

func NewPdfColorspaceDeviceRGB() *PdfColorspaceDeviceRGB

NewPdfColorspaceDeviceRGB returns a new RGB colorspace object.

func (*PdfColorspaceDeviceRGB) ColorFromFloats

func (_bdae *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 (_cgefg *PdfColorspaceDeviceRGB) ColorFromPdfObjects(objects []_daa.PdfObject) (PdfColor, error)

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

func (*PdfColorspaceDeviceRGB) ColorToRGB

func (_gfcc *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 (_gfcb *PdfColorspaceDeviceRGB) DecodeArray() []float64

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

func (*PdfColorspaceDeviceRGB) GetNumComponents

func (_ccea *PdfColorspaceDeviceRGB) GetNumComponents() int

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

func (*PdfColorspaceDeviceRGB) ImageToGray

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

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

func (*PdfColorspaceDeviceRGB) ImageToRGB

func (_ecef *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 (_dgff *PdfColorspaceDeviceRGB) String() string

func (*PdfColorspaceDeviceRGB) ToPdfObject

func (_caa *PdfColorspaceDeviceRGB) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceICCBased

type PdfColorspaceICCBased struct {
	N         int
	Alternate PdfColorspace

	// If omitted ICC not supported: then use DeviceGray,
	// DeviceRGB or DeviceCMYK for N=1,3,4 respectively.
	Range    []float64
	Metadata *_daa.PdfObjectStream
	Data     []byte
	// contains filtered or unexported fields
}

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.

func NewPdfColorspaceICCBased

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

NewPdfColorspaceICCBased returns a new ICCBased colorspace object.

func (*PdfColorspaceICCBased) ColorFromFloats

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

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

func (*PdfColorspaceICCBased) ColorFromPdfObjects

func (_daafg *PdfColorspaceICCBased) ColorFromPdfObjects(objects []_daa.PdfObject) (PdfColor, error)

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

func (*PdfColorspaceICCBased) ColorToRGB

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

ColorToRGB converts a ICCBased color to an RGB color.

func (*PdfColorspaceICCBased) DecodeArray

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

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

func (*PdfColorspaceICCBased) GetContainingPdfObject

func (_gdbe *PdfColorspaceICCBased) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject gets the primitive used to parse the color space.

func (*PdfColorspaceICCBased) GetNumComponents

func (_fefd *PdfColorspaceICCBased) GetNumComponents() int

GetNumComponents returns the number of color components.

func (*PdfColorspaceICCBased) ImageToRGB

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

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

func (*PdfColorspaceICCBased) String

func (_aacad *PdfColorspaceICCBased) String() string

func (*PdfColorspaceICCBased) ToPdfObject

func (_edfb *PdfColorspaceICCBased) ToPdfObject() _daa.PdfObject

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

type PdfColorspaceLab

type PdfColorspaceLab struct {
	WhitePoint []float64
	BlackPoint []float64
	Range      []float64
	// contains filtered or unexported fields
}

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

func NewPdfColorspaceLab

func NewPdfColorspaceLab() *PdfColorspaceLab

NewPdfColorspaceLab returns a new Lab colorspace object.

func (*PdfColorspaceLab) ColorFromFloats

func (_edea *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 (_agabc *PdfColorspaceLab) ColorFromPdfObjects(objects []_daa.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 (_adba *PdfColorspaceLab) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a Lab color to an RGB color.

func (*PdfColorspaceLab) DecodeArray

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

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

func (*PdfColorspaceLab) GetNumComponents

func (_affd *PdfColorspaceLab) GetNumComponents() int

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

func (*PdfColorspaceLab) ImageToRGB

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

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

func (*PdfColorspaceLab) String

func (_gebf *PdfColorspaceLab) String() string

func (*PdfColorspaceLab) ToPdfObject

func (_adgb *PdfColorspaceLab) ToPdfObject() _daa.PdfObject

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

type PdfColorspaceSpecialIndexed

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

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]

func NewPdfColorspaceSpecialIndexed

func NewPdfColorspaceSpecialIndexed() *PdfColorspaceSpecialIndexed

NewPdfColorspaceSpecialIndexed returns a new Indexed color.

func (*PdfColorspaceSpecialIndexed) ColorFromFloats

func (_afff *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 (_fegdd *PdfColorspaceSpecialIndexed) ColorFromPdfObjects(objects []_daa.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 (_dddb *PdfColorspaceSpecialIndexed) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts an Indexed color to an RGB color.

func (*PdfColorspaceSpecialIndexed) DecodeArray

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

DecodeArray returns the component range values for the Indexed colorspace.

func (*PdfColorspaceSpecialIndexed) GetNumComponents

func (_ddac *PdfColorspaceSpecialIndexed) GetNumComponents() int

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

func (*PdfColorspaceSpecialIndexed) ImageToRGB

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

ImageToRGB convert an indexed image to RGB.

func (*PdfColorspaceSpecialIndexed) String

func (_bdad *PdfColorspaceSpecialIndexed) String() string

func (*PdfColorspaceSpecialIndexed) ToPdfObject

func (_gcaa *PdfColorspaceSpecialIndexed) ToPdfObject() _daa.PdfObject

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

type PdfColorspaceSpecialPattern

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

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

func NewPdfColorspaceSpecialPattern

func NewPdfColorspaceSpecialPattern() *PdfColorspaceSpecialPattern

NewPdfColorspaceSpecialPattern returns a new pattern color.

func (*PdfColorspaceSpecialPattern) ColorFromFloats

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

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

func (*PdfColorspaceSpecialPattern) ColorFromPdfObjects

func (_cefga *PdfColorspaceSpecialPattern) ColorFromPdfObjects(objects []_daa.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 (_eeaf *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 (_fagg *PdfColorspaceSpecialPattern) DecodeArray() []float64

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

func (*PdfColorspaceSpecialPattern) GetNumComponents

func (_ddddc *PdfColorspaceSpecialPattern) GetNumComponents() int

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

func (*PdfColorspaceSpecialPattern) ImageToRGB

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

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

func (*PdfColorspaceSpecialPattern) String

func (_gbde *PdfColorspaceSpecialPattern) String() string

func (*PdfColorspaceSpecialPattern) ToPdfObject

func (_edeae *PdfColorspaceSpecialPattern) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfColorspaceSpecialSeparation

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

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]

func NewPdfColorspaceSpecialSeparation

func NewPdfColorspaceSpecialSeparation() *PdfColorspaceSpecialSeparation

NewPdfColorspaceSpecialSeparation returns a new separation color.

func (*PdfColorspaceSpecialSeparation) ColorFromFloats

func (_cgbg *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 (_eebb *PdfColorspaceSpecialSeparation) ColorFromPdfObjects(objects []_daa.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 (_bbef *PdfColorspaceSpecialSeparation) ColorToRGB(color PdfColor) (PdfColor, error)

ColorToRGB converts a color in Separation colorspace to RGB colorspace.

func (*PdfColorspaceSpecialSeparation) DecodeArray

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

DecodeArray returns the component range values for the Separation colorspace.

func (*PdfColorspaceSpecialSeparation) GetNumComponents

func (_bfgb *PdfColorspaceSpecialSeparation) GetNumComponents() int

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

func (*PdfColorspaceSpecialSeparation) ImageToRGB

func (_eeebd *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 (_dgcb *PdfColorspaceSpecialSeparation) String() string

func (*PdfColorspaceSpecialSeparation) ToPdfObject

func (_caae *PdfColorspaceSpecialSeparation) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfDate

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

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

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 _d.Time) (PdfDate, error)

NewPdfDateFromTime will create a PdfDate based on the given time

func (PdfDate) ToGoTime

func (_ceeac PdfDate) ToGoTime() _d.Time

ToGoTime returns the date in time.Time format.

func (*PdfDate) ToPdfObject

func (_cbefg *PdfDate) ToPdfObject() _daa.PdfObject

ToPdfObject converts date to a PDF string object.

type PdfField

type PdfField struct {
	Parent       *PdfField
	Annotations  []*PdfAnnotationWidget
	Kids         []*PdfField
	FT           *_daa.PdfObjectName
	T            *_daa.PdfObjectString
	TU           *_daa.PdfObjectString
	TM           *_daa.PdfObjectString
	Ff           *_daa.PdfObjectInteger
	V            _daa.PdfObject
	DV           _daa.PdfObject
	AA           _daa.PdfObject
	VariableText *VariableText
	// contains filtered or unexported fields
}

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).

func NewPdfField

func NewPdfField() *PdfField

NewPdfField returns an initialized PdfField.

func (*PdfField) Flags

func (_agggc *PdfField) Flags() FieldFlag

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

func (*PdfField) FullName

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

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

func (*PdfField) GetContainingPdfObject

func (_gfaa *PdfField) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfField) GetContext

func (_afcce *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 (_acccf *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 (_cdcaf *PdfField) PartialName() string

PartialName returns the partial name of the field.

func (*PdfField) SetContext

func (_bgdf *PdfField) SetContext(ctx PdfModel)

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

func (*PdfField) SetFlag

func (_gdge *PdfField) SetFlag(flag FieldFlag)

SetFlag sets the flag for the field.

func (*PdfField) String

func (_eegb *PdfField) String() string

String returns a string representation of the field.

func (*PdfField) ToPdfObject

func (_eded *PdfField) ToPdfObject() _daa.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

type PdfFieldButton struct {
	*PdfField
	Opt *_daa.PdfObjectArray
	// contains filtered or unexported fields
}

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

func (*PdfFieldButton) GetFillImage

func (_ffff *PdfFieldButton) GetFillImage() *Image

GetFillImage get attached model.Image in push button.

func (*PdfFieldButton) GetType

func (_dgfc *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 (_eafg *PdfFieldButton) IsCheckbox() bool

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

func (*PdfFieldButton) IsPush

func (_gbeae *PdfFieldButton) IsPush() bool

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

func (*PdfFieldButton) IsRadio

func (_fddc *PdfFieldButton) IsRadio() bool

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

func (*PdfFieldButton) SetFillImage

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

SetFillImage attach a model.Image to push button.

func (*PdfFieldButton) SetType

func (_ffdgc *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 (_bbgc *PdfFieldButton) ToPdfObject() _daa.PdfObject

ToPdfObject returns the button field dictionary within an indirect object.

type PdfFieldChoice

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

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

func (*PdfFieldChoice) ToPdfObject

func (_dcdc *PdfFieldChoice) ToPdfObject() _daa.PdfObject

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

type PdfFieldSignature

type PdfFieldSignature struct {
	*PdfField
	*PdfAnnotationWidget
	V    *PdfSignature
	Lock *_daa.PdfIndirectObject
	SV   *_daa.PdfIndirectObject
}

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

func NewPdfFieldSignature

func NewPdfFieldSignature(signature *PdfSignature) *PdfFieldSignature

NewPdfFieldSignature returns an initialized signature field.

func (*PdfFieldSignature) ToPdfObject

func (_fcddb *PdfFieldSignature) ToPdfObject() _daa.PdfObject

ToPdfObject returns an indirect object containing the signature field dictionary.

type PdfFieldText

PdfFieldText represents a text field where user can enter text.

func (*PdfFieldText) ToPdfObject

func (_ffgae *PdfFieldText) ToPdfObject() _daa.PdfObject

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

type PdfFilespec

type PdfFilespec struct {
	Type _daa.PdfObject
	FS   _daa.PdfObject
	F    _daa.PdfObject
	UF   _daa.PdfObject
	DOS  _daa.PdfObject
	Mac  _daa.PdfObject
	Unix _daa.PdfObject
	ID   _daa.PdfObject
	V    _daa.PdfObject
	EF   _daa.PdfObject
	RF   _daa.PdfObject
	Desc _daa.PdfObject
	CI   _daa.PdfObject
	// contains filtered or unexported fields
}

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

func NewPdfFilespec

func NewPdfFilespec() *PdfFilespec

NewPdfFilespec returns an initialized generic PDF filespec model.

func NewPdfFilespecFromObj

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

NewPdfFilespecFromObj creates and returns a new PdfFilespec object.

func (*PdfFilespec) GetContainingPdfObject

func (_eaab *PdfFilespec) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfFilespec) ToPdfObject

func (_gcef *PdfFilespec) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfFont

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

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

func DefaultFont

func DefaultFont() *PdfFont

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

func NewCompositePdfFontFromTTF

func NewCompositePdfFontFromTTF(r _dgg.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 _daa.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 _dgg.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, _df.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 (_beadf *PdfFont) BaseFont() string

BaseFont returns the font's "BaseFont" field.

func (*PdfFont) BytesToCharcodes

func (_afafa *PdfFont) BytesToCharcodes(data []byte) []_df.CharCode

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

func (*PdfFont) CharcodeBytesToUnicode

func (_gbag *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 (_baac *PdfFont) CharcodesToStrings(charcodes []_df.CharCode) ([]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 (_cafd *PdfFont) CharcodesToUnicode(charcodes []_df.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 (_ffcda *PdfFont) CharcodesToUnicodeWithStats(charcodes []_df.CharCode) (_dadd []rune, _ceeg, _eggg 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 (_dfaf *PdfFont) Encoder() _df.TextEncoder

Encoder returns the font's text encoder.

func (*PdfFont) FontDescriptor

func (_fbcfd *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) GetCharMetrics

func (_abad *PdfFont) GetCharMetrics(code _df.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 (_fcefg PdfFont) GetFontDescriptor() (*PdfFontDescriptor, error)

GetFontDescriptor returns the font descriptor for `font`.

func (*PdfFont) GetRuneMetrics

func (_bade *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 (_fdadb *PdfFont) IsCID() bool

IsCID returns true if the underlying font is CID.

func (*PdfFont) IsSimple

func (_fbdg *PdfFont) IsSimple() bool

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

func (*PdfFont) RunesToCharcodeBytes

func (_ggag *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 (_gafcb *PdfFont) String() string

String returns a string that describes `font`.

func (*PdfFont) StringToCharcodeBytes

func (_fdcfd *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 (_fece *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 (_fcgca *PdfFont) Subtype() string

Subtype returns the font's "Subtype" field.

func (*PdfFont) ToPdfObject

func (_eabeg *PdfFont) ToPdfObject() _daa.PdfObject

ToPdfObject converts the PdfFont object to its PDF representation.

func (*PdfFont) ToUnicode

func (_bccdb *PdfFont) ToUnicode() string

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

type PdfFontDescriptor

type PdfFontDescriptor struct {
	FontName     _daa.PdfObject
	FontFamily   _daa.PdfObject
	FontStretch  _daa.PdfObject
	FontWeight   _daa.PdfObject
	Flags        _daa.PdfObject
	FontBBox     _daa.PdfObject
	ItalicAngle  _daa.PdfObject
	Ascent       _daa.PdfObject
	Descent      _daa.PdfObject
	Leading      _daa.PdfObject
	CapHeight    _daa.PdfObject
	XHeight      _daa.PdfObject
	StemV        _daa.PdfObject
	StemH        _daa.PdfObject
	AvgWidth     _daa.PdfObject
	MaxWidth     _daa.PdfObject
	MissingWidth _daa.PdfObject
	FontFile     _daa.PdfObject
	FontFile2    _daa.PdfObject
	FontFile3    _daa.PdfObject
	CharSet      _daa.PdfObject

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

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

func (*PdfFontDescriptor) GetAscent

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

GetAscent returns the Ascent of the font `descriptor`.

func (*PdfFontDescriptor) GetCapHeight

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

GetCapHeight returns the CapHeight of the font `descriptor`.

func (*PdfFontDescriptor) GetDescent

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

GetDescent returns the Descent of the font `descriptor`.

func (*PdfFontDescriptor) GetXHeight

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

GetXHeight returns the XHeight of the font `descriptor`.

func (*PdfFontDescriptor) String

func (_fedf *PdfFontDescriptor) String() string

String returns a string describing the font descriptor.

func (*PdfFontDescriptor) ToPdfObject

func (_daeb *PdfFontDescriptor) ToPdfObject() _daa.PdfObject

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

type PdfFunction

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

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

type PdfFunctionType0

type PdfFunctionType0 struct {
	Domain        []float64
	Range         []float64
	NumInputs     int
	NumOutputs    int
	Size          []int
	BitsPerSample int
	Order         int
	Encode        []float64
	Decode        []float64
	// contains filtered or unexported fields
}

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

func (*PdfFunctionType0) Evaluate

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

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

func (*PdfFunctionType0) ToPdfObject

func (_eefdc *PdfFunctionType0) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfFunctionType2

type PdfFunctionType2 struct {
	Domain []float64
	Range  []float64
	C0     []float64
	C1     []float64
	N      float64
	// contains filtered or unexported fields
}

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.

func (*PdfFunctionType2) Evaluate

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

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

func (*PdfFunctionType2) ToPdfObject

func (_bebgd *PdfFunctionType2) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfFunctionType3

type PdfFunctionType3 struct {
	Domain    []float64
	Range     []float64
	Functions []PdfFunction
	Bounds    []float64
	Encode    []float64
	// contains filtered or unexported fields
}

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

func (*PdfFunctionType3) Evaluate

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

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

func (*PdfFunctionType3) ToPdfObject

func (_agbb *PdfFunctionType3) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfFunctionType4

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

PdfFunctionType4 is a Postscript calculator functions.

func (*PdfFunctionType4) Evaluate

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

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

func (*PdfFunctionType4) ToPdfObject

func (_eefefg *PdfFunctionType4) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the function.

type PdfInfo

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

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

func NewPdfInfoFromObject

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

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

func (*PdfInfo) AddCustomInfo

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

AddCustomInfo adds a custom info into document info dictionary.

func (*PdfInfo) CustomKeys

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

CustomKeys returns all custom info keys as list.

func (*PdfInfo) GetCustomInfo

func (_efgf *PdfInfo) GetCustomInfo(name string) *_daa.PdfObjectString

GetCustomInfo returns a custom info value for the specified name.

func (*PdfInfo) ToPdfObject

func (_cacg *PdfInfo) ToPdfObject() _daa.PdfObject

ToPdfObject convert PdfInfo to pdf object.

type PdfInfoTrapped

type PdfInfoTrapped string

PdfInfoTrapped specifies pdf trapped information.

const (
	TrappedUnknown PdfInfoTrapped = "\u0055n\u006b\u006e\u006f\u0077\u006e"
	TrappedTrue    PdfInfoTrapped = "\u0054\u0072\u0075\u0065"
	TrappedFalse   PdfInfoTrapped = "\u0046\u0061\u006cs\u0065"
)

type PdfModel

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

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 PdfOutline

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

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

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 (_dddbe *PdfOutline) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfOutline) ToPdfObject

func (_ggdcc *PdfOutline) ToPdfObject() _daa.PdfObject

ToPdfObject recursively builds the Outline tree PDF object.

type PdfOutlineItem

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

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

func NewOutlineBookmark

func NewOutlineBookmark(title string, page *_daa.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 (_gdbab *PdfOutlineItem) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfOutlineItem) ToPdfObject

func (_cdacg *PdfOutlineItem) ToPdfObject() _daa.PdfObject

ToPdfObject recursively builds the Outline tree PDF object.

type PdfOutlineTreeNode

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

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

func (*PdfOutlineTreeNode) GetContainingPdfObject

func (_cdbdb *PdfOutlineTreeNode) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfOutlineTreeNode) GetContext

func (_aega *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 (_cffea *PdfOutlineTreeNode) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the outline tree node.

type PdfOutputIntent

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
}

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.

func NewCustomPdfOutputIntent

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

NewCustomPdfOutputIntent creates a new custom PdfOutputIntent.

func NewPdfOutputIntentFromPdfObject

func NewPdfOutputIntentFromPdfObject(object _daa.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 (_gcgfb *PdfOutputIntent) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject implements model.PdfModel interface.

func (*PdfOutputIntent) ParsePdfObject

func (_gfgebe *PdfOutputIntent) ParsePdfObject(object _daa.PdfObject) error

ParsePdfObject parses input pdf object into given output intent.

func (*PdfOutputIntent) SetSubtype

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

SetSubtype sets the Subtype S for given PdfOutputIntent.

func (*PdfOutputIntent) ToPdfObject

func (_fbcgb *PdfOutputIntent) ToPdfObject() _daa.PdfObject

ToPdfObject implements model.PdfModel interface.

type PdfOutputIntentType

type PdfOutputIntentType int

PdfOutputIntentType is the subtype of the given PdfOutputIntent.

const (
	PdfOutputIntentTypeA1 PdfOutputIntentType
	PdfOutputIntentTypeA2
	PdfOutputIntentTypeA3
	PdfOutputIntentTypeA4
	PdfOutputIntentTypeX
)

func (PdfOutputIntentType) IsValid

func (_daaeg PdfOutputIntentType) IsValid() bool

IsValid checks if the given pdf output intent type is valid.

func (PdfOutputIntentType) String

func (_gecgb 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

type PdfPage struct {
	Parent               _daa.PdfObject
	LastModified         *PdfDate
	Resources            *PdfPageResources
	CropBox              *PdfRectangle
	MediaBox             *PdfRectangle
	BleedBox             *PdfRectangle
	TrimBox              *PdfRectangle
	ArtBox               *PdfRectangle
	BoxColorInfo         _daa.PdfObject
	Contents             _daa.PdfObject
	Rotate               *int64
	Group                _daa.PdfObject
	Thumb                _daa.PdfObject
	B                    _daa.PdfObject
	Dur                  _daa.PdfObject
	Trans                _daa.PdfObject
	AA                   _daa.PdfObject
	Metadata             _daa.PdfObject
	PieceInfo            _daa.PdfObject
	StructParents        _daa.PdfObject
	ID                   _daa.PdfObject
	PZ                   _daa.PdfObject
	SeparationInfo       _daa.PdfObject
	Tabs                 _daa.PdfObject
	TemplateInstantiated _daa.PdfObject
	PresSteps            _daa.PdfObject
	UserUnit             _daa.PdfObject
	VP                   _daa.PdfObject
	Annots               _daa.PdfObject
	// contains filtered or unexported fields
}

PdfPage represents a page in a PDF document. (7.7.3.3 - Table 30).

func NewPdfPage

func NewPdfPage() *PdfPage

NewPdfPage returns a new PDF page.

func (*PdfPage) AddAnnotation

func (_adbdb *PdfPage) AddAnnotation(annot *PdfAnnotation)

AddAnnotation appends `annot` to the list of page annotations.

func (*PdfPage) AddContentStreamByString

func (_gccec *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 (_becf *PdfPage) AddExtGState(name _daa.PdfObjectName, egs *_daa.PdfObjectDictionary) error

AddExtGState adds a graphics state to the XObject resources.

func (*PdfPage) AddFont

func (_bacb *PdfPage) AddFont(name _daa.PdfObjectName, font _daa.PdfObject) error

AddFont adds a font dictionary to the Font resources.

func (*PdfPage) AddImageResource

func (_fbfce *PdfPage) AddImageResource(name _daa.PdfObjectName, ximg *XObjectImage) error

AddImageResource adds an image to the XObject resources.

func (*PdfPage) AddWatermarkImage

func (_facaa *PdfPage) AddWatermarkImage(ximg *XObjectImage, opt WatermarkImageOptions) error

AddWatermarkImage adds a watermark to the page.

func (*PdfPage) AppendContentBytes

func (_cffgg *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 (_bebbg *PdfPage) AppendContentStream(contentStr string) error

AppendContentStream adds content stream by string. Appends to the last contentstream instance if many.

func (*PdfPage) Duplicate

func (_cebga *PdfPage) Duplicate() *PdfPage

Duplicate creates a duplicate page based on the current one and returns it.

func (*PdfPage) GetAllContentStreams

func (_bgge *PdfPage) GetAllContentStreams() (string, error)

GetAllContentStreams gets all the content streams for a page as one string.

func (*PdfPage) GetAnnotations

func (_acafb *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 (_fafef *PdfPage) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject returns the page as a dictionary within an PdfIndirectObject.

func (*PdfPage) GetContentStreamObjs

func (_abbggb *PdfPage) GetContentStreamObjs() []_daa.PdfObject

GetContentStreamObjs returns a slice of PDF objects containing the content streams of the page.

func (*PdfPage) GetContentStreams

func (_bfed *PdfPage) GetContentStreams() ([]string, error)

GetContentStreams returns the content stream as an array of strings.

func (*PdfPage) GetMediaBox

func (_beefd *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 (_gegba *PdfPage) GetPageAsIndirectObject() *_daa.PdfIndirectObject

GetPageAsIndirectObject returns the page as a dictionary within an PdfIndirectObject.

func (*PdfPage) GetPageDict

func (_gffg *PdfPage) GetPageDict() *_daa.PdfObjectDictionary

GetPageDict converts the Page to a PDF object dictionary.

func (*PdfPage) GetRotate

func (_cfebc *PdfPage) GetRotate() (int64, error)

GetRotate gets the inheritable rotate value, either from the page or a higher up page/pages struct.

func (*PdfPage) GetStructTreeRoot

func (_abedc *PdfPage) GetStructTreeRoot() (*_daa.PdfObject, bool)

GetStructRoot gets the StructTreeRoot object

func (*PdfPage) GetXObjectByName

func (_cfcd *PdfPage) GetXObjectByName(name _daa.PdfObjectName) (_daa.PdfObject, bool)

GetXObjectByName gets XObject by name.

func (*PdfPage) HasExtGState

func (_cafdda *PdfPage) HasExtGState(name _daa.PdfObjectName) bool

HasExtGState checks if ExtGState name is available.

func (*PdfPage) HasFontByName

func (_edfdc *PdfPage) HasFontByName(name _daa.PdfObjectName) bool

HasFontByName checks if has font resource by name.

func (*PdfPage) HasXObjectByName

func (_eaed *PdfPage) HasXObjectByName(name _daa.PdfObjectName) bool

HasXObjectByName checks if has XObject resource by name.

func (*PdfPage) SetAnnotations

func (_gfgda *PdfPage) SetAnnotations(annotations []*PdfAnnotation)

SetAnnotations sets the annotations list.

func (*PdfPage) SetContentStreams

func (_befbb *PdfPage) SetContentStreams(cStreams []string, encoder _daa.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) Size

func (_bcccd *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 (_degf *PdfPage) ToPdfObject() _daa.PdfObject

ToPdfObject converts the PdfPage to a dictionary within an indirect object container.

type PdfPageResources

type PdfPageResources struct {
	ExtGState  _daa.PdfObject
	ColorSpace _daa.PdfObject
	Pattern    _daa.PdfObject
	Shading    _daa.PdfObject
	XObject    _daa.PdfObject
	Font       _daa.PdfObject
	ProcSet    _daa.PdfObject
	Properties _daa.PdfObject
	// contains filtered or unexported fields
}

PdfPageResources is a Page resources model. Implements PdfModel.

func NewPdfPageResources

func NewPdfPageResources() *PdfPageResources

NewPdfPageResources returns a new PdfPageResources object.

func NewPdfPageResourcesFromDict

func NewPdfPageResourcesFromDict(dict *_daa.PdfObjectDictionary) (*PdfPageResources, error)

NewPdfPageResourcesFromDict creates and returns a new PdfPageResources object from the input dictionary.

func (*PdfPageResources) AddExtGState

func (_bgaec *PdfPageResources) AddExtGState(gsName _daa.PdfObjectName, gsDict _daa.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 (_gafe *PdfPageResources) GenerateXObjectName() _daa.PdfObjectName

GenerateXObjectName generates an unused XObject name that can be used for adding new XObjects. Uses format XObj1, XObj2, ...

func (*PdfPageResources) GetColorspaceByName

func (_fgfde *PdfPageResources) GetColorspaceByName(keyName _daa.PdfObjectName) (PdfColorspace, bool)

GetColorspaceByName returns the colorspace with the specified name from the page resources.

func (*PdfPageResources) GetColorspaces

func (_ddffe *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 (_cdga *PdfPageResources) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfPageResources) GetExtGState

func (_aaece *PdfPageResources) GetExtGState(keyName _daa.PdfObjectName) (_daa.PdfObject, bool)

GetExtGState gets the ExtGState specified by keyName. Returns a bool indicating whether it was found or not.

func (*PdfPageResources) GetFontByName

func (_decc *PdfPageResources) GetFontByName(keyName _daa.PdfObjectName) (_daa.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 (_dgaeb *PdfPageResources) GetPatternByName(keyName _daa.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 (_dgggd *PdfPageResources) GetShadingByName(keyName _daa.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 (_gdebd *PdfPageResources) GetXObjectByName(keyName _daa.PdfObjectName) (*_daa.PdfObjectStream, XObjectType)

GetXObjectByName returns the XObject with the specified keyName and the object type.

func (*PdfPageResources) GetXObjectFormByName

func (_cbacb *PdfPageResources) GetXObjectFormByName(keyName _daa.PdfObjectName) (*XObjectForm, error)

GetXObjectFormByName returns the XObjectForm with the specified name from the page resources, if it exists.

func (*PdfPageResources) GetXObjectImageByName

func (_cdcae *PdfPageResources) GetXObjectImageByName(keyName _daa.PdfObjectName) (*XObjectImage, error)

GetXObjectImageByName returns the XObjectImage with the specified name from the page resources, if it exists.

func (*PdfPageResources) HasColorspaceByName

func (_adbdbc *PdfPageResources) HasColorspaceByName(keyName _daa.PdfObjectName) bool

HasColorspaceByName checks if the colorspace with the specified name exists in the page resources.

func (*PdfPageResources) HasExtGState

func (_bcbdc *PdfPageResources) HasExtGState(keyName _daa.PdfObjectName) bool

HasExtGState checks whether a font is defined by the specified keyName.

func (*PdfPageResources) HasFontByName

func (_gecda *PdfPageResources) HasFontByName(keyName _daa.PdfObjectName) bool

HasFontByName checks whether a font is defined by the specified keyName.

func (*PdfPageResources) HasPatternByName

func (_gcege *PdfPageResources) HasPatternByName(keyName _daa.PdfObjectName) bool

HasPatternByName checks whether a pattern object is defined by the specified keyName.

func (*PdfPageResources) HasShadingByName

func (_dbadcb *PdfPageResources) HasShadingByName(keyName _daa.PdfObjectName) bool

HasShadingByName checks whether a shading is defined by the specified keyName.

func (*PdfPageResources) HasXObjectByName

func (_feeb *PdfPageResources) HasXObjectByName(keyName _daa.PdfObjectName) bool

HasXObjectByName checks if an XObject with a specified keyName is defined.

func (*PdfPageResources) SetColorSpace

func (_gfdeg *PdfPageResources) SetColorSpace(colorspace *PdfPageResourcesColorspaces)

SetColorSpace sets `r` colorspace object to `colorspace`.

func (*PdfPageResources) SetColorspaceByName

func (_gebe *PdfPageResources) SetColorspaceByName(keyName _daa.PdfObjectName, cs PdfColorspace) error

SetColorspaceByName adds the provided colorspace to the page resources.

func (*PdfPageResources) SetFontByName

func (_bgfg *PdfPageResources) SetFontByName(keyName _daa.PdfObjectName, obj _daa.PdfObject) error

SetFontByName sets the font specified by keyName to the given object.

func (*PdfPageResources) SetPatternByName

func (_aegad *PdfPageResources) SetPatternByName(keyName _daa.PdfObjectName, pattern _daa.PdfObject) error

SetPatternByName sets a pattern resource specified by keyName.

func (*PdfPageResources) SetShadingByName

func (_gedaf *PdfPageResources) SetShadingByName(keyName _daa.PdfObjectName, shadingObj _daa.PdfObject) error

SetShadingByName sets a shading resource specified by keyName.

func (*PdfPageResources) SetXObjectByName

func (_beebe *PdfPageResources) SetXObjectByName(keyName _daa.PdfObjectName, stream *_daa.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 (_agagg *PdfPageResources) SetXObjectFormByName(keyName _daa.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 (_addd *PdfPageResources) SetXObjectImageByName(keyName _daa.PdfObjectName, ximg *XObjectImage) error

SetXObjectImageByName adds the provided XObjectImage to the page resources. The added XObjectImage is identified by the specified name.

func (*PdfPageResources) ToPdfObject

func (_egcef *PdfPageResources) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the page resources.

type PdfPageResourcesColorspaces

type PdfPageResourcesColorspaces struct {
	Names       []string
	Colorspaces map[string]PdfColorspace
	// contains filtered or unexported fields
}

PdfPageResourcesColorspaces contains the colorspace in the PdfPageResources. Needs to have matching name and colorspace map entry. The Names define the order.

func NewPdfPageResourcesColorspaces

func NewPdfPageResourcesColorspaces() *PdfPageResourcesColorspaces

NewPdfPageResourcesColorspaces returns a new PdfPageResourcesColorspaces object.

func (*PdfPageResourcesColorspaces) Set

Set sets the colorspace corresponding to key. Add to Names if not set.

func (*PdfPageResourcesColorspaces) ToPdfObject

func (_dcbd *PdfPageResourcesColorspaces) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the colorspace.

type PdfPattern

type PdfPattern struct {

	// Type: Pattern
	PatternType int64
	// contains filtered or unexported fields
}

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.

func (*PdfPattern) GetAsShadingPattern

func (_dggef *PdfPattern) GetAsShadingPattern() *PdfShadingPattern

GetAsShadingPattern returns a shading pattern. Check with IsShading() prior to using this.

func (*PdfPattern) GetAsTilingPattern

func (_bfdbde *PdfPattern) GetAsTilingPattern() *PdfTilingPattern

GetAsTilingPattern returns a tiling pattern. Check with IsTiling() prior to using this.

func (*PdfPattern) GetContainingPdfObject

func (_ffad *PdfPattern) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfPattern) GetContext

func (_cbcc *PdfPattern) GetContext() PdfModel

GetContext returns a reference to the subpattern entry: either PdfTilingPattern or PdfShadingPattern.

func (*PdfPattern) IsShading

func (_cdceb *PdfPattern) IsShading() bool

IsShading specifies if the pattern is a shading pattern.

func (*PdfPattern) IsTiling

func (_efgfg *PdfPattern) IsTiling() bool

IsTiling specifies if the pattern is a tiling pattern.

func (*PdfPattern) SetContext

func (_efadg *PdfPattern) SetContext(ctx PdfModel)

SetContext sets the sub pattern (context). Either PdfTilingPattern or PdfShadingPattern.

func (*PdfPattern) ToPdfObject

func (_cbca *PdfPattern) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the pattern.

type PdfReader

type PdfReader struct {
	PageList []*PdfPage

	AcroForm *PdfAcroForm
	DSS      *DSS
	Rotate   *int64
	// contains filtered or unexported fields
}

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.

func NewPdfReader

func NewPdfReader(rs _dgg.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, *_dga.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 _dgg.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 _dgg.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 (_adde *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 (_gfgee *PdfReader) CheckAccessRights(password []byte) (bool, _eef.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 (_fdabg *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 (_bfeba *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 (_eebd *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) GetCatalogMarkInfo

func (_acggb *PdfReader) GetCatalogMarkInfo() (_daa.PdfObject, bool)

GetCatalogMarkInfo gets catalog MarkInfo object.

func (*PdfReader) GetCatalogMetadata

func (_beabc *PdfReader) GetCatalogMetadata() (_daa.PdfObject, bool)

GetCatalogMetadata gets the catalog defined XMP Metadata.

func (*PdfReader) GetCatalogStructTreeRoot

func (_cabb *PdfReader) GetCatalogStructTreeRoot() (_daa.PdfObject, bool)

GetCatalogStructTreeRoot gets the catalog StructTreeRoot object.

func (*PdfReader) GetEncryptionMethod

func (_acebg *PdfReader) GetEncryptionMethod() string

GetEncryptionMethod returns a descriptive information string about the encryption method used.

func (*PdfReader) GetIndirectObjectByNumber

func (_ccfcc *PdfReader) GetIndirectObjectByNumber(number int) (_daa.PdfObject, error)

GetIndirectObjectByNumber retrieves and returns a specific PdfObject by object number.

func (*PdfReader) GetNameDictionary

func (_fbbed *PdfReader) GetNameDictionary() (_daa.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 (_cfecc *PdfReader) GetNamedDestinations() (_daa.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 (_bdegb *PdfReader) GetNumPages() (int, error)

GetNumPages returns the number of pages in the document.

func (*PdfReader) GetOCProperties

func (_ggaff *PdfReader) GetOCProperties() (_daa.PdfObject, error)

GetOCProperties returns the optional content properties PdfObject.

func (*PdfReader) GetObjectNums

func (_edgbb *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 (_acbaee *PdfReader) GetOutlineTree() *PdfOutlineTreeNode

GetOutlineTree returns the outline tree.

func (*PdfReader) GetOutlines

func (_aefad *PdfReader) GetOutlines() (*Outline, error)

GetOutlines returns a high-level Outline object, based on the outline tree of the reader.

func (*PdfReader) GetOutlinesFlattened

func (_dcff *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 (_geff *PdfReader) GetPage(pageNumber int) (*PdfPage, error)

GetPage returns the PdfPage model for the specified page number.

func (*PdfReader) GetPageLabels

func (_dbfffg *PdfReader) GetPageLabels() (_daa.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 (_ccag *PdfReader) GetPdfInfo() (*PdfInfo, error)

GetPdfInfo returns the PDF info dictionary.

func (*PdfReader) GetPerms

func (_fcda *PdfReader) GetPerms() *Permissions

GetPerms returns the Permissions dictionary

func (*PdfReader) GetPreviousRevision

func (_fccg *PdfReader) GetPreviousRevision() (*PdfReader, error)

GetPreviousRevision returns the previous revision of PdfReader for the Pdf document

func (*PdfReader) GetRevision

func (_eddfd *PdfReader) GetRevision(revisionNumber int) (*PdfReader, error)

GetRevision returns the specific version of the PdfReader for the current Pdf document

func (*PdfReader) GetRevisionNumber

func (_gcbd *PdfReader) GetRevisionNumber() int

GetRevisionNumber returns the version of the current Pdf document

func (*PdfReader) GetTrailer

func (_dfcgg *PdfReader) GetTrailer() (*_daa.PdfObjectDictionary, error)

GetTrailer returns the PDF's trailer dictionary.

func (*PdfReader) Inspect

func (_eeafe *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 (_beed *PdfReader) IsEncrypted() (bool, error)

IsEncrypted returns true if the PDF file is encrypted.

func (*PdfReader) PageFromIndirectObject

func (_dddce *PdfReader) PageFromIndirectObject(ind *_daa.PdfIndirectObject) (*PdfPage, int, error)

PageFromIndirectObject returns the PdfPage and page number for a given indirect object.

func (*PdfReader) PdfVersion

func (_ffefb *PdfReader) PdfVersion() _daa.Version

PdfVersion returns version of the PDF file.

func (*PdfReader) RepairAcroForm

func (_aacdab *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 (_fageae *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 (_ddgg *PdfReader) ValidateSignatures(handlers []SignatureHandler) ([]SignatureValidationResult, error)

ValidateSignatures validates digital signatures in the document.

type PdfRectangle

type PdfRectangle struct {
	Llx float64
	Lly float64
	Urx float64
	Ury float64
}

PdfRectangle is a definition of a rectangle.

func NewPdfRectangle

func NewPdfRectangle(arr _daa.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 (_cbabba *PdfRectangle) Height() float64

Height returns the height of `rect`.

func (*PdfRectangle) Normalize

func (_abce *PdfRectangle) Normalize()

Normalize swaps (Llx,Urx) if Urx < Llx, and (Lly,Ury) if Ury < Lly.

func (*PdfRectangle) ToPdfObject

func (_ggcbg *PdfRectangle) ToPdfObject() _daa.PdfObject

ToPdfObject converts rectangle to a PDF object.

func (*PdfRectangle) Transform

func (_fbabbdb *PdfRectangle) Transform(transformMatrix _bg.Matrix)

Transform rectangle with the supplied matrix.

func (*PdfRectangle) Width

func (_cbdaf *PdfRectangle) Width() float64

Width returns the width of `rect`.

type PdfShading

type PdfShading struct {
	ShadingType *_daa.PdfObjectInteger
	ColorSpace  PdfColorspace
	Background  *_daa.PdfObjectArray
	BBox        *PdfRectangle
	AntiAlias   *_daa.PdfObjectBool
	// contains filtered or unexported fields
}

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.

func (*PdfShading) GetContainingPdfObject

func (_bbcfb *PdfShading) GetContainingPdfObject() _daa.PdfObject

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

func (*PdfShading) GetContext

func (_affce *PdfShading) GetContext() PdfModel

GetContext returns a reference to the subshading entry as represented by PdfShadingType1-7.

func (*PdfShading) SetContext

func (_gfffd *PdfShading) SetContext(ctx PdfModel)

SetContext set the sub annotation (context).

func (*PdfShading) ToPdfObject

func (_bbbgd *PdfShading) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingPattern

type PdfShadingPattern struct {
	*PdfPattern
	Shading   *PdfShading
	Matrix    *_daa.PdfObjectArray
	ExtGState _daa.PdfObject
}

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).

func (*PdfShadingPattern) ToPdfObject

func (_cgfcc *PdfShadingPattern) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading pattern.

type PdfShadingPatternType2

type PdfShadingPatternType2 struct {
	*PdfPattern
	Shading   *PdfShadingType2
	Matrix    *_daa.PdfObjectArray
	ExtGState _daa.PdfObject
}

PdfShadingPatternType2 is shading patterns that will use a Type 2 shading pattern (Axial).

func NewPdfShadingPatternType2

func NewPdfShadingPatternType2() *PdfShadingPatternType2

NewPdfShadingPatternType2 creates an empty shading pattern type 2 object.

func (*PdfShadingPatternType2) ToPdfObject

func (_daaca *PdfShadingPatternType2) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading pattern.

type PdfShadingPatternType3

type PdfShadingPatternType3 struct {
	*PdfPattern
	Shading   *PdfShadingType3
	Matrix    *_daa.PdfObjectArray
	ExtGState _daa.PdfObject
}

PdfShadingPatternType3 is shading patterns that will use a Type 3 shading pattern (Radial).

func NewPdfShadingPatternType3

func NewPdfShadingPatternType3() *PdfShadingPatternType3

NewPdfShadingPatternType3 creates an empty shading pattern type 3 object.

func (*PdfShadingPatternType3) ToPdfObject

func (_beaad *PdfShadingPatternType3) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading pattern.

type PdfShadingType1

type PdfShadingType1 struct {
	*PdfShading
	Domain   *_daa.PdfObjectArray
	Matrix   *_daa.PdfObjectArray
	Function []PdfFunction
}

PdfShadingType1 is a Function-based shading.

func (*PdfShadingType1) ToPdfObject

func (_cdee *PdfShadingType1) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType2

type PdfShadingType2 struct {
	*PdfShading
	Coords   *_daa.PdfObjectArray
	Domain   *_daa.PdfObjectArray
	Function []PdfFunction
	Extend   *_daa.PdfObjectArray
}

PdfShadingType2 is an Axial shading.

func NewPdfShadingType2

func NewPdfShadingType2() *PdfShadingType2

NewPdfShadingType2 creates an empty shading type 2 dictionary.

func (*PdfShadingType2) ToPdfObject

func (_ddfa *PdfShadingType2) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType3

type PdfShadingType3 struct {
	*PdfShading
	Coords   *_daa.PdfObjectArray
	Domain   *_daa.PdfObjectArray
	Function []PdfFunction
	Extend   *_daa.PdfObjectArray
}

PdfShadingType3 is a Radial shading.

func NewPdfShadingType3

func NewPdfShadingType3() *PdfShadingType3

NewPdfShadingType3 creates an empty shading type 3 dictionary.

func (*PdfShadingType3) ToPdfObject

func (_ececf *PdfShadingType3) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType4

type PdfShadingType4 struct {
	*PdfShading
	BitsPerCoordinate *_daa.PdfObjectInteger
	BitsPerComponent  *_daa.PdfObjectInteger
	BitsPerFlag       *_daa.PdfObjectInteger
	Decode            *_daa.PdfObjectArray
	Function          []PdfFunction
}

PdfShadingType4 is a Free-form Gouraud-shaded triangle mesh.

func (*PdfShadingType4) ToPdfObject

func (_daadg *PdfShadingType4) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType5

type PdfShadingType5 struct {
	*PdfShading
	BitsPerCoordinate *_daa.PdfObjectInteger
	BitsPerComponent  *_daa.PdfObjectInteger
	VerticesPerRow    *_daa.PdfObjectInteger
	Decode            *_daa.PdfObjectArray
	Function          []PdfFunction
}

PdfShadingType5 is a Lattice-form Gouraud-shaded triangle mesh.

func (*PdfShadingType5) ToPdfObject

func (_fegcg *PdfShadingType5) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType6

type PdfShadingType6 struct {
	*PdfShading
	BitsPerCoordinate *_daa.PdfObjectInteger
	BitsPerComponent  *_daa.PdfObjectInteger
	BitsPerFlag       *_daa.PdfObjectInteger
	Decode            *_daa.PdfObjectArray
	Function          []PdfFunction
}

PdfShadingType6 is a Coons patch mesh.

func (*PdfShadingType6) ToPdfObject

func (_dabcb *PdfShadingType6) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfShadingType7

type PdfShadingType7 struct {
	*PdfShading
	BitsPerCoordinate *_daa.PdfObjectInteger
	BitsPerComponent  *_daa.PdfObjectInteger
	BitsPerFlag       *_daa.PdfObjectInteger
	Decode            *_daa.PdfObjectArray
	Function          []PdfFunction
}

PdfShadingType7 is a Tensor-product patch mesh.

func (*PdfShadingType7) ToPdfObject

func (_dcfee *PdfShadingType7) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the shading dictionary.

type PdfSignature

type PdfSignature struct {
	Handler SignatureHandler

	// Type: Sig/DocTimeStamp
	Type         *_daa.PdfObjectName
	Filter       *_daa.PdfObjectName
	SubFilter    *_daa.PdfObjectName
	Contents     *_daa.PdfObjectString
	Cert         _daa.PdfObject
	ByteRange    *_daa.PdfObjectArray
	Reference    *_daa.PdfObjectArray
	Changes      *_daa.PdfObjectArray
	Name         *_daa.PdfObjectString
	M            *_daa.PdfObjectString
	Location     *_daa.PdfObjectString
	Reason       *_daa.PdfObjectString
	ContactInfo  *_daa.PdfObjectString
	R            *_daa.PdfObjectInteger
	V            *_daa.PdfObjectInteger
	PropBuild    *_daa.PdfObjectDictionary
	PropAuthTime *_daa.PdfObjectInteger
	PropAuthType *_daa.PdfObjectName
	// contains filtered or unexported fields
}

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).

func NewPdfSignature

func NewPdfSignature(handler SignatureHandler) *PdfSignature

NewPdfSignature creates a new PdfSignature object.

func (*PdfSignature) GetCerts

func (_bbad *PdfSignature) GetCerts() ([]*_e.Certificate, error)

GetCerts returns the signature certificate chain.

func (*PdfSignature) GetContainingPdfObject

func (_edfafc *PdfSignature) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfSignature) GetDocMDPPermission

func (_edfab *PdfSignature) GetDocMDPPermission() (_cg.DocMDPPermission, bool)

GetDocMDPPermission returns the DocMDP level of the restrictions

func (*PdfSignature) Initialize

func (_bfddd *PdfSignature) Initialize() error

Initialize initializes the PdfSignature.

func (*PdfSignature) SetDate

func (_gaecb *PdfSignature) SetDate(date _d.Time, format string)

SetDate sets the `M` field of the signature.

func (*PdfSignature) SetLocation

func (_fecfc *PdfSignature) SetLocation(location string)

SetLocation sets the `Location` field of the signature.

func (*PdfSignature) SetName

func (_agdfg *PdfSignature) SetName(name string)

SetName sets the `Name` field of the signature.

func (*PdfSignature) SetReason

func (_cdfb *PdfSignature) SetReason(reason string)

SetReason sets the `Reason` field of the signature.

func (*PdfSignature) ToPdfObject

func (_cdfe *PdfSignature) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfSignatureReference

type PdfSignatureReference struct {
	Type            *_daa.PdfObjectName
	TransformMethod *_daa.PdfObjectName
	TransformParams _daa.PdfObject
	Data            _daa.PdfObject
	DigestMethod    *_daa.PdfObjectName
	// contains filtered or unexported fields
}

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).

func NewPdfSignatureReferenceDocMDP

func NewPdfSignatureReferenceDocMDP(transformParams *PdfTransformParamsDocMDP) *PdfSignatureReference

NewPdfSignatureReferenceDocMDP returns PdfSignatureReference for the transformParams.

func (*PdfSignatureReference) GetContainingPdfObject

func (_bceec *PdfSignatureReference) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*PdfSignatureReference) ToPdfObject

func (_aeabg *PdfSignatureReference) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type PdfTilingPattern

type PdfTilingPattern struct {
	*PdfPattern
	PaintType  *_daa.PdfObjectInteger
	TilingType *_daa.PdfObjectInteger
	BBox       *PdfRectangle
	XStep      *_daa.PdfObjectFloat
	YStep      *_daa.PdfObjectFloat
	Resources  *PdfPageResources
	Matrix     *_daa.PdfObjectArray
}

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.

func (*PdfTilingPattern) GetContentStream

func (_affge *PdfTilingPattern) GetContentStream() ([]byte, error)

GetContentStream returns the pattern cell's content stream

func (*PdfTilingPattern) GetContentStreamWithEncoder

func (_gfcg *PdfTilingPattern) GetContentStreamWithEncoder() ([]byte, _daa.StreamEncoder, error)

GetContentStreamWithEncoder returns the pattern cell's content stream and its encoder

func (*PdfTilingPattern) IsColored

func (_egcfbe *PdfTilingPattern) IsColored() bool

IsColored specifies if the pattern is colored.

func (*PdfTilingPattern) SetContentStream

func (_dddaa *PdfTilingPattern) SetContentStream(content []byte, encoder _daa.StreamEncoder) error

SetContentStream sets the pattern cell's content stream.

func (*PdfTilingPattern) ToPdfObject

func (_gfgde *PdfTilingPattern) ToPdfObject() _daa.PdfObject

ToPdfObject returns the PDF representation of the tiling pattern.

type PdfTransformParamsDocMDP

type PdfTransformParamsDocMDP struct {
	Type *_daa.PdfObjectName
	P    *_daa.PdfObjectInteger
	V    *_daa.PdfObjectName
}

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).

func NewPdfTransformParamsDocMDP

func NewPdfTransformParamsDocMDP(permission _cg.DocMDPPermission) *PdfTransformParamsDocMDP

NewPdfTransformParamsDocMDP create a PdfTransformParamsDocMDP with the specific permissions.

func (*PdfTransformParamsDocMDP) String

func (_dcdg *PdfTransformParamsDocMDP) String() string

String returns a string representation of PdfTransformParamsDocMDP.

func (*PdfTransformParamsDocMDP) ToPdfObject

func (_dadde *PdfTransformParamsDocMDP) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

func (*PdfTransformParamsDocMDP) WriteString

func (_ecgdb *PdfTransformParamsDocMDP) WriteString() string

WriteString outputs the object as it is to be written to file.

type PdfWriter

type PdfWriter struct {
	ObjNumOffset int
	// contains filtered or unexported fields
}

PdfWriter handles outputing PDF content.

func NewPdfWriter

func NewPdfWriter() PdfWriter

NewPdfWriter initializes a new PdfWriter.

func (*PdfWriter) AddExtension

func (_fgab *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 (_fcde *PdfWriter) AddOutlineTree(outlineTree *PdfOutlineTreeNode)

AddOutlineTree adds outlines to a PDF file.

func (*PdfWriter) AddPage

func (_ccacc *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 (_gfceb *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) Encrypt

func (_gcfdc *PdfWriter) Encrypt(userPass, ownerPass []byte, options *EncryptOptions) error

Encrypt encrypts the output file with a specified user/owner password.

func (*PdfWriter) GetOptimizer

func (_cfcfa *PdfWriter) GetOptimizer() Optimizer

GetOptimizer returns current PDF optimizer.

func (*PdfWriter) GetPdfVersion

func (_cdeee *PdfWriter) GetPdfVersion() string

GetPdfVersion gets the version of the PDF used within this document.

func (*PdfWriter) GetStandardApplier

func (_ddcgg *PdfWriter) GetStandardApplier() StandardApplier

GetStandardApplier gets currently used StandardApplier..

func (*PdfWriter) GetVersion

func (_abdf *PdfWriter) GetVersion() _daa.Version

GetVersion gets the document version.

func (*PdfWriter) SetCatalogMetadata

func (_fdbec *PdfWriter) SetCatalogMetadata(meta _daa.PdfObject) error

SetCatalogMetadata sets the catalog metadata (XMP) stream object.

func (*PdfWriter) SetDocInfo

func (_cbeeab *PdfWriter) SetDocInfo(info *PdfInfo)

SetDocInfo set document info. This will overwrite any globally declared document info.

func (*PdfWriter) SetForms

func (_dabdg *PdfWriter) SetForms(form *PdfAcroForm) error

SetForms sets the Acroform for a PDF file.

func (*PdfWriter) SetNameDictionary

func (_gdaf *PdfWriter) SetNameDictionary(names _daa.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 (_cfgdd *PdfWriter) SetNamedDestinations(dests _daa.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 (_badff *PdfWriter) SetOCProperties(ocProperties _daa.PdfObject) error

SetOCProperties sets the optional content properties.

func (*PdfWriter) SetOpenAction

func (_ceggg *PdfWriter) SetOpenAction(dest _daa.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 (_ceef *PdfWriter) SetOptimizer(optimizer Optimizer)

SetOptimizer sets the optimizer to optimize PDF before writing.

func (*PdfWriter) SetPageLabels

func (_ecdbf *PdfWriter) SetPageLabels(pageLabels _daa.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 (_efcfb *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 (_geecc *PdfWriter) SetVersion(majorVersion, minorVersion int)

SetVersion sets the PDF version of the output file.

func (*PdfWriter) Write

func (_bega *PdfWriter) Write(writer _dgg.Writer) error

Write writes out the PDF.

func (*PdfWriter) WriteToFile

func (_dbbaa *PdfWriter) WriteToFile(outputFilePath string) error

WriteToFile writes the output PDF to file.

type Permissions

type Permissions struct {
	DocMDP *PdfSignature
	// contains filtered or unexported fields
}

Permissions specify a permissions dictionary (PDF 1.5). (Section 12.8.4, Table 258 - Entries in a permissions dictionary p. 477 in PDF32000_2008).

func NewPermissions

func NewPermissions(docMdp *PdfSignature) *Permissions

NewPermissions returns a new permissions object.

func (*Permissions) GetContainingPdfObject

func (_cegcd *Permissions) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject implements interface PdfModel.

func (*Permissions) ToPdfObject

func (_aabfgc *Permissions) ToPdfObject() _daa.PdfObject

ToPdfObject implements interface PdfModel.

type ReaderOpts

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
}

ReaderOpts defines options for creating PdfReader instances.

func NewReaderOpts

func NewReaderOpts() *ReaderOpts

NewReaderOpts generates a default `ReaderOpts` instance.

type ReaderToWriterOpts

type ReaderToWriterOpts struct {
	SkipAcroForm        bool
	SkipInfo            bool
	SkipNameDictionary  bool
	SkipNamedDests      bool
	SkipOCProperties    bool
	SkipOutlines        bool
	SkipPageLabels      bool
	SkipRotation        bool
	SkipMetadata        bool
	PageProcessCallback PageProcessCallback

	// Deprecated: will be removed in v4. Use PageProcessCallback instead.
	PageCallback PageCallback
}

ReaderToWriterOpts options used to generate a PdfWriter.

type SignatureHandler

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(_dabgg *PdfSignature) bool

	// Validate validates a PDF signature against a given digest (hash) such as that determined
	// for an input file. Returns validation results.
	Validate(_dabgff *PdfSignature, _gcgcd 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(_bbcef *PdfSignature) error

	// NewDigest creates a new digest/hasher based on the signature dictionary and handler.
	NewDigest(_aecb *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(_cdccg *PdfSignature, _eaca Hasher) error
}

SignatureHandler interface defines the common functionality for PDF signature handlers, which need to be capable of validating digital signatures and signing PDF documents.

type SignatureHandlerDocMDP

type SignatureHandlerDocMDP interface {
	SignatureHandler

	// ValidateWithOpts validates a PDF signature by checking PdfReader or PdfParser
	// ValidateWithOpts shall contain Validate call
	ValidateWithOpts(_bgaad *PdfSignature, _fdggd Hasher, _bfdcd SignatureHandlerDocMDPParams) (SignatureValidationResult, error)
}

SignatureHandlerDocMDP extends SignatureHandler with the ValidateWithOpts method for checking the DocMDP policy.

type SignatureHandlerDocMDPParams

type SignatureHandlerDocMDPParams struct {
	Parser     *_daa.PdfParser
	DiffPolicy _cg.DiffPolicy
}

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 SignatureValidationResult

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 *_cg.DiffResults

	// GeneralizedTime is the time at which the time-stamp token has been created by the TSA (RFC 3161).
	GeneralizedTime _d.Time
}

SignatureValidationResult defines the response from the signature validation handler.

func (SignatureValidationResult) String

func (_aaacfc SignatureValidationResult) String() string

type StandardApplier

type StandardApplier interface {
	ApplyStandard(_eabad *_cbe.Document) error
}

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 StandardImplementer

type StandardImplementer interface {
	StandardValidator
	StandardApplier

	// StandardName gets the human-readable name of the standard.
	StandardName() string
}

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 StandardValidator

type StandardValidator interface {

	// ValidateStandard checks if the input reader
	ValidateStandard(_afgfcg *CompliancePdfReader) error
}

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 StdFontName

type StdFontName = _ec.StdFontName

StdFontName represents name of a standard font.

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.

func (*VRI) ToPdfObject

func (_ddea *VRI) ToPdfObject() *_daa.PdfObjectDictionary

ToPdfObject returns the PDF representation of the VRI dictionary.

type VariableText

type VariableText struct {
	DA *_daa.PdfObjectString
	Q  *_daa.PdfObjectInteger
	DS *_daa.PdfObjectString
	RV _daa.PdfObject
}

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 WatermarkImageOptions

type WatermarkImageOptions struct {
	Alpha               float64
	FitToWidth          bool
	PreserveAspectRatio bool
}

WatermarkImageOptions contains options for configuring the watermark process.

type XObjectForm

type XObjectForm struct {
	Filter        _daa.StreamEncoder
	FormType      _daa.PdfObject
	BBox          _daa.PdfObject
	Matrix        _daa.PdfObject
	Resources     *PdfPageResources
	Group         _daa.PdfObject
	Ref           _daa.PdfObject
	MetaData      _daa.PdfObject
	PieceInfo     _daa.PdfObject
	LastModified  _daa.PdfObject
	StructParent  _daa.PdfObject
	StructParents _daa.PdfObject
	OPI           _daa.PdfObject
	OC            _daa.PdfObject
	Name          _daa.PdfObject

	// Stream data.
	Stream []byte
	// contains filtered or unexported fields
}

XObjectForm (Table 95 in 8.10.2).

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 *_daa.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 (_gdcce *XObjectForm) GetContainingPdfObject() _daa.PdfObject

GetContainingPdfObject returns the XObject Form's containing object (indirect object).

func (*XObjectForm) GetContentStream

func (_gefad *XObjectForm) GetContentStream() ([]byte, error)

GetContentStream returns the XObject Form's content stream.

func (*XObjectForm) SetContentStream

func (_fgea *XObjectForm) SetContentStream(content []byte, encoder _daa.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 (_egfbc *XObjectForm) ToPdfObject() _daa.PdfObject

ToPdfObject returns a stream object.

type XObjectImage

type XObjectImage struct {

	// ColorSpace       PdfObject
	Width            *int64
	Height           *int64
	ColorSpace       PdfColorspace
	BitsPerComponent *int64
	Filter           _daa.StreamEncoder
	Intent           _daa.PdfObject
	ImageMask        _daa.PdfObject
	Mask             _daa.PdfObject
	Matte            _daa.PdfObject
	Decode           _daa.PdfObject
	Interpolate      _daa.PdfObject
	Alternatives     _daa.PdfObject
	SMask            _daa.PdfObject
	SMaskInData      _daa.PdfObject
	Name             _daa.PdfObject
	StructParent     _daa.PdfObject
	ID               _daa.PdfObject
	OPI              _daa.PdfObject
	Metadata         _daa.PdfObject
	OC               _daa.PdfObject
	Stream           []byte
	// contains filtered or unexported fields
}

XObjectImage (Table 89 in 8.9.5.1). Implements PdfModel interface.

func NewXObjectImage

func NewXObjectImage() *XObjectImage

NewXObjectImage returns a new XObjectImage.

func NewXObjectImageFromImage

func NewXObjectImageFromImage(img *Image, cs PdfColorspace, encoder _daa.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 NewXObjectImageFromStream

func NewXObjectImageFromStream(stream *_daa.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 _daa.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 (_adad *XObjectImage) GetContainingPdfObject() _daa.PdfObject

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

func (*XObjectImage) SetFilter

func (_egcfba *XObjectImage) SetFilter(encoder _daa.StreamEncoder) error

SetFilter sets compression filter. Decodes with current filter sets and encodes the data with the new filter.

func (*XObjectImage) SetImage

func (_fffeb *XObjectImage) SetImage(img *Image, cs PdfColorspace) error

SetImage updates XObject Image with new image data.

func (*XObjectImage) ToImage

func (_cagfa *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 (_aagag *XObjectImage) ToPdfObject() _daa.PdfObject

ToPdfObject returns a stream object.

type XObjectType

type XObjectType int

XObjectType represents the type of an XObject.

const (
	XObjectTypeUndefined XObjectType = iota
	XObjectTypeImage
	XObjectTypeForm
	XObjectTypePS
	XObjectTypeUnknown
)

Directories

Path Synopsis
internal
tests
Package tests provides integration tests for the UniPDF optimizer.
Package tests provides integration tests for the UniPDF optimizer.
Package pdfa provides abstraction to optimize and verify documents with respect to the PDF/A standards.
Package pdfa provides abstraction to optimize and verify documents with respect to the PDF/A standards.
Package sighandler implements digital signature handlers for PDF signature validation and signing.
Package sighandler implements digital signature handlers for PDF signature validation and signing.
Package xmputil provides abstraction used by the pdf document XMP Metadata.
Package xmputil provides abstraction used by the pdf document XMP Metadata.

Jump to

Keyboard shortcuts

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