Documentation ¶
Overview ¶
The model package provides a convenient interface for reading, writing and working with PDF files. The package includes many high level PDF data models which can be used to access information or modifications. It is based on the core package which handles core functionality such as file i/o, parsing and handling of primitive PDF objects.
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 ¶
- Variables
- func SetImageHandler(imgHandling ImageHandler)
- func SetPdfCreator(creator string)
- type AlphaMapFunc
- type BorderEffect
- type BorderStyle
- type DefaultImageHandler
- type EncryptOptions
- type Image
- type ImageHandler
- type ModelManager
- type PdfAcroForm
- type PdfAnnotation
- type PdfAnnotation3D
- type PdfAnnotationCaret
- type PdfAnnotationCircle
- type PdfAnnotationFileAttachment
- type PdfAnnotationFreeText
- type PdfAnnotationHighlight
- type PdfAnnotationInk
- type PdfAnnotationLine
- type PdfAnnotationLink
- type PdfAnnotationMarkup
- type PdfAnnotationMovie
- type PdfAnnotationPolyLine
- type PdfAnnotationPolygon
- type PdfAnnotationPopup
- type PdfAnnotationPrinterMark
- type PdfAnnotationProjection
- type PdfAnnotationRedact
- type PdfAnnotationRichMedia
- type PdfAnnotationScreen
- type PdfAnnotationSound
- type PdfAnnotationSquare
- type PdfAnnotationSquiggly
- type PdfAnnotationStamp
- type PdfAnnotationStrikeOut
- type PdfAnnotationText
- type PdfAnnotationTrapNet
- type PdfAnnotationUnderline
- type PdfAnnotationWatermark
- type PdfAnnotationWidget
- type PdfBorderEffect
- type PdfBorderStyle
- type PdfColor
- type PdfColorCalGray
- type PdfColorCalRGB
- type PdfColorDeviceCMYK
- type PdfColorDeviceGray
- type PdfColorDeviceRGB
- func (this *PdfColorDeviceRGB) B() float64
- func (this *PdfColorDeviceRGB) G() float64
- func (this *PdfColorDeviceRGB) GetNumComponents() int
- func (this *PdfColorDeviceRGB) R() float64
- func (this *PdfColorDeviceRGB) ToGray() *PdfColorDeviceGray
- func (this *PdfColorDeviceRGB) ToInteger(bits int) [3]uint32
- type PdfColorLab
- type PdfColorPattern
- type PdfColorspace
- type PdfColorspaceCalGray
- func (this *PdfColorspaceCalGray) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceCalGray) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceCalGray) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceCalGray) DecodeArray() []float64
- func (this *PdfColorspaceCalGray) GetNumComponents() int
- func (this *PdfColorspaceCalGray) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceCalGray) String() string
- func (this *PdfColorspaceCalGray) ToPdfObject() PdfObject
- type PdfColorspaceCalRGB
- func (this *PdfColorspaceCalRGB) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceCalRGB) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceCalRGB) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceCalRGB) DecodeArray() []float64
- func (this *PdfColorspaceCalRGB) GetNumComponents() int
- func (this *PdfColorspaceCalRGB) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceCalRGB) String() string
- func (this *PdfColorspaceCalRGB) ToPdfObject() PdfObject
- type PdfColorspaceDeviceCMYK
- func (this *PdfColorspaceDeviceCMYK) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceDeviceCMYK) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceDeviceCMYK) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceDeviceCMYK) DecodeArray() []float64
- func (this *PdfColorspaceDeviceCMYK) GetNumComponents() int
- func (this *PdfColorspaceDeviceCMYK) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceDeviceCMYK) String() string
- func (this *PdfColorspaceDeviceCMYK) ToPdfObject() PdfObject
- type PdfColorspaceDeviceGray
- func (this *PdfColorspaceDeviceGray) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceDeviceGray) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceDeviceGray) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceDeviceGray) DecodeArray() []float64
- func (this *PdfColorspaceDeviceGray) GetNumComponents() int
- func (this *PdfColorspaceDeviceGray) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceDeviceGray) String() string
- func (this *PdfColorspaceDeviceGray) ToPdfObject() PdfObject
- type PdfColorspaceDeviceN
- func (this *PdfColorspaceDeviceN) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceDeviceN) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceDeviceN) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceDeviceN) DecodeArray() []float64
- func (this *PdfColorspaceDeviceN) GetNumComponents() int
- func (this *PdfColorspaceDeviceN) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceDeviceN) String() string
- func (this *PdfColorspaceDeviceN) ToPdfObject() PdfObject
- type PdfColorspaceDeviceNAttributes
- type PdfColorspaceDeviceRGB
- func (this *PdfColorspaceDeviceRGB) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceDeviceRGB) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceDeviceRGB) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceDeviceRGB) DecodeArray() []float64
- func (this *PdfColorspaceDeviceRGB) GetNumComponents() int
- func (this *PdfColorspaceDeviceRGB) ImageToGray(img Image) (Image, error)
- func (this *PdfColorspaceDeviceRGB) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceDeviceRGB) String() string
- func (this *PdfColorspaceDeviceRGB) ToPdfObject() PdfObject
- type PdfColorspaceICCBased
- func (this *PdfColorspaceICCBased) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceICCBased) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceICCBased) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceICCBased) DecodeArray() []float64
- func (this *PdfColorspaceICCBased) GetNumComponents() int
- func (this *PdfColorspaceICCBased) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceICCBased) String() string
- func (this *PdfColorspaceICCBased) ToPdfObject() PdfObject
- type PdfColorspaceLab
- func (this *PdfColorspaceLab) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceLab) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceLab) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceLab) DecodeArray() []float64
- func (this *PdfColorspaceLab) GetNumComponents() int
- func (this *PdfColorspaceLab) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceLab) String() string
- func (this *PdfColorspaceLab) ToPdfObject() PdfObject
- type PdfColorspaceSpecialIndexed
- func (this *PdfColorspaceSpecialIndexed) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceSpecialIndexed) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceSpecialIndexed) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceSpecialIndexed) DecodeArray() []float64
- func (this *PdfColorspaceSpecialIndexed) GetNumComponents() int
- func (this *PdfColorspaceSpecialIndexed) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceSpecialIndexed) String() string
- func (this *PdfColorspaceSpecialIndexed) ToPdfObject() PdfObject
- type PdfColorspaceSpecialPattern
- func (this *PdfColorspaceSpecialPattern) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceSpecialPattern) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceSpecialPattern) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceSpecialPattern) DecodeArray() []float64
- func (this *PdfColorspaceSpecialPattern) GetNumComponents() int
- func (this *PdfColorspaceSpecialPattern) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceSpecialPattern) String() string
- func (this *PdfColorspaceSpecialPattern) ToPdfObject() PdfObject
- type PdfColorspaceSpecialSeparation
- func (this *PdfColorspaceSpecialSeparation) ColorFromFloats(vals []float64) (PdfColor, error)
- func (this *PdfColorspaceSpecialSeparation) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
- func (this *PdfColorspaceSpecialSeparation) ColorToRGB(color PdfColor) (PdfColor, error)
- func (this *PdfColorspaceSpecialSeparation) DecodeArray() []float64
- func (this *PdfColorspaceSpecialSeparation) GetNumComponents() int
- func (this *PdfColorspaceSpecialSeparation) ImageToRGB(img Image) (Image, error)
- func (this *PdfColorspaceSpecialSeparation) String() string
- func (this *PdfColorspaceSpecialSeparation) ToPdfObject() PdfObject
- type PdfDate
- type PdfField
- type PdfFont
- type PdfFontDescriptor
- type PdfFunction
- type PdfFunctionType0
- type PdfFunctionType2
- type PdfFunctionType3
- type PdfFunctionType4
- type PdfModel
- type PdfOutline
- type PdfOutlineItem
- type PdfOutlineTreeNode
- type PdfPage
- func (this *PdfPage) AddContentStreamByString(contentStr string)
- func (this *PdfPage) AddExtGState(name PdfObjectName, egs *PdfObjectDictionary) error
- func (this *PdfPage) AddFont(name PdfObjectName, font PdfObject) error
- func (this *PdfPage) AddImageResource(name PdfObjectName, ximg *XObjectImage) error
- func (this *PdfPage) AddWatermarkImage(ximg *XObjectImage, opt WatermarkImageOptions) error
- func (this *PdfPage) Duplicate() *PdfPage
- func (this *PdfPage) GetAllContentStreams() (string, error)
- func (this *PdfPage) GetContainingPdfObject() PdfObject
- func (this *PdfPage) GetContentStreams() ([]string, error)
- func (this *PdfPage) GetMediaBox() (*PdfRectangle, error)
- func (this *PdfPage) GetPageAsIndirectObject() *PdfIndirectObject
- func (this *PdfPage) GetPageDict() *PdfObjectDictionary
- func (this *PdfPage) GetXObjectByName(name PdfObjectName) (PdfObject, bool)
- func (this *PdfPage) HasExtGState(name PdfObjectName) bool
- func (this *PdfPage) HasFontByName(name PdfObjectName) bool
- func (this *PdfPage) HasXObjectByName(name PdfObjectName) bool
- func (this *PdfPage) SetContentStreams(cStreams []string, encoder StreamEncoder) error
- func (this *PdfPage) ToPdfObject() PdfObject
- type PdfPageResources
- func (r *PdfPageResources) AddExtGState(gsName PdfObjectName, gsDict PdfObject) error
- func (r *PdfPageResources) GetColorspaceByName(keyName PdfObjectName) (PdfColorspace, bool)
- func (r *PdfPageResources) GetContainingPdfObject() PdfObject
- func (r *PdfPageResources) GetExtGState(keyName PdfObjectName) (PdfObject, bool)
- func (r *PdfPageResources) GetFontByName(keyName PdfObjectName) (PdfObject, bool)
- func (r *PdfPageResources) GetPatternByName(keyName PdfObjectName) (*PdfPattern, bool)
- func (r *PdfPageResources) GetShadingByName(keyName PdfObjectName) (*PdfShading, bool)
- func (r *PdfPageResources) GetXObjectByName(keyName PdfObjectName) (*PdfObjectStream, XObjectType)
- func (r *PdfPageResources) GetXObjectFormByName(keyName PdfObjectName) (*XObjectForm, error)
- func (r *PdfPageResources) GetXObjectImageByName(keyName PdfObjectName) (*XObjectImage, error)
- func (r *PdfPageResources) HasColorspaceByName(keyName PdfObjectName) bool
- func (r *PdfPageResources) HasExtGState(keyName PdfObjectName) bool
- func (r *PdfPageResources) HasFontByName(keyName PdfObjectName) bool
- func (r *PdfPageResources) HasXObjectByName(keyName PdfObjectName) bool
- func (r *PdfPageResources) SetColorspaceByName(keyName PdfObjectName, cs PdfColorspace) error
- func (r *PdfPageResources) SetFontByName(keyName PdfObjectName, obj PdfObject) error
- func (r *PdfPageResources) SetPatternByName(keyName PdfObjectName, pattern PdfObject) error
- func (r *PdfPageResources) SetShadingByName(keyName PdfObjectName, shadingObj PdfObject) error
- func (r *PdfPageResources) SetXObjectByName(keyName PdfObjectName, stream *PdfObjectStream) error
- func (r *PdfPageResources) SetXObjectFormByName(keyName PdfObjectName, xform *XObjectForm) error
- func (r *PdfPageResources) SetXObjectImageByName(keyName PdfObjectName, ximg *XObjectImage) error
- func (r *PdfPageResources) ToPdfObject() PdfObject
- type PdfPageResourcesColorspaces
- type PdfPattern
- func (this *PdfPattern) GetAsShadingPattern() *PdfShadingPattern
- func (this *PdfPattern) GetAsTilingPattern() *PdfTilingPattern
- func (this *PdfPattern) GetContainingPdfObject() PdfObject
- func (this *PdfPattern) GetContext() PdfModel
- func (this *PdfPattern) IsShading() bool
- func (this *PdfPattern) IsTiling() bool
- func (this *PdfPattern) SetContext(ctx PdfModel)
- func (this *PdfPattern) ToPdfObject() PdfObject
- type PdfReader
- func (this *PdfReader) CheckAccessRights(password []byte) (bool, AccessPermissions, error)
- func (this *PdfReader) Decrypt(password []byte) (bool, error)
- func (this *PdfReader) GetEncryptionMethod() string
- func (this *PdfReader) GetIndirectObjectByNumber(number int) (PdfObject, error)
- func (this *PdfReader) GetNumPages() (int, error)
- func (this *PdfReader) GetOCProperties() (PdfObject, error)
- func (r *PdfReader) GetObjectNums() []int
- func (this *PdfReader) GetOutlineTree() *PdfOutlineTreeNode
- func (this *PdfReader) GetOutlinesFlattened() ([]*PdfOutlineTreeNode, []string, error)
- func (this *PdfReader) GetPage(pageNumber int) (*PdfPage, error)
- func (this *PdfReader) GetPageAsIndirectObject(pageNumber int) (PdfObject, error)
- func (this *PdfReader) GetTrailer() (*PdfObjectDictionary, error)
- func (this *PdfReader) Inspect() (map[string]int, error)
- func (this *PdfReader) IsEncrypted() (bool, error)
- func (reader *PdfReader) LoadAnnotations(d *PdfObjectDictionary) ([]*PdfAnnotation, error)
- type PdfRectangle
- type PdfShading
- type PdfShadingPattern
- type PdfShadingType1
- type PdfShadingType2
- type PdfShadingType3
- type PdfShadingType4
- type PdfShadingType5
- type PdfShadingType6
- type PdfShadingType7
- type PdfTilingPattern
- func (this *PdfTilingPattern) GetContentStream() ([]byte, error)
- func (this *PdfTilingPattern) GetContentStreamWithEncoder() ([]byte, StreamEncoder, error)
- func (this *PdfTilingPattern) IsColored() bool
- func (this *PdfTilingPattern) SetContentStream(content []byte, encoder StreamEncoder) error
- func (this *PdfTilingPattern) ToPdfObject() PdfObject
- type PdfValue
- type PdfWriter
- func (this *PdfWriter) AddOutlineTree(outlineTree *PdfOutlineTreeNode)
- func (this *PdfWriter) AddPage(page *PdfPage) error
- func (this *PdfWriter) Encrypt(userPass, ownerPass []byte, options *EncryptOptions) error
- func (this *PdfWriter) SetForms(form *PdfAcroForm) error
- func (this *PdfWriter) SetOCProperties(ocProperties PdfObject) error
- func (this *PdfWriter) SetVersion(majorVersion, minorVersion int)
- func (this *PdfWriter) Write(ws io.WriteSeeker) error
- type WatermarkImageOptions
- type XObjectForm
- type XObjectImage
- func NewXObjectImage() *XObjectImage
- func NewXObjectImageFromImage(img *Image, cs PdfColorspace, encoder StreamEncoder) (*XObjectImage, error)
- func NewXObjectImageFromStream(stream *PdfObjectStream) (*XObjectImage, error)
- func UpdateXObjectImageFromImage(xobjIn *XObjectImage, img *Image, cs PdfColorspace, encoder StreamEncoder) (*XObjectImage, error)
- type XObjectType
Constants ¶
This section is empty.
Variables ¶
var ( ErrRequiredAttributeMissing = errors.New("Required attribute missing") ErrInvalidAttribute = errors.New("Invalid attribute") ErrTypeError = errors.New("Type check error") ErrRangeError = errors.New("Range check error") )
var ErrTypeCheck = errors.New("Type check error")
Functions ¶
func SetImageHandler ¶
func SetImageHandler(imgHandling ImageHandler)
func SetPdfCreator ¶
func SetPdfCreator(creator string)
Types ¶
type AlphaMapFunc ¶
Threshold alpha channel. Set all alpha values below threshold to transparent.
type BorderEffect ¶
type BorderEffect int
Border effect
const ( BorderEffectNoEffect BorderEffect = iota BorderEffectCloudy BorderEffect = iota )
type BorderStyle ¶
type BorderStyle int
const ( BorderStyleSolid BorderStyle = iota BorderStyleDashed BorderStyle = iota BorderStyleBeveled BorderStyle = iota BorderStyleInset BorderStyle = iota BorderStyleUnderline BorderStyle = iota )
func (*BorderStyle) GetPdfName ¶
func (this *BorderStyle) GetPdfName() string
type DefaultImageHandler ¶
type DefaultImageHandler struct{}
func (DefaultImageHandler) Compress ¶
func (this DefaultImageHandler) Compress(input *Image, quality int64) (*Image, error)
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) NewImageFromGoImage ¶
func (this DefaultImageHandler) NewImageFromGoImage(goimg goimage.Image) (*Image, error)
Create a unidoc Image from a golang Image.
type EncryptOptions ¶
type EncryptOptions struct {
Permissions AccessPermissions
}
type Image ¶
type Image struct { Width int64 // The width of the image in samples Height int64 // The height of the image in samples BitsPerComponent int64 // The number of bits per color component ColorComponents int // Color components per pixel Data []byte // Image data stored as bytes. // contains filtered or unexported fields }
Basic representation of an image. The colorspace is not specified, but must be known when handling the image.
func (Image) AlphaMap ¶
func (this Image) AlphaMap(mapFunc AlphaMapFunc)
Allow mapping of alpha data for transformations. Can allow custom filtering of alpha data etc.
func (*Image) GetSamples ¶
Convert 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.
func (*Image) Resample ¶
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) SetSamples ¶
Convert samples to byte-data.
type ImageHandler ¶
type ImageHandler interface { // Read any image type and load into a new Image object. Read(r io.Reader) (*Image, error) // Load a unidoc Image from a standard Go image structure. NewImageFromGoImage(goimg goimage.Image) (*Image, error) // Compress an image. Compress(input *Image, quality int64) (*Image, error) }
The 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 ModelManager ¶
type ModelManager struct {
// contains filtered or unexported fields
}
The model manager is used to cache Primitive <-> Model mappings where needed. In many cases only Model -> Primitive mapping is needed and only a reference to the Primitive is stored in the Model. In some cases, the Model needs to be found from the Primitive, and that is where the ModelManager can be used (in both directions).
Note that it is not always used, the Primitive <-> Model mapping needs to be registered for each time it is used. Thus, it is only used for special cases, commonly where the same object is used by two higher level objects. (Example PDF Widgets owned by both Page Annotations, and the interactive form - AcroForm).
func NewModelManager ¶
func NewModelManager() *ModelManager
func (*ModelManager) GetModelFromPrimitive ¶
func (this *ModelManager) GetModelFromPrimitive(primitive PdfObject) PdfModel
func (*ModelManager) GetPrimitiveFromModel ¶
func (this *ModelManager) GetPrimitiveFromModel(model PdfModel) PdfObject
func (*ModelManager) Register ¶
func (this *ModelManager) Register(primitive PdfObject, model PdfModel)
Register (cache) a model to primitive relationship.
type PdfAcroForm ¶
type PdfAcroForm struct { Fields *[]*PdfField NeedAppearances *PdfObjectBool SigFlags *PdfObjectInteger CO *PdfObjectArray DR *PdfPageResources DA *PdfObjectString Q *PdfObjectInteger XFA PdfObject // contains filtered or unexported fields }
High level manipulation of forms (AcroForm).
func NewPdfAcroForm ¶
func NewPdfAcroForm() *PdfAcroForm
func (*PdfAcroForm) GetContainingPdfObject ¶
func (this *PdfAcroForm) GetContainingPdfObject() PdfObject
func (*PdfAcroForm) ToPdfObject ¶
func (this *PdfAcroForm) ToPdfObject() PdfObject
type PdfAnnotation ¶
type PdfAnnotation struct { Rect PdfObject Contents PdfObject P PdfObject // Reference to page object. NM PdfObject M PdfObject F PdfObject AP PdfObject AS PdfObject Border PdfObject C PdfObject StructParent PdfObject OC PdfObject // contains filtered or unexported fields }
PDFAnnotation contains common attributes of an annotation. The context object contains the subannotation, which can be a markup annotation or other types.
func NewPdfAnnotation ¶
func NewPdfAnnotation() *PdfAnnotation
Construct a new PDF annotation model and initializes the underlying PDF primitive.
func (*PdfAnnotation) GetContainingPdfObject ¶
func (this *PdfAnnotation) GetContainingPdfObject() PdfObject
func (*PdfAnnotation) GetContext ¶
func (this *PdfAnnotation) GetContext() PdfModel
Context in this case is a reference to the subannotation.
func (*PdfAnnotation) SetContext ¶
func (this *PdfAnnotation) SetContext(ctx PdfModel)
Set the sub annotation (context).
func (*PdfAnnotation) String ¶
func (this *PdfAnnotation) String() string
func (*PdfAnnotation) ToPdfObject ¶
func (this *PdfAnnotation) ToPdfObject() PdfObject
Note: Call the sub-annotation's ToPdfObject to set both the generic and non-generic information. TODO/FIXME: Consider doing it here instead.
type PdfAnnotation3D ¶
type PdfAnnotation3D struct { *PdfAnnotation T3DD PdfObject T3DV PdfObject T3DA PdfObject T3DI PdfObject T3DB PdfObject }
Subtype: 3D
func (*PdfAnnotation3D) ToPdfObject ¶
func (this *PdfAnnotation3D) ToPdfObject() PdfObject
type PdfAnnotationCaret ¶
type PdfAnnotationCaret struct { *PdfAnnotation *PdfAnnotationMarkup RD PdfObject Sy PdfObject }
Subtype: Caret
func NewPdfAnnotationCaret ¶
func NewPdfAnnotationCaret() *PdfAnnotationCaret
Create a new caret annotation.
func (*PdfAnnotationCaret) ToPdfObject ¶
func (this *PdfAnnotationCaret) ToPdfObject() PdfObject
type PdfAnnotationCircle ¶
type PdfAnnotationCircle struct { *PdfAnnotation *PdfAnnotationMarkup BS PdfObject IC PdfObject BE PdfObject RD PdfObject }
Subtype: Circle
func NewPdfAnnotationCircle ¶
func NewPdfAnnotationCircle() *PdfAnnotationCircle
Create a new circle annotation.
func (*PdfAnnotationCircle) ToPdfObject ¶
func (this *PdfAnnotationCircle) ToPdfObject() PdfObject
type PdfAnnotationFileAttachment ¶
type PdfAnnotationFileAttachment struct { *PdfAnnotation *PdfAnnotationMarkup FS PdfObject Name PdfObject }
Subtype: FileAttachment
func NewPdfAnnotationFileAttachment ¶
func NewPdfAnnotationFileAttachment() *PdfAnnotationFileAttachment
Create a new file attachment annotation.
func (*PdfAnnotationFileAttachment) ToPdfObject ¶
func (this *PdfAnnotationFileAttachment) ToPdfObject() PdfObject
type PdfAnnotationFreeText ¶
type PdfAnnotationFreeText struct { *PdfAnnotation *PdfAnnotationMarkup DA PdfObject Q PdfObject RC PdfObject DS PdfObject CL PdfObject IT PdfObject BE PdfObject RD PdfObject BS PdfObject LE PdfObject }
Subtype: FreeText
func NewPdfAnnotationFreeText ¶
func NewPdfAnnotationFreeText() *PdfAnnotationFreeText
Create a new free text annotation.
func (*PdfAnnotationFreeText) ToPdfObject ¶
func (this *PdfAnnotationFreeText) ToPdfObject() PdfObject
type PdfAnnotationHighlight ¶
type PdfAnnotationHighlight struct { *PdfAnnotation *PdfAnnotationMarkup QuadPoints PdfObject }
Subtype: Highlight
func NewPdfAnnotationHighlight ¶
func NewPdfAnnotationHighlight() *PdfAnnotationHighlight
Create a new text highlight annotation.
func (*PdfAnnotationHighlight) ToPdfObject ¶
func (this *PdfAnnotationHighlight) ToPdfObject() PdfObject
type PdfAnnotationInk ¶
type PdfAnnotationInk struct { *PdfAnnotation *PdfAnnotationMarkup InkList PdfObject BS PdfObject }
Subtype: Ink
func NewPdfAnnotationInk ¶
func NewPdfAnnotationInk() *PdfAnnotationInk
Create a new ink annotation.
func (*PdfAnnotationInk) ToPdfObject ¶
func (this *PdfAnnotationInk) ToPdfObject() PdfObject
type PdfAnnotationLine ¶
type PdfAnnotationLine struct { *PdfAnnotation *PdfAnnotationMarkup L PdfObject BS PdfObject LE PdfObject IC PdfObject LL PdfObject LLE PdfObject Cap PdfObject IT PdfObject LLO PdfObject CP PdfObject Measure PdfObject CO PdfObject }
Subtype: Line
func NewPdfAnnotationLine ¶
func NewPdfAnnotationLine() *PdfAnnotationLine
Create a new line annotation.
func (*PdfAnnotationLine) ToPdfObject ¶
func (this *PdfAnnotationLine) ToPdfObject() PdfObject
type PdfAnnotationLink ¶
type PdfAnnotationLink struct { *PdfAnnotation A PdfObject Dest PdfObject H PdfObject PA PdfObject QuadPoints PdfObject BS PdfObject }
Subtype: Link
func NewPdfAnnotationLink ¶
func NewPdfAnnotationLink() *PdfAnnotationLink
Create a new link annotation.
func (*PdfAnnotationLink) ToPdfObject ¶
func (this *PdfAnnotationLink) ToPdfObject() PdfObject
type PdfAnnotationMarkup ¶
type PdfAnnotationMarkup struct { T PdfObject Popup *PdfAnnotationPopup CA PdfObject RC PdfObject CreationDate PdfObject IRT PdfObject Subj PdfObject RT PdfObject IT PdfObject ExData PdfObject }
Additional elements for mark-up annotations.
type PdfAnnotationMovie ¶
type PdfAnnotationMovie struct { *PdfAnnotation T PdfObject Movie PdfObject A PdfObject }
Subtype: Movie
func NewPdfAnnotationMovie ¶
func NewPdfAnnotationMovie() *PdfAnnotationMovie
Create a new movie annotation.
func (*PdfAnnotationMovie) ToPdfObject ¶
func (this *PdfAnnotationMovie) ToPdfObject() PdfObject
type PdfAnnotationPolyLine ¶
type PdfAnnotationPolyLine struct { *PdfAnnotation *PdfAnnotationMarkup Vertices PdfObject LE PdfObject BS PdfObject IC PdfObject BE PdfObject IT PdfObject Measure PdfObject }
Subtype: PolyLine
func NewPdfAnnotationPolyLine ¶
func NewPdfAnnotationPolyLine() *PdfAnnotationPolyLine
Create a new polyline annotation.
func (*PdfAnnotationPolyLine) ToPdfObject ¶
func (this *PdfAnnotationPolyLine) ToPdfObject() PdfObject
type PdfAnnotationPolygon ¶
type PdfAnnotationPolygon struct { *PdfAnnotation *PdfAnnotationMarkup Vertices PdfObject LE PdfObject BS PdfObject IC PdfObject BE PdfObject IT PdfObject Measure PdfObject }
Subtype: Polygon
func NewPdfAnnotationPolygon ¶
func NewPdfAnnotationPolygon() *PdfAnnotationPolygon
Create a new polygon annotation.
func (*PdfAnnotationPolygon) ToPdfObject ¶
func (this *PdfAnnotationPolygon) ToPdfObject() PdfObject
type PdfAnnotationPopup ¶
type PdfAnnotationPopup struct { *PdfAnnotation Parent PdfObject Open PdfObject }
Subtype: Popup
func NewPdfAnnotationPopup ¶
func NewPdfAnnotationPopup() *PdfAnnotationPopup
Create a new popup annotation.
func (*PdfAnnotationPopup) ToPdfObject ¶
func (this *PdfAnnotationPopup) ToPdfObject() PdfObject
type PdfAnnotationPrinterMark ¶
type PdfAnnotationPrinterMark struct { *PdfAnnotation MN PdfObject }
Subtype: PrinterMark
func NewPdfAnnotationPrinterMark ¶
func NewPdfAnnotationPrinterMark() *PdfAnnotationPrinterMark
Create a new printermark annotation.
func (*PdfAnnotationPrinterMark) ToPdfObject ¶
func (this *PdfAnnotationPrinterMark) ToPdfObject() PdfObject
type PdfAnnotationProjection ¶
type PdfAnnotationProjection struct { *PdfAnnotation *PdfAnnotationMarkup }
Subtype: Projection
func NewPdfAnnotationProjection ¶
func NewPdfAnnotationProjection() *PdfAnnotationProjection
Create a new projection annotation.
func (*PdfAnnotationProjection) ToPdfObject ¶
func (this *PdfAnnotationProjection) ToPdfObject() PdfObject
type PdfAnnotationRedact ¶
type PdfAnnotationRedact struct { *PdfAnnotation *PdfAnnotationMarkup QuadPoints PdfObject IC PdfObject RO PdfObject OverlayText PdfObject Repeat PdfObject DA PdfObject Q PdfObject }
Subtype: Redact
func NewPdfAnnotationRedact ¶
func NewPdfAnnotationRedact() *PdfAnnotationRedact
Create a new redact annotation.
func (*PdfAnnotationRedact) ToPdfObject ¶
func (this *PdfAnnotationRedact) ToPdfObject() PdfObject
type PdfAnnotationRichMedia ¶
type PdfAnnotationRichMedia struct { *PdfAnnotation RichMediaSettings PdfObject RichMediaContent PdfObject }
Subtype: Rich Media
func NewPdfAnnotationRichMedia ¶
func NewPdfAnnotationRichMedia() *PdfAnnotationRichMedia
Create a new rich media annotation.
func (*PdfAnnotationRichMedia) ToPdfObject ¶
func (this *PdfAnnotationRichMedia) ToPdfObject() PdfObject
type PdfAnnotationScreen ¶
type PdfAnnotationScreen struct { *PdfAnnotation T PdfObject MK PdfObject A PdfObject AA PdfObject }
Subtype: Screen
func NewPdfAnnotationScreen ¶
func NewPdfAnnotationScreen() *PdfAnnotationScreen
Create a new screen annotation.
func (*PdfAnnotationScreen) ToPdfObject ¶
func (this *PdfAnnotationScreen) ToPdfObject() PdfObject
type PdfAnnotationSound ¶
type PdfAnnotationSound struct { *PdfAnnotation *PdfAnnotationMarkup Sound PdfObject Name PdfObject }
Subtype: Sound
func NewPdfAnnotationSound ¶
func NewPdfAnnotationSound() *PdfAnnotationSound
Create a new sound annotation.
func (*PdfAnnotationSound) ToPdfObject ¶
func (this *PdfAnnotationSound) ToPdfObject() PdfObject
type PdfAnnotationSquare ¶
type PdfAnnotationSquare struct { *PdfAnnotation *PdfAnnotationMarkup BS PdfObject IC PdfObject BE PdfObject RD PdfObject }
Subtype: Square
func NewPdfAnnotationSquare ¶
func NewPdfAnnotationSquare() *PdfAnnotationSquare
Create a new square annotation.
func (*PdfAnnotationSquare) ToPdfObject ¶
func (this *PdfAnnotationSquare) ToPdfObject() PdfObject
type PdfAnnotationSquiggly ¶
type PdfAnnotationSquiggly struct { *PdfAnnotation *PdfAnnotationMarkup QuadPoints PdfObject }
Subtype: Squiggly
func NewPdfAnnotationSquiggly ¶
func NewPdfAnnotationSquiggly() *PdfAnnotationSquiggly
Create a new text squiggly annotation.
func (*PdfAnnotationSquiggly) ToPdfObject ¶
func (this *PdfAnnotationSquiggly) ToPdfObject() PdfObject
type PdfAnnotationStamp ¶
type PdfAnnotationStamp struct { *PdfAnnotation *PdfAnnotationMarkup Name PdfObject }
Subtype: Stamp
func NewPdfAnnotationStamp ¶
func NewPdfAnnotationStamp() *PdfAnnotationStamp
Create a new stamp annotation.
func (*PdfAnnotationStamp) ToPdfObject ¶
func (this *PdfAnnotationStamp) ToPdfObject() PdfObject
type PdfAnnotationStrikeOut ¶
type PdfAnnotationStrikeOut struct { *PdfAnnotation *PdfAnnotationMarkup QuadPoints PdfObject }
Subtype: StrikeOut
func NewPdfAnnotationStrikeOut ¶
func NewPdfAnnotationStrikeOut() *PdfAnnotationStrikeOut
Create a new text strikeout annotation.
func (*PdfAnnotationStrikeOut) ToPdfObject ¶
func (this *PdfAnnotationStrikeOut) ToPdfObject() PdfObject
type PdfAnnotationText ¶
type PdfAnnotationText struct { *PdfAnnotation *PdfAnnotationMarkup Open PdfObject Name PdfObject State PdfObject StateModel PdfObject }
Subtype: Text
func NewPdfAnnotationText ¶
func NewPdfAnnotationText() *PdfAnnotationText
Create a new text annotation.
func (*PdfAnnotationText) ToPdfObject ¶
func (this *PdfAnnotationText) ToPdfObject() PdfObject
type PdfAnnotationTrapNet ¶
type PdfAnnotationTrapNet struct {
*PdfAnnotation
}
Subtype: TrapNet
func NewPdfAnnotationTrapNet ¶
func NewPdfAnnotationTrapNet() *PdfAnnotationTrapNet
Create a new trapnet annotation.
func (*PdfAnnotationTrapNet) ToPdfObject ¶
func (this *PdfAnnotationTrapNet) ToPdfObject() PdfObject
type PdfAnnotationUnderline ¶
type PdfAnnotationUnderline struct { *PdfAnnotation *PdfAnnotationMarkup QuadPoints PdfObject }
Subtype: Underline
func NewPdfAnnotationUnderline ¶
func NewPdfAnnotationUnderline() *PdfAnnotationUnderline
Create a new text underline annotation.
func (*PdfAnnotationUnderline) ToPdfObject ¶
func (this *PdfAnnotationUnderline) ToPdfObject() PdfObject
type PdfAnnotationWatermark ¶
type PdfAnnotationWatermark struct { *PdfAnnotation FixedPrint PdfObject }
Subtype: Watermark
func NewPdfAnnotationWatermark ¶
func NewPdfAnnotationWatermark() *PdfAnnotationWatermark
Create a new watermark annotation.
func (*PdfAnnotationWatermark) ToPdfObject ¶
func (this *PdfAnnotationWatermark) ToPdfObject() PdfObject
type PdfAnnotationWidget ¶
type PdfAnnotationWidget struct { *PdfAnnotation H PdfObject MK PdfObject A PdfObject AA PdfObject BS PdfObject Parent PdfObject }
Subtype: Widget
func NewPdfAnnotationWidget ¶
func NewPdfAnnotationWidget() *PdfAnnotationWidget
Create a new annotation widget and initializes the underlying primitive.
func (*PdfAnnotationWidget) ToPdfObject ¶
func (this *PdfAnnotationWidget) ToPdfObject() PdfObject
type PdfBorderEffect ¶
type PdfBorderEffect struct { S *BorderEffect // Border effect type I *float64 // Intensity of the effect }
type PdfBorderStyle ¶
type PdfBorderStyle struct { W *float64 // Border width S *BorderStyle // Border style D *[]int // Dash array. // contains filtered or unexported fields }
Border style
func NewBorderStyle ¶
func NewBorderStyle() *PdfBorderStyle
func (*PdfBorderStyle) GetBorderWidth ¶
func (this *PdfBorderStyle) GetBorderWidth() float64
func (*PdfBorderStyle) SetBorderWidth ¶
func (this *PdfBorderStyle) SetBorderWidth(width float64)
func (*PdfBorderStyle) ToPdfObject ¶
func (this *PdfBorderStyle) ToPdfObject() PdfObject
type PdfColorCalGray ¶
type PdfColorCalGray float64
func NewPdfColorCalGray ¶
func NewPdfColorCalGray(grayVal float64) *PdfColorCalGray
func (*PdfColorCalGray) GetNumComponents ¶
func (this *PdfColorCalGray) GetNumComponents() int
func (*PdfColorCalGray) ToInteger ¶
func (this *PdfColorCalGray) ToInteger(bits int) uint32
Convert to an integer format.
func (*PdfColorCalGray) Val ¶
func (this *PdfColorCalGray) Val() float64
type PdfColorCalRGB ¶
type PdfColorCalRGB [3]float64
func NewPdfColorCalRGB ¶
func NewPdfColorCalRGB(a, b, c float64) *PdfColorCalRGB
func (*PdfColorCalRGB) A ¶
func (this *PdfColorCalRGB) A() float64
func (*PdfColorCalRGB) B ¶
func (this *PdfColorCalRGB) B() float64
func (*PdfColorCalRGB) C ¶
func (this *PdfColorCalRGB) C() float64
func (*PdfColorCalRGB) GetNumComponents ¶
func (this *PdfColorCalRGB) GetNumComponents() int
func (*PdfColorCalRGB) ToInteger ¶
func (this *PdfColorCalRGB) ToInteger(bits int) [3]uint32
Convert to an integer format.
type PdfColorDeviceCMYK ¶
type PdfColorDeviceCMYK [4]float64
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
func (*PdfColorDeviceCMYK) C ¶
func (this *PdfColorDeviceCMYK) C() float64
func (*PdfColorDeviceCMYK) GetNumComponents ¶
func (this *PdfColorDeviceCMYK) GetNumComponents() int
func (*PdfColorDeviceCMYK) K ¶
func (this *PdfColorDeviceCMYK) K() float64
func (*PdfColorDeviceCMYK) M ¶
func (this *PdfColorDeviceCMYK) M() float64
func (*PdfColorDeviceCMYK) ToInteger ¶
func (this *PdfColorDeviceCMYK) ToInteger(bits int) [4]uint32
Convert to an integer format.
func (*PdfColorDeviceCMYK) Y ¶
func (this *PdfColorDeviceCMYK) Y() float64
type PdfColorDeviceGray ¶
type PdfColorDeviceGray float64
A grayscale value 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
func (*PdfColorDeviceGray) GetNumComponents ¶
func (this *PdfColorDeviceGray) GetNumComponents() int
func (*PdfColorDeviceGray) ToInteger ¶
func (this *PdfColorDeviceGray) ToInteger(bits int) uint32
Convert to an integer format.
func (*PdfColorDeviceGray) Val ¶
func (this *PdfColorDeviceGray) Val() float64
type PdfColorDeviceRGB ¶
type PdfColorDeviceRGB [3]float64
Each 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
func (*PdfColorDeviceRGB) B ¶
func (this *PdfColorDeviceRGB) B() float64
func (*PdfColorDeviceRGB) G ¶
func (this *PdfColorDeviceRGB) G() float64
func (*PdfColorDeviceRGB) GetNumComponents ¶
func (this *PdfColorDeviceRGB) GetNumComponents() int
func (*PdfColorDeviceRGB) R ¶
func (this *PdfColorDeviceRGB) R() float64
func (*PdfColorDeviceRGB) ToGray ¶
func (this *PdfColorDeviceRGB) ToGray() *PdfColorDeviceGray
func (*PdfColorDeviceRGB) ToInteger ¶
func (this *PdfColorDeviceRGB) ToInteger(bits int) [3]uint32
Convert to an integer format.
type PdfColorLab ¶
type PdfColorLab [3]float64
func NewPdfColorLab ¶
func NewPdfColorLab(l, a, b float64) *PdfColorLab
func (*PdfColorLab) A ¶
func (this *PdfColorLab) A() float64
func (*PdfColorLab) B ¶
func (this *PdfColorLab) B() float64
func (*PdfColorLab) GetNumComponents ¶
func (this *PdfColorLab) GetNumComponents() int
func (*PdfColorLab) L ¶
func (this *PdfColorLab) L() float64
func (*PdfColorLab) ToInteger ¶
func (this *PdfColorLab) ToInteger(bits int) [3]uint32
Convert to an integer format.
type PdfColorPattern ¶
type PdfColorPattern struct { Color PdfColor // Color defined in underlying colorspace. PatternName PdfObjectName // Name of the pattern (reference via resource dicts). }
type PdfColorspace ¶
type PdfColorspace interface { String() string ImageToRGB(Image) (Image, error) ColorToRGB(color PdfColor) (PdfColor, error) GetNumComponents() int ToPdfObject() PdfObject ColorFromPdfObjects(objects []PdfObject) (PdfColor, error) ColorFromFloats(vals []float64) (PdfColor, error) // Returns the decode array for the CS, i.e. the range of each component. DecodeArray() []float64 }
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 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 // [XW, YW, ZW]: Required BlackPoint []float64 // [XB, YB, ZB] Gamma float64 // contains filtered or unexported fields }
CalGray color space.
func NewPdfColorspaceCalGray ¶
func NewPdfColorspaceCalGray() *PdfColorspaceCalGray
func (*PdfColorspaceCalGray) ColorFromFloats ¶
func (this *PdfColorspaceCalGray) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceCalGray) ColorFromPdfObjects ¶
func (this *PdfColorspaceCalGray) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceCalGray) ColorToRGB ¶
func (this *PdfColorspaceCalGray) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceCalGray) DecodeArray ¶
func (this *PdfColorspaceCalGray) DecodeArray() []float64
DecodeArray returns the range of color component values in CalGray colorspace.
func (*PdfColorspaceCalGray) GetNumComponents ¶
func (this *PdfColorspaceCalGray) GetNumComponents() int
func (*PdfColorspaceCalGray) ImageToRGB ¶
func (this *PdfColorspaceCalGray) ImageToRGB(img Image) (Image, error)
A, B, C -> X, Y, Z
func (*PdfColorspaceCalGray) String ¶
func (this *PdfColorspaceCalGray) String() string
func (*PdfColorspaceCalGray) ToPdfObject ¶
func (this *PdfColorspaceCalGray) ToPdfObject() PdfObject
Return as PDF object format [name dictionary]
type PdfColorspaceCalRGB ¶
type PdfColorspaceCalRGB struct { WhitePoint []float64 BlackPoint []float64 Gamma []float64 Matrix []float64 // [XA YA ZA XB YB ZB XC YC ZC] ; default value identity [1 0 0 0 1 0 0 0 1] // contains filtered or unexported fields }
A, B, C components
func NewPdfColorspaceCalRGB ¶
func NewPdfColorspaceCalRGB() *PdfColorspaceCalRGB
require parameters?
func (*PdfColorspaceCalRGB) ColorFromFloats ¶
func (this *PdfColorspaceCalRGB) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceCalRGB) ColorFromPdfObjects ¶
func (this *PdfColorspaceCalRGB) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceCalRGB) ColorToRGB ¶
func (this *PdfColorspaceCalRGB) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceCalRGB) DecodeArray ¶
func (this *PdfColorspaceCalRGB) DecodeArray() []float64
DecodeArray returns the range of color component values in CalRGB colorspace.
func (*PdfColorspaceCalRGB) GetNumComponents ¶
func (this *PdfColorspaceCalRGB) GetNumComponents() int
func (*PdfColorspaceCalRGB) ImageToRGB ¶
func (this *PdfColorspaceCalRGB) ImageToRGB(img Image) (Image, error)
func (*PdfColorspaceCalRGB) String ¶
func (this *PdfColorspaceCalRGB) String() string
func (*PdfColorspaceCalRGB) ToPdfObject ¶
func (this *PdfColorspaceCalRGB) ToPdfObject() PdfObject
Return as PDF object format [name dictionary]
type PdfColorspaceDeviceCMYK ¶
type PdfColorspaceDeviceCMYK struct{}
func NewPdfColorspaceDeviceCMYK ¶
func NewPdfColorspaceDeviceCMYK() *PdfColorspaceDeviceCMYK
func (*PdfColorspaceDeviceCMYK) ColorFromFloats ¶
func (this *PdfColorspaceDeviceCMYK) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceDeviceCMYK) ColorFromPdfObjects ¶
func (this *PdfColorspaceDeviceCMYK) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
Get the color from a series of pdf objects (4 for cmyk).
func (*PdfColorspaceDeviceCMYK) ColorToRGB ¶
func (this *PdfColorspaceDeviceCMYK) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceDeviceCMYK) DecodeArray ¶
func (this *PdfColorspaceDeviceCMYK) DecodeArray() []float64
DecodeArray returns the range of color component values in DeviceCMYK colorspace.
func (*PdfColorspaceDeviceCMYK) GetNumComponents ¶
func (this *PdfColorspaceDeviceCMYK) GetNumComponents() int
func (*PdfColorspaceDeviceCMYK) ImageToRGB ¶
func (this *PdfColorspaceDeviceCMYK) ImageToRGB(img Image) (Image, error)
func (*PdfColorspaceDeviceCMYK) String ¶
func (this *PdfColorspaceDeviceCMYK) String() string
func (*PdfColorspaceDeviceCMYK) ToPdfObject ¶
func (this *PdfColorspaceDeviceCMYK) ToPdfObject() PdfObject
type PdfColorspaceDeviceGray ¶
type PdfColorspaceDeviceGray struct{}
func NewPdfColorspaceDeviceGray ¶
func NewPdfColorspaceDeviceGray() *PdfColorspaceDeviceGray
func (*PdfColorspaceDeviceGray) ColorFromFloats ¶
func (this *PdfColorspaceDeviceGray) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceDeviceGray) ColorFromPdfObjects ¶
func (this *PdfColorspaceDeviceGray) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceDeviceGray) ColorToRGB ¶
func (this *PdfColorspaceDeviceGray) ColorToRGB(color PdfColor) (PdfColor, error)
Convert gray -> rgb for a single color component.
func (*PdfColorspaceDeviceGray) DecodeArray ¶
func (this *PdfColorspaceDeviceGray) DecodeArray() []float64
DecodeArray returns the range of color component values in DeviceGray colorspace.
func (*PdfColorspaceDeviceGray) GetNumComponents ¶
func (this *PdfColorspaceDeviceGray) GetNumComponents() int
func (*PdfColorspaceDeviceGray) ImageToRGB ¶
func (this *PdfColorspaceDeviceGray) ImageToRGB(img Image) (Image, error)
Convert 1-component grayscale data to 3-component RGB.
func (*PdfColorspaceDeviceGray) String ¶
func (this *PdfColorspaceDeviceGray) String() string
func (*PdfColorspaceDeviceGray) ToPdfObject ¶
func (this *PdfColorspaceDeviceGray) ToPdfObject() PdfObject
type PdfColorspaceDeviceN ¶
type PdfColorspaceDeviceN struct { ColorantNames *PdfObjectArray AlternateSpace PdfColorspace TintTransform PdfFunction Attributes *PdfColorspaceDeviceNAttributes // contains filtered or unexported fields }
//////////////////// 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
func (*PdfColorspaceDeviceN) ColorFromFloats ¶
func (this *PdfColorspaceDeviceN) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceDeviceN) ColorFromPdfObjects ¶
func (this *PdfColorspaceDeviceN) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceDeviceN) ColorToRGB ¶
func (this *PdfColorspaceDeviceN) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceDeviceN) DecodeArray ¶
func (this *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 (this *PdfColorspaceDeviceN) GetNumComponents() int
GetNumComponents returns the number of input color components, i.e. that are input to the tint transform.
func (*PdfColorspaceDeviceN) ImageToRGB ¶
func (this *PdfColorspaceDeviceN) ImageToRGB(img Image) (Image, error)
func (*PdfColorspaceDeviceN) String ¶
func (this *PdfColorspaceDeviceN) String() string
func (*PdfColorspaceDeviceN) ToPdfObject ¶
func (this *PdfColorspaceDeviceN) ToPdfObject() PdfObject
type PdfColorspaceDeviceNAttributes ¶
type PdfColorspaceDeviceNAttributes struct { Subtype *PdfObjectName // DeviceN or NChannel (DeviceN default) Colorants PdfObject Process PdfObject MixingHints PdfObject // contains filtered or unexported fields }
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 custom blending algorithms, along with other information provided in the attributes dictionary if present.
func (*PdfColorspaceDeviceNAttributes) ToPdfObject ¶
func (this *PdfColorspaceDeviceNAttributes) ToPdfObject() PdfObject
type PdfColorspaceDeviceRGB ¶
type PdfColorspaceDeviceRGB struct{}
func NewPdfColorspaceDeviceRGB ¶
func NewPdfColorspaceDeviceRGB() *PdfColorspaceDeviceRGB
func (*PdfColorspaceDeviceRGB) ColorFromFloats ¶
func (this *PdfColorspaceDeviceRGB) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceDeviceRGB) ColorFromPdfObjects ¶
func (this *PdfColorspaceDeviceRGB) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
Get the color from a series of pdf objects (3 for rgb).
func (*PdfColorspaceDeviceRGB) ColorToRGB ¶
func (this *PdfColorspaceDeviceRGB) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceDeviceRGB) DecodeArray ¶
func (this *PdfColorspaceDeviceRGB) DecodeArray() []float64
DecodeArray returns the range of color component values in DeviceRGB colorspace.
func (*PdfColorspaceDeviceRGB) GetNumComponents ¶
func (this *PdfColorspaceDeviceRGB) GetNumComponents() int
func (*PdfColorspaceDeviceRGB) ImageToGray ¶
func (this *PdfColorspaceDeviceRGB) ImageToGray(img Image) (Image, error)
func (*PdfColorspaceDeviceRGB) ImageToRGB ¶
func (this *PdfColorspaceDeviceRGB) ImageToRGB(img Image) (Image, error)
func (*PdfColorspaceDeviceRGB) String ¶
func (this *PdfColorspaceDeviceRGB) String() string
func (*PdfColorspaceDeviceRGB) ToPdfObject ¶
func (this *PdfColorspaceDeviceRGB) ToPdfObject() PdfObject
type PdfColorspaceICCBased ¶
type PdfColorspaceICCBased struct { N int // Number of color components (Required). Can be 1,3, or 4. Alternate PdfColorspace // Alternate colorspace for non-conforming readers. // If omitted ICC not supported: then use DeviceGray, // DeviceRGB or DeviceCMYK for N=1,3,4 respectively. Range []float64 // Array of 2xN numbers, specifying range of each color component. Metadata *PdfObjectStream // Metadata stream. Data []byte // ICC colormap data. // contains filtered or unexported fields }
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)
func (*PdfColorspaceICCBased) ColorFromFloats ¶
func (this *PdfColorspaceICCBased) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceICCBased) ColorFromPdfObjects ¶
func (this *PdfColorspaceICCBased) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceICCBased) ColorToRGB ¶
func (this *PdfColorspaceICCBased) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceICCBased) DecodeArray ¶
func (this *PdfColorspaceICCBased) DecodeArray() []float64
DecodeArray returns the range of color component values in the ICCBased colorspace.
func (*PdfColorspaceICCBased) GetNumComponents ¶
func (this *PdfColorspaceICCBased) GetNumComponents() int
func (*PdfColorspaceICCBased) ImageToRGB ¶
func (this *PdfColorspaceICCBased) ImageToRGB(img Image) (Image, error)
func (*PdfColorspaceICCBased) String ¶
func (this *PdfColorspaceICCBased) String() string
func (*PdfColorspaceICCBased) ToPdfObject ¶
func (this *PdfColorspaceICCBased) ToPdfObject() PdfObject
Return as PDF object format [name stream]
type PdfColorspaceLab ¶
type PdfColorspaceLab struct { WhitePoint []float64 // Required. BlackPoint []float64 Range []float64 // [amin amax bmin bmax] // contains filtered or unexported fields }
L*, a*, b* 3 component colorspace.
func (*PdfColorspaceLab) ColorFromFloats ¶
func (this *PdfColorspaceLab) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceLab) ColorFromPdfObjects ¶
func (this *PdfColorspaceLab) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceLab) ColorToRGB ¶
func (this *PdfColorspaceLab) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceLab) DecodeArray ¶
func (this *PdfColorspaceLab) DecodeArray() []float64
DecodeArray returns the range of color component values in the Lab colorspace.
func (*PdfColorspaceLab) GetNumComponents ¶
func (this *PdfColorspaceLab) GetNumComponents() int
func (*PdfColorspaceLab) ImageToRGB ¶
func (this *PdfColorspaceLab) ImageToRGB(img Image) (Image, error)
func (*PdfColorspaceLab) String ¶
func (this *PdfColorspaceLab) String() string
func (*PdfColorspaceLab) ToPdfObject ¶
func (this *PdfColorspaceLab) ToPdfObject() PdfObject
Return as PDF object format [name dictionary]
type PdfColorspaceSpecialIndexed ¶
type PdfColorspaceSpecialIndexed struct { Base PdfColorspace HiVal int Lookup PdfObject // contains filtered or unexported fields }
//////////////////// Indexed colorspace. 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
func (*PdfColorspaceSpecialIndexed) ColorFromFloats ¶
func (this *PdfColorspaceSpecialIndexed) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceSpecialIndexed) ColorFromPdfObjects ¶
func (this *PdfColorspaceSpecialIndexed) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceSpecialIndexed) ColorToRGB ¶
func (this *PdfColorspaceSpecialIndexed) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceSpecialIndexed) DecodeArray ¶
func (this *PdfColorspaceSpecialIndexed) DecodeArray() []float64
DecodeArray returns the component range values for the Indexed colorspace.
func (*PdfColorspaceSpecialIndexed) GetNumComponents ¶
func (this *PdfColorspaceSpecialIndexed) GetNumComponents() int
func (*PdfColorspaceSpecialIndexed) ImageToRGB ¶
func (this *PdfColorspaceSpecialIndexed) ImageToRGB(img Image) (Image, error)
Convert an indexed image to RGB.
func (*PdfColorspaceSpecialIndexed) String ¶
func (this *PdfColorspaceSpecialIndexed) String() string
func (*PdfColorspaceSpecialIndexed) ToPdfObject ¶
func (this *PdfColorspaceSpecialIndexed) ToPdfObject() PdfObject
[/Indexed base hival lookup]
type PdfColorspaceSpecialPattern ¶
type PdfColorspaceSpecialPattern struct { UnderlyingCS PdfColorspace // contains filtered or unexported fields }
Pattern colorspace. Can be defined either as /Pattern or with an underlying colorspace [/Pattern cs].
func NewPdfColorspaceSpecialPattern ¶
func NewPdfColorspaceSpecialPattern() *PdfColorspaceSpecialPattern
func (*PdfColorspaceSpecialPattern) ColorFromFloats ¶
func (this *PdfColorspaceSpecialPattern) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceSpecialPattern) ColorFromPdfObjects ¶
func (this *PdfColorspaceSpecialPattern) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
The first objects (if present) represent the color in underlying colorspace. The last one represents the name of the pattern.
func (*PdfColorspaceSpecialPattern) ColorToRGB ¶
func (this *PdfColorspaceSpecialPattern) ColorToRGB(color PdfColor) (PdfColor, error)
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 (this *PdfColorspaceSpecialPattern) DecodeArray() []float64
DecodeArray returns an empty slice as there are no components associated with pattern colorspace.
func (*PdfColorspaceSpecialPattern) GetNumComponents ¶
func (this *PdfColorspaceSpecialPattern) GetNumComponents() int
func (*PdfColorspaceSpecialPattern) ImageToRGB ¶
func (this *PdfColorspaceSpecialPattern) ImageToRGB(img Image) (Image, error)
An image cannot be defined in a pattern colorspace, returns an error.
func (*PdfColorspaceSpecialPattern) String ¶
func (this *PdfColorspaceSpecialPattern) String() string
func (*PdfColorspaceSpecialPattern) ToPdfObject ¶
func (this *PdfColorspaceSpecialPattern) ToPdfObject() PdfObject
type PdfColorspaceSpecialSeparation ¶
type PdfColorspaceSpecialSeparation struct { ColorantName *PdfObjectName AlternateSpace PdfColorspace TintTransform PdfFunction // contains filtered or unexported fields }
//////////////////// 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
func (*PdfColorspaceSpecialSeparation) ColorFromFloats ¶
func (this *PdfColorspaceSpecialSeparation) ColorFromFloats(vals []float64) (PdfColor, error)
func (*PdfColorspaceSpecialSeparation) ColorFromPdfObjects ¶
func (this *PdfColorspaceSpecialSeparation) ColorFromPdfObjects(objects []PdfObject) (PdfColor, error)
func (*PdfColorspaceSpecialSeparation) ColorToRGB ¶
func (this *PdfColorspaceSpecialSeparation) ColorToRGB(color PdfColor) (PdfColor, error)
func (*PdfColorspaceSpecialSeparation) DecodeArray ¶
func (this *PdfColorspaceSpecialSeparation) DecodeArray() []float64
DecodeArray returns the component range values for the Separation colorspace.
func (*PdfColorspaceSpecialSeparation) GetNumComponents ¶
func (this *PdfColorspaceSpecialSeparation) GetNumComponents() int
func (*PdfColorspaceSpecialSeparation) ImageToRGB ¶
func (this *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 (this *PdfColorspaceSpecialSeparation) String() string
func (*PdfColorspaceSpecialSeparation) ToPdfObject ¶
func (this *PdfColorspaceSpecialSeparation) ToPdfObject() PdfObject
type PdfDate ¶
type PdfDate struct {
// contains filtered or unexported fields
}
A date is a PDF string of the form: (D:YYYYMMDDHHmmSSOHH'mm)
func NewPdfDate ¶
Make a new PdfDate object from a PDF date string (see 7.9.4 Dates). format: "D: YYYYMMDDHHmmSSOHH'mm"
func (*PdfDate) ToPdfObject ¶
func (date *PdfDate) ToPdfObject() PdfObject
Convert to a PDF string object.
type PdfField ¶
type PdfField struct { FT *PdfObjectName // field type Parent *PdfField // In a non-terminal field, the Kids array shall refer to field dictionaries that are immediate descendants of this field. // In a terminal field, the Kids array ordinarily shall refer to one or more separate widget annotations that are associated // with this field. However, if there is only one associated widget annotation, and its contents have been merged into the field // dictionary, Kids shall be omitted. KidsF []PdfModel // Kids can be array of other fields or widgets (PdfModel). KidsA []*PdfAnnotation T PdfObject TU PdfObject TM PdfObject Ff PdfObject // field flag V PdfObject //value DV PdfObject AA PdfObject // Variable Text: DA PdfObject Q PdfObject DS PdfObject RV PdfObject // contains filtered or unexported fields }
PdfField represents a field of an interactive form. Implements PdfModel interface.
func NewPdfField ¶
func NewPdfField() *PdfField
func (*PdfField) GetContainingPdfObject ¶
func (this *PdfField) GetContainingPdfObject() PdfObject
func (*PdfField) ToPdfObject ¶
func (this *PdfField) ToPdfObject() PdfObject
If Kids refer only to a single pdf widget annotation widget, then can merge it in. Currently not merging it in.
type PdfFont ¶
type PdfFont struct {
// contains filtered or unexported fields
}
The PdfFont structure represents an underlying font structure which can be of type: - Type0 - Type1 - TrueType etc.
func NewPdfFontFromTTFFile ¶
func (PdfFont) GetGlyphCharMetrics ¶
func (font PdfFont) GetGlyphCharMetrics(glyph string) (fonts.CharMetrics, bool)
func (PdfFont) SetEncoder ¶
func (font PdfFont) SetEncoder(encoder textencoding.TextEncoder)
Set the encoding for the underlying font.
func (PdfFont) ToPdfObject ¶
type PdfFontDescriptor ¶
type PdfFontDescriptor struct { FontName core.PdfObject FontFamily core.PdfObject FontStretch core.PdfObject FontWeight core.PdfObject Flags core.PdfObject FontBBox core.PdfObject ItalicAngle core.PdfObject Ascent core.PdfObject Descent core.PdfObject Leading core.PdfObject CapHeight core.PdfObject XHeight core.PdfObject StemV core.PdfObject StemH core.PdfObject AvgWidth core.PdfObject MaxWidth core.PdfObject MissingWidth core.PdfObject FontFile core.PdfObject FontFile2 core.PdfObject FontFile3 core.PdfObject CharSet core.PdfObject // Additional entries for CIDFonts Style core.PdfObject Lang core.PdfObject FD core.PdfObject CIDSet core.PdfObject // contains filtered or unexported fields }
Font descriptors specifies metrics and other attributes of a font.
func (*PdfFontDescriptor) ToPdfObject ¶
func (this *PdfFontDescriptor) ToPdfObject() core.PdfObject
Convert to a PDF dictionary inside an indirect object.
type PdfFunction ¶
type PdfFunctionType0 ¶
type PdfFunctionType0 struct { Domain []float64 // required; 2*m length; where m is the number of input values Range []float64 // required (type 0); 2*n length; where n is the number of output values NumInputs int NumOutputs int Size []int BitsPerSample int Order int // Values 1 or 3 (linear or cubic spline interpolation) Encode []float64 Decode []float64 // contains filtered or unexported fields }
Type 0 functions use 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 (this *PdfFunctionType0) Evaluate(x []float64) ([]float64, error)
func (*PdfFunctionType0) ToPdfObject ¶
func (this *PdfFunctionType0) ToPdfObject() PdfObject
type PdfFunctionType2 ¶
type PdfFunctionType2 struct { Domain []float64 Range []float64 C0 []float64 C1 []float64 N float64 // contains filtered or unexported fields }
Type 2 functions define 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 (this *PdfFunctionType2) Evaluate(x []float64) ([]float64, error)
func (*PdfFunctionType2) ToPdfObject ¶
func (this *PdfFunctionType2) ToPdfObject() PdfObject
type PdfFunctionType3 ¶
type PdfFunctionType3 struct { Domain []float64 Range []float64 Functions []PdfFunction // k-1 input functions Bounds []float64 // k-1 numbers; defines the intervals where each function applies Encode []float64 // Array of 2k numbers.. // contains filtered or unexported fields }
Type 3 functions define stitching of the subdomains of serveral 1-input functions to produce a single new 1-input function.
func (*PdfFunctionType3) Evaluate ¶
func (this *PdfFunctionType3) Evaluate(x []float64) ([]float64, error)
func (*PdfFunctionType3) ToPdfObject ¶
func (this *PdfFunctionType3) ToPdfObject() PdfObject
type PdfFunctionType4 ¶
type PdfFunctionType4 struct { Domain []float64 Range []float64 Program *ps.PSProgram // contains filtered or unexported fields }
Type 4. Postscript calculator functions.
func (*PdfFunctionType4) Evaluate ¶
func (this *PdfFunctionType4) Evaluate(xVec []float64) ([]float64, error)
Input [x1 x2 x3]
func (*PdfFunctionType4) ToPdfObject ¶
func (this *PdfFunctionType4) ToPdfObject() PdfObject
type PdfModel ¶
type PdfModel interface { ToPdfObject() PdfObject GetContainingPdfObject() PdfObject }
A PDFModel is a higher level PDF construct which can be collapsed into a PDF primitive. Each PDFModel has an underlying Primitive and vice versa. 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 }
PDF outline dictionary (Table 152 - p. 376).
func NewPdfOutline ¶
func NewPdfOutline() *PdfOutline
func NewPdfOutlineTree ¶
func NewPdfOutlineTree() *PdfOutline
func (*PdfOutline) GetContainingPdfObject ¶
func (this *PdfOutline) GetContainingPdfObject() PdfObject
func (*PdfOutline) ToPdfObject ¶
func (this *PdfOutline) ToPdfObject() PdfObject
Recursively build the Outline tree PDF object.
type PdfOutlineItem ¶
type PdfOutlineItem struct { PdfOutlineTreeNode Title *PdfObjectString Parent *PdfOutlineTreeNode Prev *PdfOutlineTreeNode Next *PdfOutlineTreeNode Count *int64 Dest PdfObject A PdfObject SE PdfObject C PdfObject F PdfObject // contains filtered or unexported fields }
Pdf outline item dictionary (Table 153 - pp. 376 - 377).
func NewOutlineBookmark ¶
func NewOutlineBookmark(title string, page *PdfIndirectObject) *PdfOutlineItem
func NewPdfOutlineItem ¶
func NewPdfOutlineItem() *PdfOutlineItem
func (*PdfOutlineItem) GetContainingPdfObject ¶
func (this *PdfOutlineItem) GetContainingPdfObject() PdfObject
func (*PdfOutlineItem) ToPdfObject ¶
func (this *PdfOutlineItem) ToPdfObject() PdfObject
Outline item. Recursively build the Outline tree PDF object.
type PdfOutlineTreeNode ¶
type PdfOutlineTreeNode struct { First *PdfOutlineTreeNode Last *PdfOutlineTreeNode // contains filtered or unexported fields }
func (*PdfOutlineTreeNode) GetContainingPdfObject ¶
func (this *PdfOutlineTreeNode) GetContainingPdfObject() PdfObject
func (*PdfOutlineTreeNode) ToPdfObject ¶
func (this *PdfOutlineTreeNode) ToPdfObject() PdfObject
type PdfPage ¶
type PdfPage struct { Parent PdfObject LastModified *PdfDate Resources *PdfPageResources CropBox *PdfRectangle MediaBox *PdfRectangle BleedBox *PdfRectangle TrimBox *PdfRectangle ArtBox *PdfRectangle BoxColorInfo PdfObject Contents PdfObject Rotate *int64 Group PdfObject Thumb PdfObject B PdfObject Dur PdfObject Trans PdfObject AA PdfObject Metadata PdfObject PieceInfo PdfObject StructParents PdfObject ID PdfObject PZ PdfObject SeparationInfo PdfObject Tabs PdfObject TemplateInstantiated PdfObject PresSteps PdfObject UserUnit PdfObject VP PdfObject Annotations []*PdfAnnotation // contains filtered or unexported fields }
PDF page object (7.7.3.3 - Table 30).
func NewPdfPage ¶
func NewPdfPage() *PdfPage
func (*PdfPage) AddContentStreamByString ¶
Add content stream by string. Puts the content string into a stream object and points the content stream towards it.
func (*PdfPage) AddExtGState ¶
Add a graphics state to the XObject resources.
func (*PdfPage) AddImageResource ¶
func (this *PdfPage) AddImageResource(name PdfObjectName, ximg *XObjectImage) error
Add an image to the XObject resources.
func (*PdfPage) AddWatermarkImage ¶
func (this *PdfPage) AddWatermarkImage(ximg *XObjectImage, opt WatermarkImageOptions) error
Add a watermark to the page.
func (*PdfPage) GetAllContentStreams ¶
Get all the content streams for a page as one string.
func (*PdfPage) GetContainingPdfObject ¶
func (this *PdfPage) GetContainingPdfObject() PdfObject
func (*PdfPage) GetContentStreams ¶
Get Content Stream as an array of strings.
func (*PdfPage) GetMediaBox ¶
func (this *PdfPage) GetMediaBox() (*PdfRectangle, error)
Get the inheritable media box value, either from the page or a higher up page/pages struct.
func (*PdfPage) GetPageAsIndirectObject ¶
func (this *PdfPage) GetPageAsIndirectObject() *PdfIndirectObject
Get the page object as an indirect objects. Wraps the Page dictionary into an indirect object.
func (*PdfPage) GetPageDict ¶
func (this *PdfPage) GetPageDict() *PdfObjectDictionary
Convert the Page to a PDF object dictionary.
func (*PdfPage) GetXObjectByName ¶
Get XObject by name.
func (*PdfPage) HasExtGState ¶
Check if ExtGState name is available.
func (*PdfPage) HasFontByName ¶
Check if has font resource by name.
func (*PdfPage) HasXObjectByName ¶
Check if has XObject resource by name.
func (*PdfPage) SetContentStreams ¶
Set 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) ToPdfObject ¶
func (this *PdfPage) ToPdfObject() PdfObject
type PdfPageResources ¶
type PdfPageResources struct { ExtGState PdfObject ColorSpace *PdfPageResourcesColorspaces Pattern PdfObject Shading PdfObject XObject PdfObject Font PdfObject ProcSet PdfObject Properties PdfObject // contains filtered or unexported fields }
Page resources model. Implements PdfModel.
func NewPdfPageResources ¶
func NewPdfPageResources() *PdfPageResources
func NewPdfPageResourcesFromDict ¶
func NewPdfPageResourcesFromDict(dict *PdfObjectDictionary) (*PdfPageResources, error)
func (*PdfPageResources) AddExtGState ¶
func (r *PdfPageResources) AddExtGState(gsName PdfObjectName, gsDict PdfObject) error
Add External Graphics State (GState). The gsDict can be specified either directly as a dictionary or an indirect object containing a dictionary.
func (*PdfPageResources) GetColorspaceByName ¶
func (r *PdfPageResources) GetColorspaceByName(keyName PdfObjectName) (PdfColorspace, bool)
func (*PdfPageResources) GetContainingPdfObject ¶
func (r *PdfPageResources) GetContainingPdfObject() PdfObject
func (*PdfPageResources) GetExtGState ¶
func (r *PdfPageResources) GetExtGState(keyName PdfObjectName) (PdfObject, bool)
Get the ExtGState specified by keyName. Returns a bool indicating whether it was found or not.
func (*PdfPageResources) GetFontByName ¶
func (r *PdfPageResources) GetFontByName(keyName PdfObjectName) (PdfObject, bool)
Get the font specified by keyName. Returns the PdfObject which the entry refers to. Returns a bool value indicating whether or not the entry was found.
func (*PdfPageResources) GetPatternByName ¶
func (r *PdfPageResources) GetPatternByName(keyName PdfObjectName) (*PdfPattern, bool)
Get the pattern specified by keyName. Returns nil if not existing. The bool flag indicated whether it was found or not.
func (*PdfPageResources) GetShadingByName ¶
func (r *PdfPageResources) GetShadingByName(keyName PdfObjectName) (*PdfShading, bool)
Get the shading specified by keyName. Returns nil if not existing. The bool flag indicated whether it was found or not.
func (*PdfPageResources) GetXObjectByName ¶
func (r *PdfPageResources) GetXObjectByName(keyName PdfObjectName) (*PdfObjectStream, XObjectType)
Returns the XObject with the specified keyName and the object type.
func (*PdfPageResources) GetXObjectFormByName ¶
func (r *PdfPageResources) GetXObjectFormByName(keyName PdfObjectName) (*XObjectForm, error)
func (*PdfPageResources) GetXObjectImageByName ¶
func (r *PdfPageResources) GetXObjectImageByName(keyName PdfObjectName) (*XObjectImage, error)
func (*PdfPageResources) HasColorspaceByName ¶
func (r *PdfPageResources) HasColorspaceByName(keyName PdfObjectName) bool
func (*PdfPageResources) HasExtGState ¶
func (r *PdfPageResources) HasExtGState(keyName PdfObjectName) bool
Check whether a font is defined by the specified keyName.
func (*PdfPageResources) HasFontByName ¶
func (r *PdfPageResources) HasFontByName(keyName PdfObjectName) bool
Check whether a font is defined by the specified keyName.
func (*PdfPageResources) HasXObjectByName ¶
func (r *PdfPageResources) HasXObjectByName(keyName PdfObjectName) bool
Check if an XObject with a specified keyName is defined.
func (*PdfPageResources) SetColorspaceByName ¶
func (r *PdfPageResources) SetColorspaceByName(keyName PdfObjectName, cs PdfColorspace) error
func (*PdfPageResources) SetFontByName ¶
func (r *PdfPageResources) SetFontByName(keyName PdfObjectName, obj PdfObject) error
Set the font specified by keyName to the given object.
func (*PdfPageResources) SetPatternByName ¶
func (r *PdfPageResources) SetPatternByName(keyName PdfObjectName, pattern PdfObject) error
Set a pattern resource specified by keyName.
func (*PdfPageResources) SetShadingByName ¶
func (r *PdfPageResources) SetShadingByName(keyName PdfObjectName, shadingObj PdfObject) error
Set a shading resource specified by keyName.
func (*PdfPageResources) SetXObjectByName ¶
func (r *PdfPageResources) SetXObjectByName(keyName PdfObjectName, stream *PdfObjectStream) error
func (*PdfPageResources) SetXObjectFormByName ¶
func (r *PdfPageResources) SetXObjectFormByName(keyName PdfObjectName, xform *XObjectForm) error
func (*PdfPageResources) SetXObjectImageByName ¶
func (r *PdfPageResources) SetXObjectImageByName(keyName PdfObjectName, ximg *XObjectImage) error
func (*PdfPageResources) ToPdfObject ¶
func (r *PdfPageResources) ToPdfObject() PdfObject
type PdfPageResourcesColorspaces ¶
type PdfPageResourcesColorspaces struct { Names []string Colorspaces map[string]PdfColorspace // contains filtered or unexported fields }
Needs to have matching name and colorspace map entry. The Names define the order.
func NewPdfPageResourcesColorspaces ¶
func NewPdfPageResourcesColorspaces() *PdfPageResourcesColorspaces
func (*PdfPageResourcesColorspaces) Set ¶
func (this *PdfPageResourcesColorspaces) Set(key PdfObjectName, val PdfColorspace)
Set the colorspace corresponding to key. Add to Names if not set.
func (*PdfPageResourcesColorspaces) ToPdfObject ¶
func (this *PdfPageResourcesColorspaces) ToPdfObject() PdfObject
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 (this *PdfPattern) GetAsShadingPattern() *PdfShadingPattern
Check with IsShading() prior to using this, to ensure is a shading pattern.
func (*PdfPattern) GetAsTilingPattern ¶
func (this *PdfPattern) GetAsTilingPattern() *PdfTilingPattern
Check with IsTiling() prior to using this to ensure is a tiling pattern.
func (*PdfPattern) GetContainingPdfObject ¶
func (this *PdfPattern) GetContainingPdfObject() PdfObject
func (*PdfPattern) GetContext ¶
func (this *PdfPattern) GetContext() PdfModel
Context in this case is a reference to the subpattern entry: either PdfTilingPattern or PdfShadingPattern.
func (*PdfPattern) IsShading ¶
func (this *PdfPattern) IsShading() bool
func (*PdfPattern) IsTiling ¶
func (this *PdfPattern) IsTiling() bool
func (*PdfPattern) SetContext ¶
func (this *PdfPattern) SetContext(ctx PdfModel)
Set the sub pattern (context). Either PdfTilingPattern or PdfShadingPattern.
func (*PdfPattern) ToPdfObject ¶
func (this *PdfPattern) ToPdfObject() PdfObject
type PdfReader ¶
type PdfReader struct { PageList []*PdfPage AcroForm *PdfAcroForm // contains filtered or unexported fields }
func NewPdfReader ¶
func NewPdfReader(rs io.ReadSeeker) (*PdfReader, error)
func (*PdfReader) CheckAccessRights ¶
Check 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 ¶
Decrypt the PDF file with a specified password. Also tries to decrypt with an empty password. Returns true if successful, false otherwise.
func (*PdfReader) GetEncryptionMethod ¶
Returns a string containing some information about the encryption method used. Subject to changes. May be better to return a standardized struct with information. But challenging due to the many different types supported.
func (*PdfReader) GetIndirectObjectByNumber ¶
Get specific object number.
func (*PdfReader) GetNumPages ¶
Get the number of pages in the document.
func (*PdfReader) GetOCProperties ¶
Get optional content properties
func (*PdfReader) GetObjectNums ¶
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 (this *PdfReader) GetOutlineTree() *PdfOutlineTreeNode
Get the outline tree.
func (*PdfReader) GetOutlinesFlattened ¶
func (this *PdfReader) GetOutlinesFlattened() ([]*PdfOutlineTreeNode, []string, error)
Return a flattened list of tree nodes and titles.
func (*PdfReader) GetPageAsIndirectObject ¶
Get a page by the page number. Indirect object with type /Page.
func (*PdfReader) GetTrailer ¶
func (*PdfReader) IsEncrypted ¶
func (*PdfReader) LoadAnnotations ¶
func (reader *PdfReader) LoadAnnotations(d *PdfObjectDictionary) ([]*PdfAnnotation, error)
type PdfRectangle ¶
type PdfRectangle struct { Llx float64 // Lower left corner (ll). Lly float64 Urx float64 // Upper right corner (ur). Ury float64 }
Definition of a rectangle.
func NewPdfRectangle ¶
func NewPdfRectangle(arr PdfObjectArray) (*PdfRectangle, error)
Create 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) ToPdfObject ¶
func (rect *PdfRectangle) ToPdfObject() PdfObject
Convert to a PDF object.
type PdfShading ¶
type PdfShading struct { ShadingType *PdfObjectInteger ColorSpace PdfColorspace Background *PdfObjectArray BBox *PdfRectangle AntiAlias *PdfObjectBool // contains filtered or unexported fields }
There are 7 types of shading, indicated by 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 (this *PdfShading) GetContainingPdfObject() PdfObject
func (*PdfShading) GetContext ¶
func (this *PdfShading) GetContext() PdfModel
Context in this case is a reference to the subshading entry as represented by PdfShadingType1-7.
func (*PdfShading) SetContext ¶
func (this *PdfShading) SetContext(ctx PdfModel)
Set the sub annotation (context).
func (*PdfShading) ToPdfObject ¶
func (this *PdfShading) ToPdfObject() PdfObject
type PdfShadingPattern ¶
type PdfShadingPattern struct { *PdfPattern Shading *PdfShading Matrix *PdfObjectArray ExtGState PdfObject }
Shading patterns 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 (this *PdfShadingPattern) ToPdfObject() PdfObject
type PdfShadingType1 ¶
type PdfShadingType1 struct { *PdfShading Domain *PdfObjectArray Matrix *PdfObjectArray Function PdfFunction }
Shading type 1: Function-based shading.
func (*PdfShadingType1) ToPdfObject ¶
func (this *PdfShadingType1) ToPdfObject() PdfObject
type PdfShadingType2 ¶
type PdfShadingType2 struct { *PdfShading Coords *PdfObjectArray Domain *PdfObjectArray Function PdfFunction Extend *PdfObjectArray }
Shading type 2: Axial shading.
func (*PdfShadingType2) ToPdfObject ¶
func (this *PdfShadingType2) ToPdfObject() PdfObject
type PdfShadingType3 ¶
type PdfShadingType3 struct { *PdfShading Coords *PdfObjectArray Domain *PdfObjectArray Function PdfFunction Extend *PdfObjectArray }
Shading type 3: Radial shading.
func (*PdfShadingType3) ToPdfObject ¶
func (this *PdfShadingType3) ToPdfObject() PdfObject
type PdfShadingType4 ¶
type PdfShadingType4 struct { *PdfShading BitsPerCoordinate *PdfObjectInteger BitsPerComponent *PdfObjectInteger BitsPerFlag *PdfObjectInteger Decode *PdfObjectArray Function PdfFunction }
Shading type 4: Free-form Gouraud-shaded triangle mesh.
func (*PdfShadingType4) ToPdfObject ¶
func (this *PdfShadingType4) ToPdfObject() PdfObject
type PdfShadingType5 ¶
type PdfShadingType5 struct { *PdfShading BitsPerCoordinate *PdfObjectInteger BitsPerComponent *PdfObjectInteger VerticesPerRow *PdfObjectInteger Decode *PdfObjectArray Function PdfFunction }
Shading type 5: Lattice-form Gouraud-shaded triangle mesh.
func (*PdfShadingType5) ToPdfObject ¶
func (this *PdfShadingType5) ToPdfObject() PdfObject
type PdfShadingType6 ¶
type PdfShadingType6 struct { *PdfShading BitsPerCoordinate *PdfObjectInteger BitsPerComponent *PdfObjectInteger BitsPerFlag *PdfObjectInteger Decode *PdfObjectArray Function PdfFunction }
Shading type 6: Coons patch mesh.
func (*PdfShadingType6) ToPdfObject ¶
func (this *PdfShadingType6) ToPdfObject() PdfObject
type PdfShadingType7 ¶
type PdfShadingType7 struct { *PdfShading BitsPerCoordinate *PdfObjectInteger BitsPerComponent *PdfObjectInteger BitsPerFlag *PdfObjectInteger Decode *PdfObjectArray Function PdfFunction }
Shading type 7: Tensor-product patch mesh.
func (*PdfShadingType7) ToPdfObject ¶
func (this *PdfShadingType7) ToPdfObject() PdfObject
type PdfTilingPattern ¶
type PdfTilingPattern struct { *PdfPattern PaintType *PdfObjectInteger // Colored or uncolored tiling pattern. TilingType *PdfObjectInteger // Constant spacing, no distortion or constant spacing/faster tiling. BBox *PdfRectangle XStep *PdfObjectFloat YStep *PdfObjectFloat Resources *PdfPageResources Matrix *PdfObjectArray // Pattern matrix (6 numbers). }
A Tiling pattern 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 (this *PdfTilingPattern) GetContentStream() ([]byte, error)
GetContentStream returns the pattern cell's content stream
func (*PdfTilingPattern) GetContentStreamWithEncoder ¶
func (this *PdfTilingPattern) GetContentStreamWithEncoder() ([]byte, StreamEncoder, error)
GetContentStreamWithEncoder returns the pattern cell's content stream and its encoder TODO (v3): Change GetContentStreamWithEncoder to GetContentStream
func (*PdfTilingPattern) IsColored ¶
func (this *PdfTilingPattern) IsColored() bool
func (*PdfTilingPattern) SetContentStream ¶
func (this *PdfTilingPattern) SetContentStream(content []byte, encoder StreamEncoder) error
Set the pattern cell's content stream.
func (*PdfTilingPattern) ToPdfObject ¶
func (this *PdfTilingPattern) ToPdfObject() PdfObject
type PdfWriter ¶
type PdfWriter struct {
// contains filtered or unexported fields
}
func NewPdfWriter ¶
func NewPdfWriter() PdfWriter
func (*PdfWriter) AddOutlineTree ¶
func (this *PdfWriter) AddOutlineTree(outlineTree *PdfOutlineTreeNode)
Add outlines to a PDF file.
func (*PdfWriter) Encrypt ¶
func (this *PdfWriter) Encrypt(userPass, ownerPass []byte, options *EncryptOptions) error
Encrypt the output file with a specified user/owner password.
func (*PdfWriter) SetForms ¶
func (this *PdfWriter) SetForms(form *PdfAcroForm) error
Add Acroforms to a PDF file. Sets the specified form for writing.
func (*PdfWriter) SetOCProperties ¶
Set the optional content properties.
func (*PdfWriter) SetVersion ¶
Set the PDF version of the output file.
type WatermarkImageOptions ¶
type XObjectForm ¶
type XObjectForm struct { Filter StreamEncoder FormType PdfObject BBox PdfObject Matrix PdfObject Resources *PdfPageResources Group PdfObject Ref PdfObject MetaData PdfObject PieceInfo PdfObject LastModified PdfObject StructParent PdfObject StructParents PdfObject OPI PdfObject OC PdfObject Name PdfObject // Stream data. Stream []byte // contains filtered or unexported fields }
XObjectForm (Table 95 in 8.10.2).
func NewXObjectForm ¶
func NewXObjectForm() *XObjectForm
Create a brand new XObject Form. Creates a new underlying PDF object stream primitive.
func NewXObjectFormFromStream ¶
func NewXObjectFormFromStream(stream *PdfObjectStream) (*XObjectForm, error)
Build the Form XObject from a stream object. XXX: Should this be exposed? Consider different access points.
func (*XObjectForm) GetContainingPdfObject ¶
func (xform *XObjectForm) GetContainingPdfObject() PdfObject
func (*XObjectForm) GetContentStream ¶
func (xform *XObjectForm) GetContentStream() ([]byte, error)
func (*XObjectForm) SetContentStream ¶
func (xform *XObjectForm) SetContentStream(content []byte, encoder StreamEncoder) error
Update the content stream with specified encoding. If encoding is null, will use the xform.Filter object or Raw encoding if not set.
func (*XObjectForm) ToPdfObject ¶
func (xform *XObjectForm) ToPdfObject() PdfObject
Return a stream object.
type XObjectImage ¶
type XObjectImage struct { //ColorSpace PdfObject Width *int64 Height *int64 ColorSpace PdfColorspace BitsPerComponent *int64 Filter StreamEncoder Intent PdfObject ImageMask PdfObject Mask PdfObject Matte PdfObject Decode PdfObject Interpolate PdfObject Alternatives PdfObject SMask PdfObject SMaskInData PdfObject Name PdfObject // Obsolete. Currently read if available and write if available. Not setting on new created files. StructParent PdfObject ID PdfObject OPI PdfObject Metadata PdfObject OC PdfObject Stream []byte // contains filtered or unexported fields }
XObjectImage (Table 89 in 8.9.5.1). Implements PdfModel interface.
func NewXObjectImage ¶
func NewXObjectImage() *XObjectImage
func NewXObjectImageFromImage ¶
func NewXObjectImageFromImage(img *Image, cs PdfColorspace, encoder StreamEncoder) (*XObjectImage, error)
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 *PdfObjectStream) (*XObjectImage, error)
Build 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 StreamEncoder) (*XObjectImage, error)
UpdateXObjectImageFromImage creates a new XObject Image from an Image object `img` and default
masks from xobjIn.
The default masks are overriden if img.hasAlpha If `encoder` is nil, uses raw encoding (none).
func (*XObjectImage) GetContainingPdfObject ¶
func (ximg *XObjectImage) GetContainingPdfObject() PdfObject
func (*XObjectImage) SetFilter ¶
func (ximg *XObjectImage) SetFilter(encoder StreamEncoder) error
Set compression filter. Decodes with current filter sets and encodes the data with the new filter.
func (*XObjectImage) SetImage ¶
func (ximg *XObjectImage) SetImage(img *Image, cs PdfColorspace) error
Update XObject Image with new image data.
func (*XObjectImage) ToImage ¶
func (ximg *XObjectImage) ToImage() (*Image, error)
This will convert to an Image which can be transformed or saved out. The image data is decoded and the Image returned.
func (*XObjectImage) ToPdfObject ¶
func (ximg *XObjectImage) ToPdfObject() PdfObject
Return a stream object.
type XObjectType ¶
type XObjectType int
const ( XObjectTypeUndefined XObjectType = iota XObjectTypeImage XObjectType = iota XObjectTypeForm XObjectType = iota XObjectTypePS XObjectType = iota XObjectTypeUnknown XObjectType = iota )