Versions in this module Expand all Collapse all v1 v1.1.2 Nov 21, 2019 Changes in this version type SplitData + func (s *SplitData) Reset() error v1.1.1 Nov 10, 2019 Changes in this version type SplitData + func (s *SplitData) GetRawData(i int) ([]byte, error) v1.1.0 Nov 10, 2019 Changes in this version type SplitData + func ReadXRefTable(rs io.ReadSeeker, fileName string, fileSize int64, config *Configuration) (*SplitData, error) type StreamDict + func ExtractFontFromDict(ctx *Context, dict Dict, objNr int) (*StreamDict, error) v1.0.0 Oct 1, 2019 Changes in this version + const BottomCenter + const BottomLeft + const BottomRight + const CalGrayCS + const CalRGBCS + const Center + const DeviceCMYKCS + const DeviceGrayCS + const DeviceNCS + const DeviceRGBCS + const DownLeft + const DownRight + const EolCR + const EolCRLF + const EolLF + const FreeHeadGeneration + const Full + const ICCBasedCS + const IndexedCS + const LabCS + const Left + const LeftDown + const ObjectStreamMaxObjects + const PDFCPULongVersion + const PDFCPUVersion + const PageAA + const PageAnnots + const PageArtBox + const PageB + const PageBleedBox + const PageBoxColorInfo + const PageContents + const PageCropBox + const PageDur + const PageGroup + const PageID + const PageLastModified + const PageMediaBox + const PageMetadata + const PagePZ + const PagePieceInfo + const PagePresSteps + const PageResources + const PageRotate + const PageSeparationInfo + const PageStructParents + const PageTabs + const PageTemplateInstantiated + const PageThumb + const PageTrans + const PageTrimBox + const PageUserUnit + const PageVP + const PatternCS + const PermissionsAll + const PermissionsNone + const Right + const RightDown + const RootAA + const RootAcroForm + const RootCollection + const RootDests + const RootExtensions + const RootLang + const RootLegal + const RootMarkInfo + const RootMetadata + const RootNames + const RootNeedsRendering + const RootOCProperties + const RootOpenAction + const RootOutlines + const RootOutputIntents + const RootPageLabels + const RootPageLayout + const RootPageMode + const RootPerms + const RootPieceInfo + const RootRequirements + const RootSpiderInfo + const RootStructTreeRoot + const RootThreads + const RootURI + const RootVersion + const RootViewerPrefs + const SeparationCS + const StatsFileNameDefault + const TopCenter + const TopLeft + const TopRight + const ValidationRelaxed + const ValidationStrict + var ErrUnsupported16BPC = errors.New("unsupported 16 bits per component") + var ErrUnsupportedColorSpace = errors.New("unsupported color space") + var ErrUnsupportedTIFFCreation = errors.New("unsupported tiff file creation") + var PaperSize = map[string]*dim + func AddWatermarks(ctx *Context, selectedPages IntSet, wm *Watermark) error + func AppendPageTree(d1 *IndirectRef, countd1 int, d2 *Dict) error + func AppendStatsFile(ctx *Context) error + func AttachAdd(xRefTable *XRefTable, files StringSet) (ok bool, err error) + func AttachExtract(ctx *Context, files StringSet) (err error) + func AttachList(xRefTable *XRefTable) (list []string, err error) + func AttachRemove(xRefTable *XRefTable, files StringSet) (ok bool, err error) + func CreatePDF(xRefTable *XRefTable, dirName, fileName string) error + func DateString(t time.Time) string + func DecodeUTF16String(s string) (string, error) + func Escape(s string) (*string, error) + func ExtractAllFontData(ctx *Context, objNr int) (*FontObject, *StreamDict, error) + func ExtractStreamData(ctx *Context, objNr int) (data []byte, err error) + func HexLiteralToString(hexString string) (string, error) + func IntMemberOf(i int, list []int) bool + func IsStringUTF16BE(s string) bool + func IsUTF16BE(b []byte) (ok bool, err error) + func MemberOf(s string, list []string) bool + func MergeXRefTables(ctxSource, ctxDest *Context) (err error) + func NUpFromPDF(ctx *Context, selectedPages IntSet, nup *NUp) error + func OptimizeXRefTable(ctx *Context) error + func ParseNUpDetails(s string, nup *NUp) error + func ParseNUpGridDefinition(s1, s2 string, nUp *NUp) error + func ParseNUpValue(s string, nUp *NUp) error + func Permissions(ctx *Context) (list []string) + func RotatePages(ctx *Context, selectedPages IntSet, rotation int) error + func StringLiteralToString(s string) (string, error) + func TimingStats(op string, durRead, durVal, durOpt, durWrite, durTotal float64) + func Unescape(s string) ([]byte, error) + func ValidationTimingStats(dur1, dur2, dur float64) + func Write(ctx *Context) error + func WriteImage(xRefTable *XRefTable, filename string, sd *StreamDict, objNr int) (fileName string, err error) + type Array []Object + func NewIntegerArray(fVars ...int) Array + func NewNameArray(sVars ...string) Array + func NewNumberArray(fVars ...float64) Array + func NewStringArray(sVars ...string) Array + func (a Array) PDFString() string + func (a Array) String() string + type Boolean bool + func (boolean Boolean) PDFString() string + func (boolean Boolean) String() string + func (boolean Boolean) Value() bool + type ByteSize float64 + const GB + const KB + const MB + func (b ByteSize) String() string + type CommandMode int + const ADDATTACHMENTS + const ADDPERMISSIONS + const ADDWATERMARKS + const CHANGEOPW + const CHANGEUPW + const DECRYPT + const ENCRYPT + const EXTRACTATTACHMENTS + const EXTRACTCONTENT + const EXTRACTFONTS + const EXTRACTIMAGES + const EXTRACTMETADATA + const EXTRACTPAGES + const IMPORTIMAGES + const INSERTPAGES + const LISTATTACHMENTS + const LISTPERMISSIONS + const MERGE + const NUP + const OPTIMIZE + const REMOVEATTACHMENTS + const REMOVEPAGES + const ROTATE + const SPLIT + const TRIM + const VALIDATE + type Configuration struct + Cmd CommandMode + CollectStats bool + DecodeAllStreams bool + EncryptKeyLength int + EncryptUsingAES bool + Eol string + OwnerPW string + OwnerPWNew *string + Reader15 bool + StatsFileName string + UserAccessPermissions int16 + UserPW string + UserPWNew *string + ValidationMode int + WriteObjectStream bool + WriteXRefStream bool + func NewConfiguration(userPW, ownerPW string) *Configuration + func NewDefaultConfiguration() *Configuration + func (c *Configuration) ReducedFeatureSet() bool + func (c *Configuration) ValidationModeString() string + type Context struct + Optimize *OptimizationContext + Read *ReadContext + Write *WriteContext + func CreateContext(xRefTable *XRefTable, config *Configuration) *Context + func CreateContextWithXRefTable(config *Configuration, pageDim *dim) (*Context, error) + func NUpFromImage(config *Configuration, imageFileNames []string, nup *NUp) (*Context, error) + func NewContext(rs io.ReadSeeker, fileName string, fileSize int64, config *Configuration) (*Context, error) + func Read(rs io.ReadSeeker, fileName string, fileSize int64, config *Configuration) (*Context, error) + func ReadFile(fileIn string, config *Configuration) (*Context, error) + func (ctx *Context) ResetWriteContext() + func (ctx *Context) String() string + type Dict map[string]Object + func NewDict() Dict + func (d *Dict) Increment(key string) error + func (d *Dict) IncrementBy(key string, i int) error + func (d Dict) ArrayEntry(key string) Array + func (d Dict) BooleanEntry(key string) *bool + func (d Dict) Delete(key string) (value Object) + func (d Dict) DictEntry(key string) Dict + func (d Dict) Entry(dictName, key string, required bool) (Object, error) + func (d Dict) Find(key string) (value Object, found bool) + func (d Dict) First() *int + func (d Dict) HexLiteralEntry(key string) *HexLiteral + func (d Dict) Index() Array + func (d Dict) IndirectRefEntry(key string) *IndirectRef + func (d Dict) Insert(key string, value Object) (ok bool) + func (d Dict) InsertFloat(key string, value float32) + func (d Dict) InsertInt(key string, value int) + func (d Dict) InsertName(key, value string) + func (d Dict) InsertString(key, value string) + func (d Dict) Int64Entry(key string) *int64 + func (d Dict) IntEntry(key string) *int + func (d Dict) IsLinearizationParmDict() bool + func (d Dict) IsObjStm() bool + func (d Dict) Len() int + func (d Dict) Length() (*int64, *int) + func (d Dict) N() *int + func (d Dict) NameEntry(key string) *string + func (d Dict) PDFString() string + func (d Dict) Prev() *int64 + func (d Dict) Size() *int + func (d Dict) StreamDictEntry(key string) *StreamDict + func (d Dict) String() string + func (d Dict) StringEntry(key string) *string + func (d Dict) StringEntryBytes(key string) ([]byte, error) + func (d Dict) StringLiteralEntry(key string) *StringLiteral + func (d Dict) Subtype() *string + func (d Dict) Type() *string + func (d Dict) Update(key string, value Object) + func (d Dict) W() Array + type Enc struct + Emd bool + ID []byte + L int + O []byte + OE []byte + P int + Perms []byte + R int + U []byte + UE []byte + V int + type Float float64 + func (f Float) PDFString() string + func (f Float) String() string + func (f Float) Value() float64 + type FontObject struct + Data []byte + Extension string + FontDict Dict + FontName string + Prefix string + ResourceNames []string + func ExtractFontData(ctx *Context, objNr int) (*FontObject, error) + func (fo *FontObject) AddResourceName(resourceName string) + func (fo FontObject) Embedded() (embedded bool) + func (fo FontObject) Encoding() string + func (fo FontObject) ResourceNamesString() string + func (fo FontObject) String() string + func (fo FontObject) SubType() string + type HexLiteral string + func NewHexLiteral(b []byte) HexLiteral + func (hexliteral HexLiteral) Bytes() ([]byte, error) + func (hexliteral HexLiteral) PDFString() string + func (hexliteral HexLiteral) String() string + func (hexliteral HexLiteral) Value() string + type ImageObject struct + ImageDict *StreamDict + ResourceNames []string + func ExtractImageData(ctx *Context, objNr int) (*ImageObject, error) + func (io *ImageObject) AddResourceName(resourceName string) + func (io ImageObject) ResourceNamesString() string + type Import struct + Dx int + Dy int + PageDim *dim + PageSize string + Pos anchor + Scale float64 + ScaleAbs bool + func DefaultImportConfig() *Import + func ParseImportDetails(s string) (*Import, error) + func (imp Import) String() string + type IndirectRef struct + GenerationNumber Integer + ObjectNumber Integer + func NewIndirectRef(objectNumber, generationNumber int) *IndirectRef + func NewNUpPageForImage(xRefTable *XRefTable, fileName string, parentIndRef *IndirectRef, nup *NUp) (*IndirectRef, error) + func NewPageForImage(xRefTable *XRefTable, fileName string, parentIndRef *IndirectRef, imp *Import) (*IndirectRef, error) + func (ir IndirectRef) Equals(indRef IndirectRef) bool + func (ir IndirectRef) PDFString() string + func (ir IndirectRef) String() string + type InheritedPageAttrs struct + type IntSet map[int]bool + type Integer int + func (i Integer) PDFString() string + func (i Integer) String() string + func (i Integer) Value() int + type NUp struct + Border bool + Grid *dim + ImgInputFile bool + Margin int + Orient orientation + PageDim *dim + PageGrid bool + PageSize string + func DefaultNUpConfig() *NUp + func (nup NUp) String() string + type Name string + func (nameObject Name) PDFString() string + func (nameObject Name) String() string + func (nameObject Name) Value() string + type Node struct + D *Dict + Kids []*Node + Kmax string + Kmin string + Names []entry + func (n *Node) Add(xRefTable *XRefTable, k string, v Object) error + func (n *Node) AddToLeaf(k string, v Object) + func (n *Node) Remove(xRefTable *XRefTable, k string) (empty, ok bool, err error) + func (n Node) KeyList() ([]string, error) + func (n Node) Process(xRefTable *XRefTable, handler func(*XRefTable, string, Object) error) error + func (n Node) String() string + func (n Node) Value(k string) (Object, bool) + type Object interface + PDFString func() string + func ParseObject(ctx *Context, offset int64, objNr, genNr int) (Object, error) + type ObjectStreamDict struct + FirstObjOffset int + ObjArray Array + ObjCount int + Prolog []byte + func NewObjectStreamDict() *ObjectStreamDict + func (osd *ObjectStreamDict) AddObject(objNumber int, entry *XRefTableEntry) error + func (osd *ObjectStreamDict) Finalize() + func (osd *ObjectStreamDict) IndexedObject(index int) (Object, error) + type OptimizationContext struct + DuplicateFontObjs IntSet + DuplicateFonts map[int]Dict + DuplicateImageObjs IntSet + DuplicateImages map[int]*StreamDict + DuplicateInfoObjects IntSet + FontObjects map[int]*FontObject + Fonts map[string][]int + ImageObjects map[int]*ImageObject + NonReferencedObjs []int + PageFonts []IntSet + PageImages []IntSet + func (oc *OptimizationContext) DuplicateFontObjectsString() (int, string) + func (oc *OptimizationContext) DuplicateImageObjectsString() (int, string) + func (oc *OptimizationContext) DuplicateInfoObjectsString() (int, string) + func (oc *OptimizationContext) IsDuplicateFontObject(i int) bool + func (oc *OptimizationContext) IsDuplicateImageObject(i int) bool + func (oc *OptimizationContext) IsDuplicateInfoObject(i int) bool + func (oc *OptimizationContext) NonReferencedObjsString() (int, string) + type PDFFilter struct + DecodeParms Dict + Name string + type PDFImage struct + type PDFStats struct + func NewPDFStats() PDFStats + func (stats PDFStats) AddPageAttr(name int) + func (stats PDFStats) AddRootAttr(name int) + func (stats PDFStats) UsesPageAttr(name int) bool + func (stats PDFStats) UsesRootAttr(name int) bool + type Point struct + X float64 + Y float64 + type ReadContext struct + BinaryFontDuplSize int64 + BinaryFontSize int64 + BinaryImageDuplSize int64 + BinaryImageSize int64 + BinaryTotalSize int64 + EolCount int + FileName string + FileSize int64 + Hybrid bool + Linearized bool + ObjectStreams IntSet + UsingObjectStreams bool + UsingXRefStreams bool + XRefStreams IntSet + func (rc *ReadContext) IsObjectStreamObject(i int) bool + func (rc *ReadContext) IsXRefStreamObject(i int) bool + func (rc *ReadContext) LogStats(optimized bool) + func (rc *ReadContext) ObjectStreamsString() (int, string) + func (rc *ReadContext) ReadFileSize() int + func (rc *ReadContext) XRefStreamsString() (int, string) + type ReadSeekerCloser interface + type Rectangle struct + func Rect(llx, lly, urx, ury float64) *Rectangle + func RectForArray(a Array) *Rectangle + func RectForDim(width, height int) *Rectangle + func RectForFormat(f string) *Rectangle + func (r Rectangle) Array() Array + func (r Rectangle) CroppedCopy(margin float64) *Rectangle + func (r Rectangle) FitsWithin(r2 *Rectangle) bool + func (r Rectangle) ScaledHeight(w float64) float64 + func (r Rectangle) ScaledWidth(h float64) float64 + type SplitData struct + func SplitDocument(fileIn string) (*SplitData, error) + func SplitDocumentStreaming(rs io.ReadSeeker, fileIn string, fileSize int64) (*SplitData, error) + func (s *SplitData) BufferLen() (n int64) + func (s *SplitData) Close() error + func (s *SplitData) DataLen() int + func (s *SplitData) GetData(i int) *StreamDict + func (s *SplitData) Read(p []byte) (int, error) + func (s *SplitData) ReadAll() ([]byte, error) + type StreamDict struct + Content []byte + FilterPipeline []PDFFilter + IsPageContent bool + Raw []byte + StreamLength *int64 + StreamLengthObjNr *int + StreamOffset int64 + func NewStreamDict(d Dict, streamOffset int64, streamLength *int64, streamLengthObjNr *int, ...) StreamDict + func ReadJPEGFile(xRefTable *XRefTable, fileName string) (*StreamDict, error) + func ReadPNGFile(xRefTable *XRefTable, fileName string) (*StreamDict, error) + func ReadTIFFFile(xRefTable *XRefTable, fileName string) (*StreamDict, error) + func (sd StreamDict) HasSoleFilterNamed(filterName string) bool + type StringLiteral string + func (stringliteral StringLiteral) PDFString() string + func (stringliteral StringLiteral) String() string + func (stringliteral StringLiteral) Value() string + type StringSet map[string]bool + type Version int + const V10 + const V11 + const V12 + const V13 + const V14 + const V15 + const V16 + const V17 + func PDFVersion(versionStr string) (Version, error) + func (v Version) String() string + type Watermark struct + func ParseWatermarkDetails(s string, onTop bool) (*Watermark, error) + func (wm Watermark) OnTopString() string + func (wm Watermark) String() string + type WriteContext struct + BinaryFontSize int64 + BinaryImageSize int64 + BinaryTotalSize int64 + CurrentObjStream *int + DirName string + Eol string + FileName string + FileSize int64 + Offset int64 + SelectedPages IntSet + Table map[int]int64 + WriteToObjectStream bool + func NewWriteContext(eol string) *WriteContext + func (wc *WriteContext) HasWriteOffset(objNumber int) bool + func (wc *WriteContext) LogStats() + func (wc *WriteContext) SetWriteOffset(objNumber int) + func (wc *WriteContext) WriteEol() error + type XRefStreamDict struct + Objects []int + PreviousOffset *int64 + Size int + W [3]int + func NewXRefStreamDict(ctx *Context) *XRefStreamDict + type XRefTable struct + AES4EmbeddedStreams bool + AES4Streams bool + AES4Strings bool + AdditionalStreams *Array + Author string + Creator string + E *Enc + EncKey []byte + Encrypt *IndirectRef + HeaderVersion *Version + ID Array + Info *IndirectRef + LinearizationObjs IntSet + Names map[string]*Node + OffsetOverflowHintTable *int64 + OffsetPrimaryHintTable *int64 + Optimized bool + PageCount int + Producer string + Root *IndirectRef + RootDict Dict + RootVersion *Version + Size *int + Stats PDFStats + Table map[int]*XRefTableEntry + Tagged bool + Valid bool + ValidationMode int + func CreateAcroFormDemoXRef() (*XRefTable, error) + func CreateAnnotationDemoXRef() (*XRefTable, error) + func CreateDemoXRef() (*XRefTable, error) + func (xRefTable *XRefTable) BindNameTrees() error + func (xRefTable *XRefTable) Catalog() (Dict, error) + func (xRefTable *XRefTable) CatalogHasPieceInfo() (bool, error) + func (xRefTable *XRefTable) DeleteObject(objNr int) error + func (xRefTable *XRefTable) DeleteObjectGraph(o Object) error + func (xRefTable *XRefTable) Dereference(o Object) (Object, error) + func (xRefTable *XRefTable) DereferenceArray(o Object) (Array, error) + func (xRefTable *XRefTable) DereferenceBoolean(o Object, sinceVersion Version) (*Boolean, error) + func (xRefTable *XRefTable) DereferenceDict(o Object) (Dict, error) + func (xRefTable *XRefTable) DereferenceDictEntry(d Dict, entryName string) (Object, error) + func (xRefTable *XRefTable) DereferenceInteger(o Object) (*Integer, error) + func (xRefTable *XRefTable) DereferenceName(o Object, sinceVersion Version, validate func(string) bool) (n Name, err error) + func (xRefTable *XRefTable) DereferenceNumber(o Object) (float64, error) + func (xRefTable *XRefTable) DereferenceStreamDict(o Object) (*StreamDict, error) + func (xRefTable *XRefTable) DereferenceStringLiteral(o Object, sinceVersion Version, validate func(string) bool) (s StringLiteral, err error) + func (xRefTable *XRefTable) DereferenceStringOrHexLiteral(obj Object, sinceVersion Version, validate func(string) bool) (o Object, err error) + func (xRefTable *XRefTable) DereferenceText(o Object) (string, error) + func (xRefTable *XRefTable) EncryptDict() (Dict, error) + func (xRefTable *XRefTable) EnsureCollection() error + func (xRefTable *XRefTable) EnsureValidFreeList() error + func (xRefTable *XRefTable) Exists(objNr int) bool + func (xRefTable *XRefTable) Find(objNr int) (*XRefTableEntry, bool) + func (xRefTable *XRefTable) FindObject(objNr int) (Object, error) + func (xRefTable *XRefTable) FindTableEntry(objNr int, genNr int) (*XRefTableEntry, bool) + func (xRefTable *XRefTable) FindTableEntryForIndRef(ir *IndirectRef) (*XRefTableEntry, bool) + func (xRefTable *XRefTable) FindTableEntryLight(objNr int) (*XRefTableEntry, bool) + func (xRefTable *XRefTable) Free(objNr int) (*XRefTableEntry, error) + func (xRefTable *XRefTable) IDFirstElement() (id []byte, err error) + func (xRefTable *XRefTable) IndRefForNewObject(obj Object) (*IndirectRef, error) + func (xRefTable *XRefTable) InsertAndUseRecycled(xRefTableEntry XRefTableEntry) (objNr int, err error) + func (xRefTable *XRefTable) InsertNew(xRefTableEntry XRefTableEntry) (objNr int) + func (xRefTable *XRefTable) InsertObject(obj Object) (objNr int, err error) + func (xRefTable *XRefTable) InsertPages(pages IntSet) error + func (xRefTable *XRefTable) IsLinearizationObject(i int) bool + func (xRefTable *XRefTable) LinearizationObjsString() (int, string) + func (xRefTable *XRefTable) LocateNameTree(nameTreeName string, ensure bool) error + func (xRefTable *XRefTable) MissingObjects() (int, *string) + func (xRefTable *XRefTable) NamesDict() (Dict, error) + func (xRefTable *XRefTable) NewEmbeddedFileStreamDict(filename string) (*StreamDict, error) + func (xRefTable *XRefTable) NewFileSpecDict(filename string, indRefStreamDict IndirectRef) (Dict, error) + func (xRefTable *XRefTable) NewSoundStreamDict(filename string, samplingRate int, fileSpecDict Dict) (*StreamDict, error) + func (xRefTable *XRefTable) NewStreamDict(filename string) (*StreamDict, error) + func (xRefTable *XRefTable) NextForFree(objNr int) (int, error) + func (xRefTable *XRefTable) PageDict(page int) (Dict, *InheritedPageAttrs, error) + func (xRefTable *XRefTable) PageMediaBox(i int) (*Rectangle, error) + func (xRefTable *XRefTable) Pages() (*IndirectRef, error) + func (xRefTable *XRefTable) ParseRootVersion() (v *string, err error) + func (xRefTable *XRefTable) RemoveCollection() error + func (xRefTable *XRefTable) RemoveEmbeddedFilesNameTree() error + func (xRefTable *XRefTable) RemoveNameTree(nameTreeName string) error + func (xRefTable *XRefTable) UndeleteObject(objectNumber int) error + func (xRefTable *XRefTable) ValidateVersion(element string, sinceVersion Version) error + func (xRefTable *XRefTable) Version() Version + func (xRefTable *XRefTable) VersionString() string + type XRefTableEntry struct + Compressed bool + Free bool + Generation *int + Object Object + ObjectStream *int + ObjectStreamInd *int + Offset *int64 + func NewFreeHeadXRefTableEntry() *XRefTableEntry + func NewXRefTableEntryGen0(obj Object) *XRefTableEntry