Package docutil

Overview ▾

type Catalog

Catalog is the type wrapper over raw core.PdfObjectDictionary that contains some object getter helpers.

type Catalog struct {
    Object *core.PdfObjectDictionary
    // contains filtered or unexported fields

func (*Catalog) GetOutputIntents

func (c *Catalog) GetOutputIntents() (*OutputIntents, bool)

GetOutputIntents gets the catalog output intents.

func (*Catalog) GetPages

func (c *Catalog) GetPages() ([]Page, bool)

GetPages gets catalog pages.

func (*Catalog) HasMetadata

func (c *Catalog) HasMetadata() bool

HasMetadata checks if given catalog already has a metadata.

func (*Catalog) NewOutputIntents

func (c *Catalog) NewOutputIntents() *OutputIntents

func (*Catalog) SetMetadata

func (c *Catalog) SetMetadata(meta xmp.Metadata) error

SetMetadata sets the catalog metadata object.

func (*Catalog) SetOutputIntents

func (c *Catalog) SetOutputIntents(outputIntents *OutputIntents)

SetOutputIntents creates a new output intents.

func (*Catalog) SetVersion

func (c *Catalog) SetVersion()

SetVersion sets the catalog dictionary version.

type Content

Content is a wrapper over page content.

type Content struct {
    Object core.PdfObject

func (Content) GetData

func (p Content) GetData() ([]byte, error)

GetData gets the stream data from given content.

type Document

Document is a representation of the Pdf document.

type Document struct {
    ID             [2]string
    Version        core.Version
    Objects        []core.PdfObject
    Info           core.PdfObject
    Crypt          *core.PdfCrypt
    UseHashBasedID bool

func (*Document) AddIndirectObject

func (d *Document) AddIndirectObject(indirect *core.PdfIndirectObject)

AddIndirectObject adds an indirect object to the document.

func (*Document) AddStream

func (d *Document) AddStream(stream *core.PdfObjectStream)

AddStream adds the stream into given objects. Checks if given object doesn't exists already.

func (*Document) FindCatalog

func (d *Document) FindCatalog() (*Catalog, bool)

FindCatalog finds document catalog from the input objects.

func (*Document) GetPages

func (d *Document) GetPages() ([]Page, bool)

GetPages gets all document pages.

type Image

type Image struct {
    Name             string
    Width            int
    Height           int
    Colorspace       core.PdfObjectName
    ColorComponents  int
    BitsPerComponent int
    SMask            *ImageSMask
    Stream           *core.PdfObjectStream

type ImageSMask

type ImageSMask struct {
    Image  *Image
    Stream *core.PdfObjectStream

type OutputIntent

OutputIntent is the wrapper over object that is meant to be an object intent.

type OutputIntent struct {
    Object *core.PdfObjectDictionary

type OutputIntents

OutputIntents is the type wrapper over an object array that is meant to be a catalog OutputIntents.

type OutputIntents struct {
    // contains filtered or unexported fields

func (*OutputIntents) Add

func (o *OutputIntents) Add(oi core.PdfObject) error

Add new output intent into given output intents model.

func (*OutputIntents) Get

func (o *OutputIntents) Get(i int) (OutputIntent, bool)

Get the object intent at the i'th position.

func (*OutputIntents) Len

func (o *OutputIntents) Len() int

Len gets the length of the object intents array.

type Page

Page is a wrapper over the Page core.PdfObjectDictionary.

type Page struct {
    Object *core.PdfObjectDictionary
    // contains filtered or unexported fields

func (Page) FindXObjectImages

func (p Page) FindXObjectImages() ([]*Image, error)

FindXObjectImages finds XObject images for given page.

func (Page) GetContents

func (p Page) GetContents() ([]Content, bool)

GetContents gets all page contents.

func (Page) GetResources

func (p Page) GetResources() (*core.PdfObjectDictionary, bool)

GetResources gets page resources dictionary.

func (Page) GetResourcesXObject

func (p Page) GetResourcesXObject() (*core.PdfObjectDictionary, bool)

GetResourcesXObject gets the page resources XObject.

func (*Page) Number

func (p *Page) Number() int

Number gets the page number.