Documentation
¶
Index ¶
- Variables
- func CheckEOL(e1, e2 byte) bool
- func CheckValidUTF8ToPDFDocEncoding(text []byte) (isValid, isASCIIEqual bool)
- func CheckXRefEntryType(c byte) bool
- func ConvertUTF8ToPDFDocEncoding(text []byte) ([]byte, error)
- func IndexLast(r io.ReadSeeker, what []byte) (pos int64, err error)
- func IsPDFDocEncotingConcidentToUTF8(text []byte) bool
- func IsWhitespace(r rune) bool
- func ResizeSlice[T any](slice []T, size int) []T
- type AcroForm
- type Array
- func (arr *Array) Copy() (Object, error)
- func (arr *Array) Dictionary() *Dictionary
- func (arr *Array) Document() *Document
- func (arr *Array) GetIndirectReference() *Reference
- func (arr *Array) Kind() ObjectKind
- func (arr *Array) MarshalPDF(_ *Writer) error
- func (arr *Array) Parent() Object
- func (arr *Array) SetParent(_ Object)
- type ArrayElement
- type BaseObject
- type CMYKColor
- type Catalog
- func (c *Catalog) GetOrCreateMetadataObject() Object
- func (c *Catalog) Lang() Object
- func (c *Catalog) MarkInfo() Object
- func (c *Catalog) Metadata() Object
- func (c *Catalog) MetadataStream() (stream []byte, err error)
- func (c *Catalog) PageMode() PageMode
- func (c *Catalog) Root() Object
- func (c *Catalog) SetMetadataStream(value []byte) error
- func (c *Catalog) SetPageLayout(layout PageLayout)
- func (c *Catalog) SetPageMode(mode PageMode)
- type CieLabColor
- type Color
- type ColorSpace
- type Dictionary
- func (dict *Dictionary) AddKeyIndirect(name Name, obj Object)
- func (dict *Dictionary) Copy() (Object, error)
- func (dict *Dictionary) Document() *Document
- func (dict *Dictionary) GetIndirectReference() *Reference
- func (dict *Dictionary) Key(name Name) Object
- func (dict *Dictionary) Kind() ObjectKind
- func (dict *Dictionary) MarshalPDF(_ *Writer) error
- func (dict *Dictionary) Parent() Object
- func (dict *Dictionary) SetParent(_ Object)
- type DictionaryElement
- type Document
- type Element
- type Encrypt
- type FileSpec
- type FontManager
- type Generation
- type GrayColor
- type IndirectObjectList
- type Info
- type Marshaler
- type MetaData
- type Name
- type NameObject
- func (name *NameObject) Copy() (Object, error)
- func (name *NameObject) Document() *Document
- func (name *NameObject) GetIndirectReference() *Reference
- func (name *NameObject) Kind() ObjectKind
- func (name *NameObject) MarshalPDF(w *Writer) error
- func (name *NameObject) Parent() Object
- func (name *NameObject) SetParent(parent Object)
- type NameTree
- type Number
- func (num *Number) Copy() (Object, error)
- func (num *Number) Dictionary() *Dictionary
- func (num *Number) Document() *Document
- func (num Number) Float64() float64
- func (num *Number) GetIndirectReference() *Reference
- func (num Number) Int() int
- func (num Number) Int64() int64
- func (num *Number) Kind() ObjectKind
- func (num *Number) MarshalPDF(_ *Writer) error
- func (num *Number) Parent() Object
- func (num *Number) SetParent(_ Object)
- type Object
- type ObjectKind
- type Outlines
- type Page
- type PageCollection
- func (pc *PageCollection) AddPage(size Rect) *Page
- func (pc *PageCollection) AddPageAt(index int, size Rect) (*Page, error)
- func (pc *PageCollection) AppendDocumentPages(document *Document, pageIndex int, count int) error
- func (pc *PageCollection) Index(i int) (*Page, bool)
- func (pc *PageCollection) InsertDocumentPages(index int, document *Document, pageIndex int, count int) error
- func (pc *PageCollection) Len() int
- func (pc *PageCollection) RemovePage(index int) bool
- type PageLayout
- type PageMode
- type PageSize
- type PageSizeFunc
- type Pos
- type RGBColor
- type Rect
- type Reference
- type SeparationColor
- type Size
- type Trailer
- type UTF8ToPDFDocEncoder
- type Variant
- type Version
- type WriteFlag
- type Writer
- type WriterOptionFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnsupportedChars = errors.New("unsupported chars") ErrDstTooShort = errors.New("destination buffer is too short") )
View Source
var ( ErrValueOutOfRange = errors.New("value out of range") ErrNotImplemented = errors.New("not implemented") ErrCannotConvertColor = errors.New("cannot convert color") )
View Source
var ErrUnsupportedVersion = errors.New("unsupported pdf version")
Functions ¶
func CheckXRefEntryType ¶
func IsWhitespace ¶
func ResizeSlice ¶
Types ¶
type Array ¶
type Array struct{}
func (*Array) Dictionary ¶
func (arr *Array) Dictionary() *Dictionary
func (*Array) GetIndirectReference ¶
func (*Array) Kind ¶
func (arr *Array) Kind() ObjectKind
func (*Array) MarshalPDF ¶
MarshalPDF encodes the receiver a PDF bytes.
type ArrayElement ¶
type ArrayElement struct{ Element }
func (*ArrayElement) Array ¶
func (e *ArrayElement) Array() *Array
type BaseObject ¶
type BaseObject struct {
// contains filtered or unexported fields
}
func (*BaseObject) Copy ¶
func (obj *BaseObject) Copy() (BaseObject, error)
func (*BaseObject) DelayedLoadStream ¶
func (obj *BaseObject) DelayedLoadStream() error
func (*BaseObject) Document ¶
func (obj *BaseObject) Document() *Document
func (*BaseObject) GetIndirectReference ¶
func (obj *BaseObject) GetIndirectReference() *Reference
func (*BaseObject) Parent ¶
func (obj *BaseObject) Parent() Object
func (*BaseObject) SetParent ¶
func (obj *BaseObject) SetParent(parent Object)
type CMYKColor ¶
func ConvertToCMYK ¶
func (CMYKColor) ColorSpace ¶
func (cmyk CMYKColor) ColorSpace() ColorSpace
func (*CMYKColor) UnmarshalText ¶
type Catalog ¶
type Catalog struct {
DictionaryElement
}
func (*Catalog) GetOrCreateMetadataObject ¶
func (*Catalog) MetadataStream ¶
func (*Catalog) SetMetadataStream ¶
func (*Catalog) SetPageLayout ¶
func (c *Catalog) SetPageLayout(layout PageLayout)
func (*Catalog) SetPageMode ¶
type CieLabColor ¶
type CieLabColor struct { // CieL indicates lightness. CieL float64 // CieA indicates A color value. CieA float64 // CieB indicates B color value. CieB float64 }
func (CieLabColor) ColorSpace ¶
func (lab CieLabColor) ColorSpace() ColorSpace
func (CieLabColor) Validate ¶
func (lab CieLabColor) Validate() error
type Color ¶
type Color interface { ColorSpace() ColorSpace Validate() error }
func ColorFromObject ¶
func ParseColor ¶
func TransparentColor ¶
func TransparentColor() Color
type ColorSpace ¶
type ColorSpace uint8
ColorSpace is an enum for the colorspaces supported by PDF.
const ( // ColorSpaceUnknown is an uknown colorspace. ColorSpaceUnknown ColorSpace = iota ColorSpaceDeviceGray ColorSpaceDeviceRGB ColorSpaceDeviceCMYK ColorSpaceCalGray ColorSpaceCalRGB ColorSpaceLab ///< CIE-Lab ColorSpaceICCBased ColorSpaceIndexed ColorSpacePattern ColorSpaceSeparation ColorSpaceDeviceN )
type Dictionary ¶
type Dictionary struct{}
func (*Dictionary) AddKeyIndirect ¶
func (dict *Dictionary) AddKeyIndirect(name Name, obj Object)
func (*Dictionary) Copy ¶
func (dict *Dictionary) Copy() (Object, error)
func (*Dictionary) Document ¶
func (dict *Dictionary) Document() *Document
func (*Dictionary) GetIndirectReference ¶
func (dict *Dictionary) GetIndirectReference() *Reference
func (*Dictionary) Key ¶
func (dict *Dictionary) Key(name Name) Object
func (*Dictionary) Kind ¶
func (dict *Dictionary) Kind() ObjectKind
func (*Dictionary) MarshalPDF ¶
func (dict *Dictionary) MarshalPDF(_ *Writer) error
MarshalPDF encodes the receiver a PDF bytes.
func (*Dictionary) Parent ¶
func (dict *Dictionary) Parent() Object
func (*Dictionary) SetParent ¶
func (dict *Dictionary) SetParent(_ Object)
type DictionaryElement ¶
type DictionaryElement struct{ Element }
func (*DictionaryElement) Dictionary ¶
func (e *DictionaryElement) Dictionary() *Dictionary
type Document ¶
type Document struct {
Objects []Object
}
func NewDocument ¶
func NewDocument() *Document
type FontManager ¶
type FontManager struct{}
type GrayColor ¶
func ConvertToGrayScale ¶
func (GrayColor) ColorSpace ¶
func (gray GrayColor) ColorSpace() ColorSpace
func (*GrayColor) UnmarshalText ¶
type IndirectObjectList ¶
type IndirectObjectList struct{}
type Marshaler ¶
type Marshaler interface { // MarshalPDF encodes the receiver a PDF bytes. MarshalPDF(*Writer) error }
Marshaler is the interface implemented by PDF objects that can marshal themselves into valid PDF stream.
type Name ¶
type Name string
const ( KeyNull Name = "" KeyContents Name = "Contents" KeyCount Name = "Count" KeyEncrypt Name = "Encrypt" KeyFilter Name = "Filter" KeyFlags Name = "Flags" KeyID Name = "ID" KeyInfo Name = "Info" KeyLength Name = "Length" KeyRect Name = "Rect" KeyRoot Name = "Root" KeySize Name = "Size" KeySubtype Name = "Subtype" KeyType Name = "Type" KeyMetadata Name = "Metadata" KeyTreeRoot Name = "StructTreeRoot" KeyMarkInfo Name = "MarkInfo" KeyLang Name = "Lang" KeyPageMode Name = "PageMode" NameXRef Name = "XRef" )
type NameObject ¶
type NameObject struct { BaseObject Name Name }
func (*NameObject) Copy ¶
func (name *NameObject) Copy() (Object, error)
func (*NameObject) Document ¶
func (name *NameObject) Document() *Document
func (*NameObject) GetIndirectReference ¶
func (name *NameObject) GetIndirectReference() *Reference
func (*NameObject) Kind ¶
func (name *NameObject) Kind() ObjectKind
func (*NameObject) MarshalPDF ¶
func (name *NameObject) MarshalPDF(w *Writer) error
func (*NameObject) Parent ¶
func (name *NameObject) Parent() Object
func (*NameObject) SetParent ¶
func (name *NameObject) SetParent(parent Object)
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
func (*Number) Dictionary ¶
func (num *Number) Dictionary() *Dictionary
func (*Number) GetIndirectReference ¶
func (*Number) Kind ¶
func (num *Number) Kind() ObjectKind
func (*Number) MarshalPDF ¶
MarshalPDF encodes the receiver a PDF bytes.
type Object ¶
type Object interface { Marshaler SetParent(Object) Parent() Object Kind() ObjectKind Copy() (Object, error) Document() *Document Dictionary() *Dictionary GetIndirectReference() *Reference }
type ObjectKind ¶
type ObjectKind uint8
const ( // ObjectKindUnknown ObjectKindUnknown ObjectKind = iota // ObjectKindBool ObjectKindBool // ObjectKindNumber ObjectKindNumber // ObjectKindString ObjectKindString // ObjectKindName ObjectKindName // ObjectKindArray ObjectKindArray // ObjectKindDictionary ObjectKindDictionary // ObjectKindNull ObjectKindNull // ObjectKindReference ObjectKindReference // ObjectKindRawData ObjectKindRawData )
type PageCollection ¶
type PageCollection struct {
// contains filtered or unexported fields
}
func NewPageCollection ¶
func NewPageCollection(document *Document) *PageCollection
func (*PageCollection) AddPage ¶
func (pc *PageCollection) AddPage(size Rect) *Page
func (*PageCollection) AddPageAt ¶
func (pc *PageCollection) AddPageAt(index int, size Rect) (*Page, error)
func (*PageCollection) AppendDocumentPages ¶
func (pc *PageCollection) AppendDocumentPages( document *Document, pageIndex int, count int, ) error
func (*PageCollection) InsertDocumentPages ¶
func (*PageCollection) Len ¶
func (pc *PageCollection) Len() int
func (*PageCollection) RemovePage ¶
func (pc *PageCollection) RemovePage(index int) bool
type PageLayout ¶
type PageLayout uint8
const ( PageLayoutIgnore PageLayout = iota PageLayoutDefault PageLayoutSinglePage PageLayoutOneColumn PageLayoutTwoColumnLeft PageLayoutTwoColumnRight PageLayoutTwoPageLeft PageLayoutTwoPageRight )
type PageSizeFunc ¶
type PageSizeFunc func() Rect
func (PageSizeFunc) PageSize ¶
func (f PageSizeFunc) PageSize() Rect
type RGBColor ¶
func ConvertToRGB ¶
func (RGBColor) ColorSpace ¶
func (rgb RGBColor) ColorSpace() ColorSpace
func (*RGBColor) UnmarshalText ¶
type Rect ¶
func PageSizeA0 ¶
func PageSizeA0() Rect
func PageSizeA1 ¶
func PageSizeA1() Rect
func PageSizeA2 ¶
func PageSizeA2() Rect
func PageSizeA3 ¶
func PageSizeA3() Rect
func PageSizeA4 ¶
func PageSizeA4() Rect
func PageSizeA5 ¶
func PageSizeA5() Rect
func PageSizeA6 ¶
func PageSizeA6() Rect
func PageSizeLegal ¶
func PageSizeLegal() Rect
func PageSizeLetter ¶
func PageSizeLetter() Rect
func PageSizeTabloid ¶
func PageSizeTabloid() Rect
type Reference ¶
type Reference struct { ObjectNo uint32 GenerationNo Generation }
func (Reference) IsIndirect ¶
func (Reference) MarshalPDF ¶
type SeparationColor ¶
func SeparationColorAll ¶
func SeparationColorAll() SeparationColor
func SeparationColorNone ¶
func SeparationColorNone() SeparationColor
func (SeparationColor) ColorSpace ¶
func (sep SeparationColor) ColorSpace() ColorSpace
func (SeparationColor) Validate ¶
func (sep SeparationColor) Validate() error
type UTF8ToPDFDocEncoder ¶
type UTF8ToPDFDocEncoder struct {
// contains filtered or unexported fields
}
func NewUTF8ToDocEncoder ¶
func NewUTF8ToDocEncoder(w io.Writer) *UTF8ToPDFDocEncoder
func (*UTF8ToPDFDocEncoder) Close ¶
func (enc *UTF8ToPDFDocEncoder) Close() error
func (*UTF8ToPDFDocEncoder) Reset ¶
func (enc *UTF8ToPDFDocEncoder) Reset(w io.Writer)
type Version ¶
type Version string
Version is an enumeration for supported PDF versions.
const ( // Version10 PDF 1.0. Version10 Version = "1.0" // Version11 PDF 1.1. Version11 Version = "1.1" // Version12 PDF 1.2. Version12 Version = "1.2" // Version13 PDF 1.3. Version13 Version = "1.3" // Version14 PDF 1.4. Version14 Version = "1.4" // Version15 PDF 1.5. Version15 Version = "1.5" // Version16 PDF 1.6. Version16 Version = "1.6" // Version17 PDF 1.7. Version17 Version = "1.7" // Version20 PDF 2.0 Version20 Version = "2.0" )
type WriteFlag ¶
type WriteFlag uint16
WriteFlag is the flag that is used by the pdf.Writer.
const ( // WriteFlagClean is used to created a PDF // that is readable in a text editor, i.e. // isert spaces and linebreaks between tokens. WriteFlagClean WriteFlag = 1 << iota // WriteFlagNoInlineLiteral is used to prevent writing spaces before literal types // (numerical, references, null). WriteFlagNoInlineLiteral // WriteFlagNoFlateCompress is used to write // PDF with Flate compression. WriteFlagNoFlateCompress // WriteFlagNoPDFAPreserve is used to write // compact (WriteFlagsClean is unsed) code, // preserving PDF/A compliance is not required. WriteFlagNoPDFAPreserve WriteFlag = 256 )
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) IsCleanWrite ¶
type WriterOptionFunc ¶
type WriterOptionFunc func(*Writer)
func WriteClean ¶
func WriteClean() WriterOptionFunc
func WriteEncryptor ¶
func WriteEncryptor(encrypt *Encrypt) WriterOptionFunc
func WriteNoCompress ¶
func WriteNoCompress() WriterOptionFunc
func WriteNoInlineLiteral ¶
func WriteNoInlineLiteral() WriterOptionFunc
func WriteNoPDFAPreserve ¶
func WriteNoPDFAPreserve() WriterOptionFunc
Source Files
¶
- acro_form.go
- array.go
- catalog.go
- color.go
- decl.go
- dictionary.go
- document.go
- element.go
- encoding.go
- encrypt.go
- errors.go
- file_spec.go
- font_manager.go
- indirect_object_list.go
- info.go
- marshal.go
- meta_data.go
- name.go
- name_tree.go
- named_color.go
- number.go
- object.go
- outlines.go
- page.go
- page_collection.go
- page_size.go
- pdf.go
- reference.go
- trailer.go
- variant.go
- version.go
Click to show internal directories.
Click to hide internal directories.