Versions in this module Expand all Collapse all v1 v1.2.0 Aug 8, 2023 v1.1.0 Aug 8, 2023 Changes in this version + const DefaultJPEGQuality + const JB2ImageAutoThreshold + const StreamEncodingFilterNameASCII85 + const StreamEncodingFilterNameASCIIHex + const StreamEncodingFilterNameCCITTFax + const StreamEncodingFilterNameDCT + const StreamEncodingFilterNameFlate + const StreamEncodingFilterNameJBIG2 + const StreamEncodingFilterNameJPX + const StreamEncodingFilterNameLZW + const StreamEncodingFilterNameRaw + const StreamEncodingFilterNameRunLength + const XrefTypeObjectStream + const XrefTypeTableEntry + var ErrNoCCITTFaxDecode = errors.New("CCITTFaxDecode encoding is not yet implemented") + var ErrNoJBIG2Decode = errors.New("JBIG2Decode encoding is not yet implemented") + var ErrNoJPXDecode = errors.New("JPXDecode encoding is not yet implemented") + var ErrNoPdfVersion = errors.New("version not found") + var ErrNotANumber = errors.New("not a number") + var ErrNotSupported = errors.New("feature not currently supported") + var ErrRangeError = errors.New("range check error") + var ErrTypeError = errors.New("type check error") + var ErrUnsupportedEncodingParameters = errors.New("unsupported encoding parameters") + func DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func EncodeStream(streamObj *PdfObjectStream) error + func EqualObjects(obj1, obj2 PdfObject) bool + func GetBoolVal(obj PdfObject) (b bool, found bool) + func GetFloatVal(obj PdfObject) (val float64, found bool) + func GetIntVal(obj PdfObject) (val int, found bool) + func GetNameVal(obj PdfObject) (val string, found bool) + func GetNumberAsFloat(obj PdfObject) (float64, error) + func GetNumberAsInt64(obj PdfObject) (int64, error) + func GetNumbersAsFloat(objects []PdfObject) (floats []float64, err error) + func GetStringBytes(obj PdfObject) (val []byte, found bool) + func GetStringVal(obj PdfObject) (val string, found bool) + func IsDecimalDigit(c byte) bool + func IsDelimiter(c byte) bool + func IsFloatDigit(c byte) bool + func IsNullObject(obj PdfObject) bool + func IsOctalDigit(c byte) bool + func IsPrintable(c byte) bool + func IsWhiteSpace(ch byte) bool + func PdfCryptNewEncrypt(cf crypto.Filter, userPass, ownerPass []byte, perm security.Permissions) (*PdfCrypt, *EncryptInfo, error) + func ResolveReferencesDeep(o PdfObject, traversed map[PdfObject]struct{}) error + type ASCII85Encoder struct + func NewASCII85Encoder() *ASCII85Encoder + func (enc *ASCII85Encoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *ASCII85Encoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *ASCII85Encoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *ASCII85Encoder) GetFilterName() string + func (enc *ASCII85Encoder) MakeDecodeParams() PdfObject + func (enc *ASCII85Encoder) MakeStreamDict() *PdfObjectDictionary + func (enc *ASCII85Encoder) UpdateParams(params *PdfObjectDictionary) + type ASCIIHexEncoder struct + func NewASCIIHexEncoder() *ASCIIHexEncoder + func (enc *ASCIIHexEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *ASCIIHexEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *ASCIIHexEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *ASCIIHexEncoder) GetFilterName() string + func (enc *ASCIIHexEncoder) MakeDecodeParams() PdfObject + func (enc *ASCIIHexEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *ASCIIHexEncoder) UpdateParams(params *PdfObjectDictionary) + type CCITTFaxEncoder struct + BlackIs1 bool + Columns int + DamagedRowsBeforeError int + EncodedByteAlign bool + EndOfBlock bool + EndOfLine bool + K int + Rows int + func NewCCITTFaxEncoder() *CCITTFaxEncoder + func (enc *CCITTFaxEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *CCITTFaxEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *CCITTFaxEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *CCITTFaxEncoder) GetFilterName() string + func (enc *CCITTFaxEncoder) MakeDecodeParams() PdfObject + func (enc *CCITTFaxEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *CCITTFaxEncoder) UpdateParams(params *PdfObjectDictionary) + type DCTEncoder struct + BitsPerComponent int + ColorComponents int + Height int + Quality int + Width int + func NewDCTEncoder() *DCTEncoder + func (enc *DCTEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *DCTEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *DCTEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *DCTEncoder) GetFilterName() string + func (enc *DCTEncoder) MakeDecodeParams() PdfObject + func (enc *DCTEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *DCTEncoder) UpdateParams(params *PdfObjectDictionary) + type DrawableImage interface + At func(x, y int) gocolor.Color + Bounds func() goimage.Rectangle + ColorModel func() gocolor.Model + Set func(x, y int, c gocolor.Color) + type EncryptInfo struct + Encrypt *PdfObjectDictionary + ID0 string + ID1 string + type FlateEncoder struct + BitsPerComponent int + Colors int + Columns int + Predictor int + func NewFlateEncoder() *FlateEncoder + func (enc *FlateEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *FlateEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *FlateEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *FlateEncoder) GetFilterName() string + func (enc *FlateEncoder) MakeDecodeParams() PdfObject + func (enc *FlateEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *FlateEncoder) SetPredictor(columns int) + func (enc *FlateEncoder) UpdateParams(params *PdfObjectDictionary) + type JBIG2CompressionType int + const JB2Generic + const JB2SymbolCorrelation + const JB2SymbolRankHaus + type JBIG2Encoder struct + BitsPerComponent int + ColorComponents int + DefaultPageSettings JBIG2EncoderSettings + Globals jbig2.Globals + Height int + IsChocolateData bool + Width int + func NewJBIG2Encoder() *JBIG2Encoder + func (enc *JBIG2Encoder) AddPageImage(img *JBIG2Image, settings *JBIG2EncoderSettings) (err error) + func (enc *JBIG2Encoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *JBIG2Encoder) DecodeGlobals(encoded []byte) (jbig2.Globals, error) + func (enc *JBIG2Encoder) DecodeImages(encoded []byte) ([]image.Image, error) + func (enc *JBIG2Encoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *JBIG2Encoder) Encode() (data []byte, err error) + func (enc *JBIG2Encoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *JBIG2Encoder) EncodeImage(img image.Image) ([]byte, error) + func (enc *JBIG2Encoder) EncodeJBIG2Image(img *JBIG2Image) ([]byte, error) + func (enc *JBIG2Encoder) GetFilterName() string + func (enc *JBIG2Encoder) MakeDecodeParams() PdfObject + func (enc *JBIG2Encoder) MakeStreamDict() *PdfObjectDictionary + func (enc *JBIG2Encoder) UpdateParams(params *PdfObjectDictionary) + type JBIG2EncoderSettings struct + Compression JBIG2CompressionType + DefaultPixelValue uint8 + DuplicatedLinesRemoval bool + FileMode bool + ResolutionX int + ResolutionY int + Threshold float64 + func (s JBIG2EncoderSettings) Validate() error + type JBIG2Image struct + Data []byte + HasPadding bool + Height int + Width int + func GoImageToJBIG2(i image.Image, bwThreshold float64) (*JBIG2Image, error) + func (j *JBIG2Image) ToGoImage() (image.Image, error) + type JPXEncoder struct + func NewJPXEncoder() *JPXEncoder + func (enc *JPXEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *JPXEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *JPXEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *JPXEncoder) GetFilterName() string + func (enc *JPXEncoder) MakeDecodeParams() PdfObject + func (enc *JPXEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *JPXEncoder) UpdateParams(params *PdfObjectDictionary) + type LZWEncoder struct + BitsPerComponent int + Colors int + Columns int + EarlyChange int + Predictor int + func NewLZWEncoder() *LZWEncoder + func (enc *LZWEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *LZWEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *LZWEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *LZWEncoder) GetFilterName() string + func (enc *LZWEncoder) MakeDecodeParams() PdfObject + func (enc *LZWEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *LZWEncoder) UpdateParams(params *PdfObjectDictionary) + type MultiEncoder struct + func NewMultiEncoder() *MultiEncoder + func (enc *MultiEncoder) AddEncoder(encoder StreamEncoder) + func (enc *MultiEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *MultiEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *MultiEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *MultiEncoder) GetFilterName() string + func (enc *MultiEncoder) MakeDecodeParams() PdfObject + func (enc *MultiEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *MultiEncoder) UpdateParams(params *PdfObjectDictionary) + type PdfCrypt struct + func PdfCryptNewDecrypt(parser *PdfParser, ed, trailer *PdfObjectDictionary) (*PdfCrypt, error) + func (crypt *PdfCrypt) Decrypt(obj PdfObject, parentObjNum, parentGenNum int64) error + func (crypt *PdfCrypt) Encrypt(obj PdfObject, parentObjNum, parentGenNum int64) error + func (crypt *PdfCrypt) GetAccessPermissions() security.Permissions + func (crypt *PdfCrypt) String() string + type PdfIndirectObject struct + func GetIndirect(obj PdfObject) (ind *PdfIndirectObject, found bool) + func MakeIndirectObject(obj PdfObject) *PdfIndirectObject + func (ind *PdfIndirectObject) String() string + func (ind *PdfIndirectObject) WriteString() string + type PdfObject interface + String func() string + WriteString func() string + func FlattenObject(obj PdfObject) PdfObject + func ParseNumber(buf *bufio.Reader) (PdfObject, error) + func ResolveReference(obj PdfObject) PdfObject + func TraceToDirectObject(obj PdfObject) PdfObject + type PdfObjectArray struct + func GetArray(obj PdfObject) (arr *PdfObjectArray, found bool) + func MakeArray(objects ...PdfObject) *PdfObjectArray + func MakeArrayFromFloats(vals []float64) *PdfObjectArray + func MakeArrayFromIntegers(vals []int) *PdfObjectArray + func MakeArrayFromIntegers64(vals []int64) *PdfObjectArray + func (array *PdfObjectArray) Append(objects ...PdfObject) + func (array *PdfObjectArray) Clear() + func (array *PdfObjectArray) Elements() []PdfObject + func (array *PdfObjectArray) Get(i int) PdfObject + func (array *PdfObjectArray) GetAsFloat64Slice() ([]float64, error) + func (array *PdfObjectArray) Len() int + func (array *PdfObjectArray) Set(i int, obj PdfObject) error + func (array *PdfObjectArray) String() string + func (array *PdfObjectArray) ToFloat64Array() ([]float64, error) + func (array *PdfObjectArray) ToInt64Slice() ([]int64, error) + func (array *PdfObjectArray) ToIntegerArray() ([]int, error) + func (array *PdfObjectArray) WriteString() string + type PdfObjectBool bool + func GetBool(obj PdfObject) (bo *PdfObjectBool, found bool) + func MakeBool(val bool) *PdfObjectBool + func (bool *PdfObjectBool) String() string + func (bool *PdfObjectBool) WriteString() string + type PdfObjectDictionary struct + func GetDict(obj PdfObject) (dict *PdfObjectDictionary, found bool) + func MakeDict() *PdfObjectDictionary + func (d *PdfObjectDictionary) Clear() + func (d *PdfObjectDictionary) Get(key PdfObjectName) PdfObject + func (d *PdfObjectDictionary) GetString(key PdfObjectName) (string, bool) + func (d *PdfObjectDictionary) Keys() []PdfObjectName + func (d *PdfObjectDictionary) Merge(another *PdfObjectDictionary) *PdfObjectDictionary + func (d *PdfObjectDictionary) Remove(key PdfObjectName) + func (d *PdfObjectDictionary) Set(key PdfObjectName, val PdfObject) + func (d *PdfObjectDictionary) SetIfNotNil(key PdfObjectName, val PdfObject) + func (d *PdfObjectDictionary) String() string + func (d *PdfObjectDictionary) WriteString() string + type PdfObjectFloat float64 + func GetFloat(obj PdfObject) (fo *PdfObjectFloat, found bool) + func MakeFloat(val float64) *PdfObjectFloat + func (float *PdfObjectFloat) String() string + func (float *PdfObjectFloat) WriteString() string + type PdfObjectInteger int64 + func GetInt(obj PdfObject) (into *PdfObjectInteger, found bool) + func MakeInteger(val int64) *PdfObjectInteger + func (int *PdfObjectInteger) String() string + func (int *PdfObjectInteger) WriteString() string + type PdfObjectName string + func GetName(obj PdfObject) (name *PdfObjectName, found bool) + func MakeName(s string) *PdfObjectName + func (name *PdfObjectName) String() string + func (name *PdfObjectName) WriteString() string + type PdfObjectNull struct + func MakeNull() *PdfObjectNull + func (null *PdfObjectNull) String() string + func (null *PdfObjectNull) WriteString() string + type PdfObjectReference struct + GenerationNumber int64 + ObjectNumber int64 + func (ref *PdfObjectReference) GetParser() *PdfParser + func (ref *PdfObjectReference) Resolve() PdfObject + func (ref *PdfObjectReference) String() string + func (ref *PdfObjectReference) WriteString() string + type PdfObjectStream struct + Stream []byte + func GetStream(obj PdfObject) (stream *PdfObjectStream, found bool) + func MakeStream(contents []byte, encoder StreamEncoder) (*PdfObjectStream, error) + func (stream *PdfObjectStream) String() string + func (stream *PdfObjectStream) WriteString() string + type PdfObjectStreams struct + func GetObjectStreams(obj PdfObject) (objStream *PdfObjectStreams, found bool) + func MakeObjectStreams(objects ...PdfObject) *PdfObjectStreams + func (streams *PdfObjectStreams) Append(objects ...PdfObject) + func (streams *PdfObjectStreams) Elements() []PdfObject + func (streams *PdfObjectStreams) Len() int + func (streams *PdfObjectStreams) Set(i int, obj PdfObject) error + func (streams *PdfObjectStreams) String() string + func (streams *PdfObjectStreams) WriteString() string + type PdfObjectString struct + func GetString(obj PdfObject) (so *PdfObjectString, found bool) + func MakeEncodedString(s string, utf16BE bool) *PdfObjectString + func MakeHexString(s string) *PdfObjectString + func MakeString(s string) *PdfObjectString + func MakeStringFromBytes(data []byte) *PdfObjectString + func (str *PdfObjectString) Bytes() []byte + func (str *PdfObjectString) Decoded() string + func (str *PdfObjectString) Str() string + func (str *PdfObjectString) String() string + func (str *PdfObjectString) WriteString() string + type PdfParser struct + ObjCache objectCache + func NewParser(rs io.ReadSeeker) (*PdfParser, error) + func NewParserFromString(txt string) *PdfParser + func (parser *PdfParser) CheckAccessRights(password []byte) (bool, security.Permissions, error) + func (parser *PdfParser) Decrypt(password []byte) (bool, error) + func (parser *PdfParser) GetCrypter() *PdfCrypt + func (parser *PdfParser) GetFileOffset() int64 + func (parser *PdfParser) GetObjectNums() []int + func (parser *PdfParser) GetTrailer() *PdfObjectDictionary + func (parser *PdfParser) GetXrefOffset() int64 + func (parser *PdfParser) GetXrefTable() XrefTable + func (parser *PdfParser) GetXrefType() *xrefType + func (parser *PdfParser) Inspect() (map[string]int, error) + func (parser *PdfParser) IsAuthenticated() bool + func (parser *PdfParser) IsEncrypted() (bool, error) + func (parser *PdfParser) LookupByNumber(objNumber int) (PdfObject, error) + func (parser *PdfParser) LookupByReference(ref PdfObjectReference) (PdfObject, error) + func (parser *PdfParser) ParseDict() (*PdfObjectDictionary, error) + func (parser *PdfParser) ParseIndirectObject() (PdfObject, error) + func (parser *PdfParser) PdfVersion() Version + func (parser *PdfParser) ReadAtLeast(p []byte, n int) (int, error) + func (parser *PdfParser) ReadBytesAt(offset, len int64) ([]byte, error) + func (parser *PdfParser) Resolve(obj PdfObject) (PdfObject, error) + func (parser *PdfParser) SetFileOffset(offset int64) + type RawEncoder struct + func NewRawEncoder() *RawEncoder + func (enc *RawEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *RawEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *RawEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *RawEncoder) GetFilterName() string + func (enc *RawEncoder) MakeDecodeParams() PdfObject + func (enc *RawEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *RawEncoder) UpdateParams(params *PdfObjectDictionary) + type RunLengthEncoder struct + func NewRunLengthEncoder() *RunLengthEncoder + func (enc *RunLengthEncoder) DecodeBytes(encoded []byte) ([]byte, error) + func (enc *RunLengthEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error) + func (enc *RunLengthEncoder) EncodeBytes(data []byte) ([]byte, error) + func (enc *RunLengthEncoder) GetFilterName() string + func (enc *RunLengthEncoder) MakeDecodeParams() PdfObject + func (enc *RunLengthEncoder) MakeStreamDict() *PdfObjectDictionary + func (enc *RunLengthEncoder) UpdateParams(params *PdfObjectDictionary) + type StreamEncoder interface + DecodeBytes func(encoded []byte) ([]byte, error) + DecodeStream func(streamObj *PdfObjectStream) ([]byte, error) + EncodeBytes func(data []byte) ([]byte, error) + GetFilterName func() string + MakeDecodeParams func() PdfObject + MakeStreamDict func() *PdfObjectDictionary + UpdateParams func(params *PdfObjectDictionary) + func NewEncoderFromStream(streamObj *PdfObjectStream) (StreamEncoder, error) + type Version struct + Major int + Minor int + func (v Version) String() string + type XrefObject struct + Generation int + ObjectNumber int + Offset int64 + OsObjIndex int + OsObjNumber int + XType xrefType + type XrefTable struct + ObjectMap map[int]XrefObject