Versions in this module Expand all Collapse all v0 v0.0.2 Dec 10, 2024 v0.0.1 Dec 10, 2024 Changes in this version + const ObjectStreamMaxObjects + var ErrCorruptHeader = errors.New("pdfcpu: no header version available") + var ErrReferenceDoesNotExist = errors.New("pdfcpu: referenced object does not exist") + var ErrUnknownEncryption = errors.New("pdfcpu: unknown encryption") + var ErrUnsupported16BPC = errors.New("unsupported 16 bits per component") + var ErrUnsupportedVersion = errors.New("pdfcpu: PDF 2.0 unsupported for this operation") + var ErrWrongPassword = errors.New("pdfcpu: please provide the correct password") + var NUpValues = []int + var NUpValuesForBooklets = []int + func AddAnnotation(ctx *model.Context, pageDictIndRef *types.IndirectRef, pageDict types.Dict, ...) (*types.IndirectRef, types.Dict, error) + func AddAnnotationToPage(ctx *model.Context, pageNr int, ar model.AnnotationRenderer, incr bool) (*types.IndirectRef, types.Dict, error) + func AddAnnotations(ctx *model.Context, selectedPages types.IntSet, ar model.AnnotationRenderer, ...) (bool, error) + func AddAnnotationsMap(ctx *model.Context, m map[int][]model.AnnotationRenderer, incr bool) (bool, error) + func AddBookmarks(ctx *model.Context, bms []Bookmark, replace bool) error + func AddPageTreeWithSamplePage(xRefTable *model.XRefTable, rootDict types.Dict, p model.Page) error + func AddPages(ctxSrc, ctxDest *model.Context, pageNrs []int, usePgCache bool) error + func AddWatermarks(ctx *model.Context, selectedPages types.IntSet, wm *model.Watermark) error + func AddWatermarksMap(ctx *model.Context, m map[int]*model.Watermark) error + func AddWatermarksSliceMap(ctx *model.Context, m map[int][]*model.Watermark) error + func Annotation(xRefTable *model.XRefTable, d types.Dict) (model.AnnotationRenderer, error) + func AnnotationsForSelectedPages(ctx *model.Context, selectedPages types.IntSet) map[int]model.PgAnnots + func AppendStatsFile(ctx *model.Context) error + func BookletFromImages(ctx *model.Context, fileNames []string, nup *model.NUp, pagesDict types.Dict, ...) error + func BookletFromPDF(ctx *model.Context, selectedPages types.IntSet, nup *model.NUp) error + func BookmarkList(ctx *model.Context) ([]string, error) + func CacheFormFonts(ctx *model.Context) error + func CachedAnnotationObjNrs(ctx *model.Context) ([]int, error) + func ColorSpaceComponents(xRefTable *model.XRefTable, sd *types.StreamDict) (int, error) + func ColorSpaceString(ctx *model.Context, sd *types.StreamDict) (string, error) + func CreateAnnotationDemoXRef() (*model.XRefTable, error) + func CreateContext(xRefTable *model.XRefTable, conf *model.Configuration) *model.Context + func CreateContextWithXRefTable(conf *model.Configuration, pageDim *types.Dim) (*model.Context, error) + func CreateDemoXRef() (*model.XRefTable, error) + func CreateFormDemoXRef() (*model.XRefTable, error) + func CreateResourceDictInheritanceDemoXRef() (*model.XRefTable, error) + func CreateTestPageContent(p model.Page) + func CreateXRefTableWithRootDict() (*model.XRefTable, error) + func CutPage(ctxSrc *model.Context, i int, cut *model.Cut) (*model.Context, error) + func DefaultBookletConfig() *model.NUp + func DetectPageTreeWatermarks(ctx *model.Context) error + func DetectWatermarks(ctx *model.Context) error + func EnsureOutlines(ctx *model.Context, fName string, append bool) error + func ExportBookmarksJSON(ctx *model.Context, source string, w io.Writer) (bool, error) + func ExtractImage(ctx *model.Context, sd *types.StreamDict, thumb bool, resourceID string, ...) (*model.Image, error) + func ExtractPageContent(ctx *model.Context, pageNr int) (io.Reader, error) + func ExtractPageImages(ctx *model.Context, pageNr int, stub bool) (map[int]model.Image, error) + func ExtractPages(ctx *model.Context, pageNrs []int, usePgCache bool) (*model.Context, error) + func FontObjNrs(ctx *model.Context, pageNr int) []int + func GetBookletOrdering(pages types.IntSet, nup *model.NUp) []model.BookletPage + func ImageBookletConfig(val int, desc string, conf *model.Configuration) (*model.NUp, error) + func ImageGridConfig(rows, cols int, desc string, conf *model.Configuration) (*model.NUp, error) + func ImageNUpConfig(val int, desc string, conf *model.Configuration) (*model.NUp, error) + func ImageObjNrs(ctx *model.Context, pageNr int) []int + func ImportBookmarks(ctx *model.Context, rd io.Reader, replace bool) (bool, error) + func KeywordsAdd(ctx *model.Context, keywords []string) error + func KeywordsList(ctx *model.Context) ([]string, error) + func KeywordsRemove(ctx *model.Context, keywords []string) (bool, error) + func ListAnnotations(annots map[int]model.PgAnnots) (int, []string, error) + func ListImages(ctx *model.Context, selectedPages types.IntSet) ([]string, error) + func ListInfo(info *PDFInfo, selectedPages types.IntSet) ([]string, error) + func MergeXRefTables(fName string, ctxSrc, ctxDest *model.Context, zip, dividerPage bool) (err error) + func NDownPage(ctxSrc *model.Context, i, n int, cut *model.Cut) (*model.Context, error) + func NUpFromMultipleImages(ctx *model.Context, fileNames []string, nup *model.NUp, pagesDict types.Dict, ...) error + func NUpFromOneImage(ctx *model.Context, fileName string, nup *model.NUp, pagesDict types.Dict, ...) error + func NUpFromPDF(ctx *model.Context, selectedPages types.IntSet, nup *model.NUp) error + func NewNUpPageForImage(xRefTable *model.XRefTable, fileName string, parentIndRef *types.IndirectRef, ...) (*types.IndirectRef, error) + func NewPageForImage(xRefTable *model.XRefTable, r io.Reader, parentIndRef *types.IndirectRef, ...) (*types.IndirectRef, error) + func OptimizeXRefTable(ctx *model.Context) error + func PDFBookletConfig(val int, desc string, conf *model.Configuration) (*model.NUp, error) + func PDFGridConfig(rows, cols int, desc string, conf *model.Configuration) (*model.NUp, error) + func PDFNUpConfig(val int, desc string, conf *model.Configuration) (*model.NUp, error) + func PageObjFromDestination(ctx *model.Context, dest types.Object) (*types.IndirectRef, error) + func ParseCutConfig(s string, u types.DisplayUnit) (*model.Cut, error) + func ParseCutConfigForN(n int, s string, u types.DisplayUnit) (*model.Cut, error) + func ParseCutConfigForPoster(s string, u types.DisplayUnit) (*model.Cut, error) + func ParseImageWatermarkDetails(fileName, desc string, onTop bool, u types.DisplayUnit) (*model.Watermark, error) + func ParseNUpDetails(s string, nup *model.NUp) error + func ParseNUpGridDefinition(rows, cols int, nUp *model.NUp) error + func ParseNUpValue(n int, nUp *model.NUp) error + func ParseObject(ctx *model.Context, offset int64, objNr, genNr int) (types.Object, error) + func ParseObjectWithContext(c context.Context, ctx *model.Context, offset int64, objNr, genNr int) (types.Object, error) + func ParsePDFWatermarkDetails(fileName, desc string, onTop bool, u types.DisplayUnit) (*model.Watermark, error) + func ParsePageDim(v string, u types.DisplayUnit) (*types.Dim, string, error) + func ParseResizeConfig(s string, u types.DisplayUnit) (*model.Resize, error) + func ParseTextWatermarkDetails(text, desc string, onTop bool, u types.DisplayUnit) (*model.Watermark, error) + func ParseZoomConfig(s string, u types.DisplayUnit) (*model.Zoom, error) + func Permissions(ctx *model.Context) (list []string) + func PermissionsList(p int) (list []string) + func PosterPage(ctxSrc *model.Context, i int, cut *model.Cut) (*model.Context, error) + func PropertiesAdd(ctx *model.Context, properties map[string]string) error + func PropertiesList(ctx *model.Context) ([]string, error) + func PropertiesRemove(ctx *model.Context, properties []string) (bool, error) + func Read(rs io.ReadSeeker, conf *model.Configuration) (*model.Context, error) + func ReadFile(inFile string, conf *model.Configuration) (*model.Context, error) + func ReadFileWithContext(c context.Context, inFile string, conf *model.Configuration) (*model.Context, error) + func ReadWithContext(c context.Context, rs io.ReadSeeker, conf *model.Configuration) (*model.Context, error) + func RemoveAnnotations(ctx *model.Context, selectedPages types.IntSet, idsAndTypes []string, ...) (bool, error) + func RemoveAnnotationsFromPageDict(ctx *model.Context, annotTypes []model.AnnotationType, ids []string, ...) (bool, error) + func RemoveBookmarks(ctx *model.Context) (bool, error) + func RemoveWatermarks(ctx *model.Context, selectedPages types.IntSet) error + func RenderImage(xRefTable *model.XRefTable, sd *types.StreamDict, thumb bool, ...) (io.Reader, string, error) + func Resize(ctx *model.Context, selectedPages types.IntSet, res *model.Resize) error + func RotatePages(ctx *model.Context, selectedPages types.IntSet, rotation int) error + func StreamLength(ctx *model.Context, sd *types.StreamDict) (int64, error) + func Write(ctx *model.Context) (err error) + func WriteImage(xRefTable *model.XRefTable, fileName string, sd *types.StreamDict, thumb bool, ...) (string, error) + func WriteImageToDisk(outDir, fileName string) func(model.Image, bool, int) error + func WriteIncrement(ctx *model.Context) error + func WriteReader(path string, r io.Reader) error + func Zoom(ctx *model.Context, selectedPages types.IntSet, zoom *model.Zoom) error + type AnnotListMaxLengths struct + Content int + ID int + ObjNr int + Rect int + type Bookmark struct + Bold bool + Color *color.SimpleColor + Italic bool + Kids []Bookmark + PageFrom int + PageThru int + Parent *Bookmark + Title string + func Bookmarks(ctx *model.Context) ([]Bookmark, error) + func BookmarksForOutlineItem(ctx *model.Context, item *types.IndirectRef, parent *Bookmark) ([]Bookmark, error) + func (bm Bookmark) Style() int + type BookmarkTree struct + Bookmarks []Bookmark + Header Header + func ExportBookmarks(ctx *model.Context, source string) (*BookmarkTree, error) + type Font struct + Name string + Type string + func ExtractFont(ctx *model.Context, fontObject model.FontObject, objNr int) (*Font, error) + func ExtractFormFonts(ctx *model.Context) ([]Font, error) + func ExtractPageFonts(ctx *model.Context, pageNr int) ([]Font, error) + type Header struct + Author string + Creation string + Creator string + ID []string + Keywords string + Producer string + Source string + Subject string + Title string + Version string + type ImageListMaxLengths struct + Filters int + ID int + ObjNr int + Size int + func Images(ctx *model.Context, selectedPages types.IntSet) ([]map[int]model.Image, *ImageListMaxLengths, error) + type Import struct + BgColor *color.SimpleColor + DPI int + Dx float64 + Dy float64 + Gray bool + InpUnit types.DisplayUnit + PageDim *types.Dim + PageSize string + Pos types.Anchor + Scale float64 + ScaleAbs bool + Sepia bool + UserDim bool + func DefaultImportConfig() *Import + func ParseImportDetails(s string, u types.DisplayUnit) (*Import, error) + func (imp Import) String() string + type Metadata struct + ObjNr int + ParentObjNr int + ParentType string + func ExtractMetadata(ctx *model.Context) ([]Metadata, error) + type PDFImage struct + type PDFInfo struct + AppendOnly bool + Attachments []model.Attachment + Author string + Boundaries map[string]model.PageBoundaries + CreationDate string + Creator string + Dimensions []types.Dim + Encrypted bool + FileName string + Form bool + Hybrid bool + Keywords []string + Linearized bool + ModificationDate string + Names bool + Outlines bool + PageBoundaries []model.PageBoundaries + PageCount int + PageDimensions map[types.Dim]bool + PageLayout string + PageMode string + Permissions int + Producer string + Properties map[string]string + Signatures bool + Subject string + Tagged bool + Thumbnails bool + Title string + Unit types.DisplayUnit + UnitString string + UsingObjectStreams bool + UsingXRefStreams bool + Version string + ViewerPref *model.ViewerPreferences + Watermarked bool + func Info(ctx *model.Context, fileName string, selectedPages types.IntSet) (*PDFInfo, error) + type PageConfiguration struct + InpUnit types.DisplayUnit + PageDim *types.Dim + PageSize string + UserDim bool + func DefaultPageConfiguration() *PageConfiguration + func ParsePageConfiguration(s string, u types.DisplayUnit) (*PageConfiguration, error) + func (p PageConfiguration) String() string