Documentation

Overview

    Package api lets you integrate pdfcpu's operations into your Go backend.

    There are two api layers supporting all pdfcpu operations:

    1) The file based layer (used by pdfcpu's cli)
    2) The io.ReadSeeker/io.Writer based layer for backend integration.
    

    For any pdfcpu command there are two functions.

    The file based function always calls the io.ReadSeeker/io.Writer based function:

    func CommandFile(inFile, outFile string, conf *pdf.Configuration) error
    func Command(rs io.ReadSeeker, w io.Writer, conf *pdf.Configuration) error
    

    eg. for optimization:

    func OptimizeFile(inFile, outFile string, conf *pdf.Configuration) error
    func Optimize(rs io.ReadSeeker, w io.Writer, conf *pdf.Configuration) error
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func AddAttachments

    func AddAttachments(rs io.ReadSeeker, w io.Writer, files []string, coll bool, conf *pdfcpu.Configuration) error

      AddAttachments embeds files into a PDF context read from rs and writes the result to w. file is either a file name or a file name and a description separated by a comma.

      func AddAttachmentsFile

      func AddAttachmentsFile(inFile, outFile string, files []string, coll bool, conf *pdfcpu.Configuration) (err error)

        AddAttachmentsFile embeds files into a PDF context read from inFile and writes the result to outFile.

        Example
        Output:
        
        

        func AddBoxes

        func AddBoxes(rs io.ReadSeeker, w io.Writer, selectedPages []string, pb *pdfcpu.PageBoundaries, conf *pdfcpu.Configuration) error

          AddBoxes adds page boundaries for selected pages of rs and writes result to w.

          func AddBoxesFile

          func AddBoxesFile(inFile, outFile string, selectedPages []string, pb *pdfcpu.PageBoundaries, conf *pdfcpu.Configuration) error

            AddBoxesFile adds page boundaries for selected pages of inFile and writes result to outFile.

            func AddImageWatermarksFile

            func AddImageWatermarksFile(inFile, outFile string, selectedPages []string, onTop bool, fileName, desc string, conf *pdfcpu.Configuration) error

              AddImageWatermarksFile adds image stamps/watermarks to all selected pages of inFile and writes the result to outFile.

              func AddKeywords

              func AddKeywords(rs io.ReadSeeker, w io.Writer, files []string, conf *pdf.Configuration) error

                AddKeywords embeds files into a PDF context read from rs and writes the result to w.

                func AddKeywordsFile

                func AddKeywordsFile(inFile, outFile string, files []string, conf *pdf.Configuration) (err error)

                  AddKeywordsFile embeds files into a PDF context read from inFile and writes the result to outFile.

                  func AddPDFWatermarksFile

                  func AddPDFWatermarksFile(inFile, outFile string, selectedPages []string, onTop bool, fileName, desc string, conf *pdfcpu.Configuration) error

                    AddPDFWatermarksFile adds PDF stamps/watermarks to all selected pages of inFile and writes the result to outFile.

                    func AddProperties

                    func AddProperties(rs io.ReadSeeker, w io.Writer, properties map[string]string, conf *pdf.Configuration) error

                      AddProperties embeds files into a PDF context read from rs and writes the result to w.

                      func AddPropertiesFile

                      func AddPropertiesFile(inFile, outFile string, properties map[string]string, conf *pdf.Configuration) (err error)

                        AddPropertiesFile embeds files into a PDF context read from inFile and writes the result to outFile.

                        func AddTextWatermarksFile

                        func AddTextWatermarksFile(inFile, outFile string, selectedPages []string, onTop bool, text, desc string, conf *pdfcpu.Configuration) error

                          AddTextWatermarksFile adds text stamps/watermarks to all selected pages of inFile and writes the result to outFile.

                          func AddWatermarks

                          func AddWatermarks(rs io.ReadSeeker, w io.Writer, selectedPages []string, wm *pdfcpu.Watermark, conf *pdfcpu.Configuration) error

                            AddWatermarks adds watermarks to all pages selected in rs and writes the result to w.

                            func AddWatermarksFile

                            func AddWatermarksFile(inFile, outFile string, selectedPages []string, wm *pdfcpu.Watermark, conf *pdfcpu.Configuration) (err error)

                              AddWatermarksFile adds watermarks to all selected pages of inFile and writes the result to outFile.

                              Example
                              Output:
                              
                              

                              func AddWatermarksMap

                              func AddWatermarksMap(rs io.ReadSeeker, w io.Writer, m map[int]*pdfcpu.Watermark, conf *pdfcpu.Configuration) error

                                AddWatermarksMap adds watermarks in m to corresponding pages in rs and writes the result to w.

                                func AddWatermarksMapFile

                                func AddWatermarksMapFile(inFile, outFile string, m map[int]*pdfcpu.Watermark, conf *pdfcpu.Configuration) (err error)

                                  AddWatermarksMapFile adds watermarks to corresponding pages in m of inFile and writes the result to outFile.

                                  func AddWatermarksSliceMap

                                  func AddWatermarksSliceMap(rs io.ReadSeeker, w io.Writer, m map[int][]*pdfcpu.Watermark, conf *pdfcpu.Configuration) error

                                    AddWatermarksSliceMap adds watermarks in m to corresponding pages in rs and writes the result to w.

                                    func AddWatermarksSliceMapFile

                                    func AddWatermarksSliceMapFile(inFile, outFile string, m map[int][]*pdfcpu.Watermark, conf *pdfcpu.Configuration) (err error)

                                      AddWatermarksSliceMapFile adds watermarks to corresponding pages in m of inFile and writes the result to outFile.

                                      func Booklet

                                      func Booklet(rs io.ReadSeeker, w io.Writer, imgFiles, selectedPages []string, nup *pdfcpu.NUp, conf *pdfcpu.Configuration) error

                                        Booklet arranges PDF pages on larger sheets of paper and writes the result to w.

                                        func BookletFile

                                        func BookletFile(inFiles []string, outFile string, selectedPages []string, nup *pdfcpu.NUp, conf *pdfcpu.Configuration) (err error)

                                          BookletFile rearranges PDF pages or images into a booklet layout and writes the result to outFile.

                                          func BookletFromImages

                                          func BookletFromImages(conf *pdfcpu.Configuration, imageFileNames []string, nup *pdfcpu.NUp) (*pdfcpu.Context, error)

                                            BookletFromImages creates a booklet from images.

                                            func Box

                                            func Box(s string, u pdfcpu.DisplayUnit) (*pdfcpu.Box, error)

                                              Box parses a box definition.

                                              func ChangeOwnerPasswordFile

                                              func ChangeOwnerPasswordFile(inFile, outFile string, pwOld, pwNew string, conf *pdfcpu.Configuration) error

                                                ChangeOwnerPasswordFile reads inFile, changes the user password and writes the result to outFile. A configuration containing the current passwords is required.

                                                Example
                                                Output:
                                                
                                                

                                                func ChangeUserPasswordFile

                                                func ChangeUserPasswordFile(inFile, outFile string, pwOld, pwNew string, conf *pdfcpu.Configuration) error

                                                  ChangeUserPasswordFile reads inFile, changes the user password and writes the result to outFile. A configuration containing the current passwords is required.

                                                  Example
                                                  Output:
                                                  
                                                  

                                                  func Collect

                                                  func Collect(rs io.ReadSeeker, w io.Writer, selectedPages []string, conf *pdfcpu.Configuration) error

                                                    Collect creates a custom PDF page sequence for selected pages of rs and writes the result to w.

                                                    func CollectFile

                                                    func CollectFile(inFile, outFile string, selectedPages []string, conf *pdfcpu.Configuration) (err error)

                                                      CollectFile creates a custom PDF page sequence for inFile and writes the result to outFile.

                                                      func CreateCheatSheetsUserFonts

                                                      func CreateCheatSheetsUserFonts(fontNames []string) error

                                                        CreateCheatSheetsUserFonts creates single page PDF cheat sheets for installed user fonts.

                                                        func CreatePDFFile

                                                        func CreatePDFFile(xRefTable *pdf.XRefTable, outFile string, conf *pdf.Configuration) error

                                                          CreatePDFFile creates a PDF file for an xRefTable and writes it to outFile.

                                                          func CreateUserFontDemoFiles

                                                          func CreateUserFontDemoFiles(dir, fn string) error

                                                            CreateUserFontDemoFiles creates single page PDF for each Unicode plane covered.

                                                            func Crop

                                                            func Crop(rs io.ReadSeeker, w io.Writer, selectedPages []string, b *pdfcpu.Box, conf *pdfcpu.Configuration) error

                                                              Crop adds crop boxes for selected pages of rs and writes result to w.

                                                              func CropFile

                                                              func CropFile(inFile, outFile string, selectedPages []string, b *pdfcpu.Box, conf *pdfcpu.Configuration) error

                                                                CropFile adds crop boxes for selected pages of inFile and writes result to outFile.

                                                                func DecryptFile

                                                                func DecryptFile(inFile, outFile string, conf *pdfcpu.Configuration) error

                                                                  DecryptFile decrypts inFile and writes the result to outFile. A configuration containing the current passwords is required.

                                                                  Example
                                                                  Output:
                                                                  
                                                                  

                                                                  func DisableConfigDir

                                                                  func DisableConfigDir()

                                                                    DisableConfigDir disables the configuration directory. Any needed default configuration will be loaded from configuration.go Since the config dir also contains the user font dir, this also limits font usage to the default core font set No user fonts will be available.

                                                                    func EncryptFile

                                                                    func EncryptFile(inFile, outFile string, conf *pdfcpu.Configuration) error

                                                                      EncryptFile encrypts inFile and writes the result to outFile. A configuration containing the current passwords is required.

                                                                      Example
                                                                      Output:
                                                                      
                                                                      

                                                                      func EnsureDefaultConfigAt

                                                                      func EnsureDefaultConfigAt(path string) error

                                                                        EnsureDefaultConfigAt switches to the pdfcpu config dir located at path. If path/pdfcpu is not existent, it will be created including config.yml

                                                                        func ExtractAttachments

                                                                        func ExtractAttachments(rs io.ReadSeeker, outDir string, fileNames []string, conf *pdfcpu.Configuration) error

                                                                          ExtractAttachments extracts embedded files from a PDF context read from rs into outDir.

                                                                          func ExtractAttachmentsFile

                                                                          func ExtractAttachmentsFile(inFile, outDir string, files []string, conf *pdfcpu.Configuration) error

                                                                            ExtractAttachmentsFile extracts embedded files from a PDF context read from inFile into outDir.

                                                                            Example
                                                                            Output:
                                                                            
                                                                            

                                                                            func ExtractContent

                                                                            func ExtractContent(rs io.ReadSeeker, outDir, fileName string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                              ExtractContent dumps "PDF source" files from rs into outDir for selected pages.

                                                                              func ExtractContentFile

                                                                              func ExtractContentFile(inFile, outDir string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                ExtractContentFile dumps "PDF source" files from inFile into outDir for selected pages.

                                                                                Example
                                                                                Output:
                                                                                
                                                                                

                                                                                func ExtractFonts

                                                                                func ExtractFonts(rs io.ReadSeeker, outDir, fileName string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                  ExtractFonts dumps embedded fontfiles from rs into outDir for selected pages.

                                                                                  func ExtractFontsFile

                                                                                  func ExtractFontsFile(inFile, outDir string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                    ExtractFontsFile dumps embedded fontfiles from inFile into outDir for selected pages.

                                                                                    Example
                                                                                    Output:
                                                                                    
                                                                                    

                                                                                    func ExtractImages

                                                                                    func ExtractImages(rs io.ReadSeeker, outDir, fileName string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                      ExtractImages dumps embedded image resources from rs into outDir for selected pages.

                                                                                      func ExtractImagesFile

                                                                                      func ExtractImagesFile(inFile, outDir string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                        ExtractImagesFile dumps embedded image resources from inFile into outDir for selected pages.

                                                                                        Example
                                                                                        Output:
                                                                                        
                                                                                        

                                                                                        func ExtractMetadata

                                                                                        func ExtractMetadata(rs io.ReadSeeker, outDir, fileName string, conf *pdfcpu.Configuration) error

                                                                                          ExtractMetadata dumps all metadata dict entries for rs into outDir.

                                                                                          func ExtractMetadataFile

                                                                                          func ExtractMetadataFile(inFile, outDir string, conf *pdfcpu.Configuration) error

                                                                                            ExtractMetadataFile dumps all metadata dict entries for inFile into outDir.

                                                                                            Example
                                                                                            Output:
                                                                                            
                                                                                            

                                                                                            func ExtractPages

                                                                                            func ExtractPages(rs io.ReadSeeker, outDir, fileName string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                              ExtractPages generates single page PDF files from rs in outDir for selected pages.

                                                                                              func ExtractPagesFile

                                                                                              func ExtractPagesFile(inFile, outDir string, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                                ExtractPagesFile generates single page PDF files from inFile in outDir for selected pages.

                                                                                                Example
                                                                                                Output:
                                                                                                
                                                                                                

                                                                                                func GetPermissions

                                                                                                func GetPermissions(rs io.ReadSeeker, conf *pdfcpu.Configuration) (*int16, error)

                                                                                                  GetPermissions returns the permissions for rs.

                                                                                                  func GetPermissionsFile

                                                                                                  func GetPermissionsFile(inFile string, conf *pdfcpu.Configuration) (*int16, error)

                                                                                                    GetPermissionsFile returns the permissions for inFile.

                                                                                                    func HasWatermarks

                                                                                                    func HasWatermarks(rs io.ReadSeeker, conf *pdfcpu.Configuration) (bool, error)

                                                                                                      HasWatermarks checks rs for watermarks.

                                                                                                      func HasWatermarksFile

                                                                                                      func HasWatermarksFile(inFile string, conf *pdfcpu.Configuration) (bool, error)

                                                                                                        HasWatermarksFile checks inFile for watermarks.

                                                                                                        func ImageBookletConfig

                                                                                                        func ImageBookletConfig(val int, desc string) (*pdfcpu.NUp, error)

                                                                                                          ImageBookletConfig returns an NUp configuration for Booklet-ing image files.

                                                                                                          func ImageGridConfig

                                                                                                          func ImageGridConfig(rows, cols int, desc string) (*pdfcpu.NUp, error)

                                                                                                            ImageGridConfig returns a grid configuration for Grid-ing image files.

                                                                                                            func ImageNUpConfig

                                                                                                            func ImageNUpConfig(val int, desc string) (*pdfcpu.NUp, error)

                                                                                                              ImageNUpConfig returns an NUp configuration for Nup-ing image files.

                                                                                                              func ImageWatermark

                                                                                                              func ImageWatermark(fileName, desc string, onTop, update bool, u pdfcpu.DisplayUnit) (*pdfcpu.Watermark, error)

                                                                                                                ImageWatermark returns an image watermark configuration.

                                                                                                                func Import

                                                                                                                func Import(s string, u pdfcpu.DisplayUnit) (*pdfcpu.Import, error)

                                                                                                                  Import parses an Import command string into an internal structure.

                                                                                                                  func ImportImages

                                                                                                                  func ImportImages(rs io.ReadSeeker, w io.Writer, imgs []io.Reader, imp *pdfcpu.Import, conf *pdfcpu.Configuration) error

                                                                                                                    ImportImages appends PDF pages containing images to rs and writes the result to w. If rs == nil a new PDF file will be written to w.

                                                                                                                    func ImportImagesFile

                                                                                                                    func ImportImagesFile(imgFiles []string, outFile string, imp *pdfcpu.Import, conf *pdfcpu.Configuration) (err error)

                                                                                                                      ImportImagesFile appends PDF pages containing images to outFile which will be created if necessary.

                                                                                                                      Example
                                                                                                                      Output:
                                                                                                                      
                                                                                                                      

                                                                                                                      func Info

                                                                                                                      func Info(rs io.ReadSeeker, selectedPages []string, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                        Info returns information about rs.

                                                                                                                        func InfoFile

                                                                                                                        func InfoFile(inFile string, selectedPages []string, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                          InfoFile returns information about inFile.

                                                                                                                          func InsertPages

                                                                                                                          func InsertPages(rs io.ReadSeeker, w io.Writer, selectedPages []string, before bool, conf *pdfcpu.Configuration) error

                                                                                                                            InsertPages inserts a blank page before or after every page selected of rs and writes the result to w.

                                                                                                                            func InsertPagesFile

                                                                                                                            func InsertPagesFile(inFile, outFile string, selectedPages []string, before bool, conf *pdfcpu.Configuration) (err error)

                                                                                                                              InsertPagesFile inserts a blank page before or after every inFile page selected and writes the result to w.

                                                                                                                              Example
                                                                                                                              Output:
                                                                                                                              
                                                                                                                              

                                                                                                                              func InstallFonts

                                                                                                                              func InstallFonts(fileNames []string) error

                                                                                                                                InstallFonts installs true type fonts for embedding.

                                                                                                                                func ListAttachments

                                                                                                                                func ListAttachments(rs io.ReadSeeker, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                                  ListAttachments returns a list of embedded file attachments of rs.

                                                                                                                                  func ListAttachmentsFile

                                                                                                                                  func ListAttachmentsFile(inFile string, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                                    ListAttachmentsFile returns a list of embedded file attachments of inFile.

                                                                                                                                    Example
                                                                                                                                    Output:
                                                                                                                                    
                                                                                                                                    

                                                                                                                                    func ListBoxes

                                                                                                                                    func ListBoxes(rs io.ReadSeeker, selectedPages []string, pb *pdfcpu.PageBoundaries, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                                      ListBoxes returns a list of page boundaries for selected pages of rs.

                                                                                                                                      func ListBoxesFile

                                                                                                                                      func ListBoxesFile(inFile string, selectedPages []string, pb *pdfcpu.PageBoundaries, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                                        ListBoxesFile returns a list of page boundaries for selected pages of inFile.

                                                                                                                                        func ListFonts

                                                                                                                                        func ListFonts() ([]string, error)

                                                                                                                                          ListFonts returns a list of supported fonts.

                                                                                                                                          func ListKeywords

                                                                                                                                          func ListKeywords(rs io.ReadSeeker, conf *pdf.Configuration) ([]string, error)

                                                                                                                                            ListKeywords returns the keyword list of rs.

                                                                                                                                            func ListKeywordsFile

                                                                                                                                            func ListKeywordsFile(inFile string, conf *pdf.Configuration) ([]string, error)

                                                                                                                                              ListKeywordsFile returns the keyword list of inFile.

                                                                                                                                              func ListPermissions

                                                                                                                                              func ListPermissions(rs io.ReadSeeker, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                                                ListPermissions returns a list of user access permissions.

                                                                                                                                                func ListPermissionsFile

                                                                                                                                                func ListPermissionsFile(inFile string, conf *pdfcpu.Configuration) ([]string, error)

                                                                                                                                                  ListPermissionsFile returns a list of user access permissions for inFile.

                                                                                                                                                  Example
                                                                                                                                                  Output:
                                                                                                                                                  
                                                                                                                                                  

                                                                                                                                                  func ListProperties

                                                                                                                                                  func ListProperties(rs io.ReadSeeker, conf *pdf.Configuration) ([]string, error)

                                                                                                                                                    ListProperties returns the property list of rs.

                                                                                                                                                    func ListPropertiesFile

                                                                                                                                                    func ListPropertiesFile(inFile string, conf *pdf.Configuration) ([]string, error)

                                                                                                                                                      ListPropertiesFile returns the property list of inFile.

                                                                                                                                                      func LoadConfiguration

                                                                                                                                                      func LoadConfiguration()

                                                                                                                                                        LoadConfiguration locates and loads the default configuration and also loads installed user fonts.

                                                                                                                                                        func Merge

                                                                                                                                                        func Merge(rsc []io.ReadSeeker, w io.Writer, conf *pdfcpu.Configuration) error

                                                                                                                                                          Merge merges a sequence of PDF streams and writes the result to w.

                                                                                                                                                          func MergeAppendFile

                                                                                                                                                          func MergeAppendFile(inFiles []string, outFile string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                            MergeAppendFile merges a sequence of inFiles and writes the result to outFile. This operation corresponds to file concatenation in the order specified by inFiles. If outFile already exists, inFiles will be appended.

                                                                                                                                                            Example
                                                                                                                                                            Output:
                                                                                                                                                            
                                                                                                                                                            

                                                                                                                                                            func MergeCreateFile

                                                                                                                                                            func MergeCreateFile(inFiles []string, outFile string, conf *pdfcpu.Configuration) error

                                                                                                                                                              MergeCreateFile merges a sequence of inFiles and writes the result to outFile. This operation corresponds to file concatenation in the order specified by inFiles. The first entry of inFiles serves as the destination context where all remaining files get merged into.

                                                                                                                                                              Example
                                                                                                                                                              Output:
                                                                                                                                                              
                                                                                                                                                              

                                                                                                                                                              func NUp

                                                                                                                                                              func NUp(rs io.ReadSeeker, w io.Writer, imgFiles, selectedPages []string, nup *pdfcpu.NUp, conf *pdfcpu.Configuration) error

                                                                                                                                                                NUp rearranges PDF pages or images into page grids and writes the result to w. Either rs or imgFiles will be used.

                                                                                                                                                                func NUpFile

                                                                                                                                                                func NUpFile(inFiles []string, outFile string, selectedPages []string, nup *pdfcpu.NUp, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                  NUpFile rearranges PDF pages or images into page grids and writes the result to outFile.

                                                                                                                                                                  Example
                                                                                                                                                                  Output:
                                                                                                                                                                  
                                                                                                                                                                  

                                                                                                                                                                  func NUpFromImage

                                                                                                                                                                  func NUpFromImage(conf *pdfcpu.Configuration, imageFileNames []string, nup *pdfcpu.NUp) (*pdfcpu.Context, error)

                                                                                                                                                                    NUpFromImage creates a single page n-up PDF for one image or a sequence of n-up pages for more than one image.

                                                                                                                                                                    func Optimize

                                                                                                                                                                    func Optimize(rs io.ReadSeeker, w io.Writer, conf *pdfcpu.Configuration) error

                                                                                                                                                                      Optimize reads a PDF stream from rs and writes the optimized PDF stream to w.

                                                                                                                                                                      func OptimizeContext

                                                                                                                                                                      func OptimizeContext(ctx *pdfcpu.Context) error

                                                                                                                                                                        OptimizeContext optimizes a PDF context.

                                                                                                                                                                        func OptimizeFile

                                                                                                                                                                        func OptimizeFile(inFile, outFile string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                          OptimizeFile reads inFile and writes the optimized PDF to outFile. If outFile is not provided then inFile gets overwritten which leads to the same result as when inFile equals outFile.

                                                                                                                                                                          Example
                                                                                                                                                                          Output:
                                                                                                                                                                          
                                                                                                                                                                          

                                                                                                                                                                          func PDFBookletConfig

                                                                                                                                                                          func PDFBookletConfig(val int, desc string) (*pdfcpu.NUp, error)

                                                                                                                                                                            PDFBookletConfig returns an NUp configuration for Booklet-ing PDF files.

                                                                                                                                                                            func PDFGridConfig

                                                                                                                                                                            func PDFGridConfig(rows, cols int, desc string) (*pdfcpu.NUp, error)

                                                                                                                                                                              PDFGridConfig returns a grid configuration for Grid-ing PDF files.

                                                                                                                                                                              func PDFNUpConfig

                                                                                                                                                                              func PDFNUpConfig(val int, desc string) (*pdfcpu.NUp, error)

                                                                                                                                                                                PDFNUpConfig returns an NUp configuration for Nup-ing PDF files.

                                                                                                                                                                                func PDFWatermark

                                                                                                                                                                                func PDFWatermark(fileName, desc string, onTop, update bool, u pdfcpu.DisplayUnit) (*pdfcpu.Watermark, error)

                                                                                                                                                                                  PDFWatermark returns a PDF watermark configuration.

                                                                                                                                                                                  func PageBoundaries

                                                                                                                                                                                  func PageBoundaries(s string, unit pdfcpu.DisplayUnit) (*pdfcpu.PageBoundaries, error)

                                                                                                                                                                                    PageBoundaries parses a list of box definitions and assignments.

                                                                                                                                                                                    func PageBoundariesFromBoxList

                                                                                                                                                                                    func PageBoundariesFromBoxList(s string) (*pdfcpu.PageBoundaries, error)

                                                                                                                                                                                      PageBoundariesFromBoxList parses a list of box types.

                                                                                                                                                                                      func PageCount

                                                                                                                                                                                      func PageCount(rs io.ReadSeeker, conf *pdfcpu.Configuration) (int, error)

                                                                                                                                                                                        PageCount returns rs's page count.

                                                                                                                                                                                        func PageCountFile

                                                                                                                                                                                        func PageCountFile(inFile string) (int, error)

                                                                                                                                                                                          PageCountFile returns inFile's page count.

                                                                                                                                                                                          func PageDims

                                                                                                                                                                                          func PageDims(rs io.ReadSeeker, conf *pdfcpu.Configuration) ([]pdfcpu.Dim, error)

                                                                                                                                                                                            PageDims returns a sorted slice of mediaBox dimensions for rs.

                                                                                                                                                                                            func PageDimsFile

                                                                                                                                                                                            func PageDimsFile(inFile string) ([]pdfcpu.Dim, error)

                                                                                                                                                                                              PageDimsFile returns a sorted slice of mediaBox dimensions for inFile.

                                                                                                                                                                                              func PagesForPageCollection

                                                                                                                                                                                              func PagesForPageCollection(pageCount int, pageSelection []string) ([]int, error)

                                                                                                                                                                                                PagesForPageCollection returns a slice of page numbers for a page collection. Any page number in any order any number of times allowed.

                                                                                                                                                                                                func PagesForPageRange

                                                                                                                                                                                                func PagesForPageRange(from, thru int) []int

                                                                                                                                                                                                  PagesForPageRange returns a slice of page numbers for a page range.

                                                                                                                                                                                                  func PagesForPageSelection

                                                                                                                                                                                                  func PagesForPageSelection(pageCount int, pageSelection []string, ensureAllforNone bool) (pdf.IntSet, error)

                                                                                                                                                                                                    PagesForPageSelection ensures a set of page numbers for an ascending page sequence where each page number may appear only once.

                                                                                                                                                                                                    func ParsePageSelection

                                                                                                                                                                                                    func ParsePageSelection(s string) ([]string, error)

                                                                                                                                                                                                      ParsePageSelection ensures a correct page selection expression.

                                                                                                                                                                                                      func ReadContext

                                                                                                                                                                                                      func ReadContext(rs io.ReadSeeker, conf *pdfcpu.Configuration) (*pdfcpu.Context, error)

                                                                                                                                                                                                        ReadContext uses an io.ReadSeeker to build an internal structure holding its cross reference table aka the Context.

                                                                                                                                                                                                        func ReadContextFile

                                                                                                                                                                                                        func ReadContextFile(inFile string) (*pdfcpu.Context, error)

                                                                                                                                                                                                          ReadContextFile returns inFile's validated context.

                                                                                                                                                                                                          func RemoveAttachments

                                                                                                                                                                                                          func RemoveAttachments(rs io.ReadSeeker, w io.Writer, files []string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                            RemoveAttachments deletes embedded files from a PDF context read from rs and writes the result to w.

                                                                                                                                                                                                            func RemoveAttachmentsFile

                                                                                                                                                                                                            func RemoveAttachmentsFile(inFile, outFile string, files []string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                                                              RemoveAttachmentsFile deletes embedded files from a PDF context read from inFile and writes the result to outFile.

                                                                                                                                                                                                              Example
                                                                                                                                                                                                              Output:
                                                                                                                                                                                                              
                                                                                                                                                                                                              

                                                                                                                                                                                                              func RemoveBoxes

                                                                                                                                                                                                              func RemoveBoxes(rs io.ReadSeeker, w io.Writer, selectedPages []string, pb *pdfcpu.PageBoundaries, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                RemoveBoxes removes page boundaries as specified in pb for selected pages of rs and writes result to w.

                                                                                                                                                                                                                func RemoveBoxesFile

                                                                                                                                                                                                                func RemoveBoxesFile(inFile, outFile string, selectedPages []string, pb *pdfcpu.PageBoundaries, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                  RemoveBoxesFile removes page boundaries as specified in pb for selected pages of inFile and writes result to outFile.

                                                                                                                                                                                                                  func RemoveKeywords

                                                                                                                                                                                                                  func RemoveKeywords(rs io.ReadSeeker, w io.Writer, keywords []string, conf *pdf.Configuration) error

                                                                                                                                                                                                                    RemoveKeywords deletes embedded files from a PDF context read from rs and writes the result to w.

                                                                                                                                                                                                                    func RemoveKeywordsFile

                                                                                                                                                                                                                    func RemoveKeywordsFile(inFile, outFile string, keywords []string, conf *pdf.Configuration) (err error)

                                                                                                                                                                                                                      RemoveKeywordsFile deletes embedded files from a PDF context read from inFile and writes the result to outFile.

                                                                                                                                                                                                                      func RemovePages

                                                                                                                                                                                                                      func RemovePages(rs io.ReadSeeker, w io.Writer, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                        RemovePages removes selected pages from rs and writes the result to w.

                                                                                                                                                                                                                        func RemovePagesFile

                                                                                                                                                                                                                        func RemovePagesFile(inFile, outFile string, selectedPages []string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                                                                          RemovePagesFile removes selected inFile pages and writes the result to outFile..

                                                                                                                                                                                                                          Example
                                                                                                                                                                                                                          Output:
                                                                                                                                                                                                                          
                                                                                                                                                                                                                          

                                                                                                                                                                                                                          func RemoveProperties

                                                                                                                                                                                                                          func RemoveProperties(rs io.ReadSeeker, w io.Writer, properties []string, conf *pdf.Configuration) error

                                                                                                                                                                                                                            RemoveProperties deletes embedded files from a PDF context read from rs and writes the result to w.

                                                                                                                                                                                                                            func RemovePropertiesFile

                                                                                                                                                                                                                            func RemovePropertiesFile(inFile, outFile string, properties []string, conf *pdf.Configuration) (err error)

                                                                                                                                                                                                                              RemovePropertiesFile deletes embedded files from a PDF context read from inFile and writes the result to outFile.

                                                                                                                                                                                                                              func RemoveWatermarks

                                                                                                                                                                                                                              func RemoveWatermarks(rs io.ReadSeeker, w io.Writer, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                RemoveWatermarks removes watermarks from all pages selected in rs and writes the result to w.

                                                                                                                                                                                                                                func RemoveWatermarksFile

                                                                                                                                                                                                                                func RemoveWatermarksFile(inFile, outFile string, selectedPages []string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                                                                                  RemoveWatermarksFile removes watermarks from all selected pages of inFile and writes the result to outFile.

                                                                                                                                                                                                                                  Example
                                                                                                                                                                                                                                  Output:
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                  

                                                                                                                                                                                                                                  func Rotate

                                                                                                                                                                                                                                  func Rotate(rs io.ReadSeeker, w io.Writer, rotation int, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                    Rotate rotates selected pages of rs clockwise by rotation degrees and writes the result to w.

                                                                                                                                                                                                                                    func RotateFile

                                                                                                                                                                                                                                    func RotateFile(inFile, outFile string, rotation int, selectedPages []string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                                                                                      RotateFile rotates selected pages of inFile clockwise by rotation degrees and writes the result to outFile.

                                                                                                                                                                                                                                      Example
                                                                                                                                                                                                                                      Output:
                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                      func SetPermissions

                                                                                                                                                                                                                                      func SetPermissions(rs io.ReadSeeker, w io.Writer, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                        SetPermissions sets user access permissions. inFile has to be encrypted. A configuration containing the current passwords is required.

                                                                                                                                                                                                                                        func SetPermissionsFile

                                                                                                                                                                                                                                        func SetPermissionsFile(inFile, outFile string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                                                                                          SetPermissionsFile sets inFile's user access permissions. inFile has to be encrypted. A configuration containing the current passwords is required.

                                                                                                                                                                                                                                          Example
                                                                                                                                                                                                                                          Output:
                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                          

                                                                                                                                                                                                                                          func Split

                                                                                                                                                                                                                                          func Split(rs io.ReadSeeker, outDir, fileName string, span int, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                            Split generates a sequence of PDF files in outDir for the PDF stream read from rs obeying given split span. If span == 1 splitting results in single page PDFs. If span == 0 we split along given bookmarks (level 1 only). Default span: 1

                                                                                                                                                                                                                                            func SplitFile

                                                                                                                                                                                                                                            func SplitFile(inFile, outDir string, span int, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                              SplitFile generates a sequence of PDF files in outDir for inFile obeying given split span. If span == 1 splitting results in single page PDFs. If span == 0 we split along given bookmarks (level 1 only). Default span: 1

                                                                                                                                                                                                                                              Example
                                                                                                                                                                                                                                              Output:
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                              

                                                                                                                                                                                                                                              func TextWatermark

                                                                                                                                                                                                                                              func TextWatermark(text, desc string, onTop, update bool, u pdfcpu.DisplayUnit) (*pdfcpu.Watermark, error)

                                                                                                                                                                                                                                                TextWatermark returns a text watermark configuration.

                                                                                                                                                                                                                                                func Trim

                                                                                                                                                                                                                                                func Trim(rs io.ReadSeeker, w io.Writer, selectedPages []string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                                  Trim generates a trimmed version of rs containing all selected pages and writes the result to w.

                                                                                                                                                                                                                                                  func TrimFile

                                                                                                                                                                                                                                                  func TrimFile(inFile, outFile string, selectedPages []string, conf *pdfcpu.Configuration) (err error)

                                                                                                                                                                                                                                                    TrimFile generates a trimmed version of inFile containing all selected pages and writes the result to outFile.

                                                                                                                                                                                                                                                    Example
                                                                                                                                                                                                                                                    Output:
                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                    

                                                                                                                                                                                                                                                    func UpdateImageWatermarksFile

                                                                                                                                                                                                                                                    func UpdateImageWatermarksFile(inFile, outFile string, selectedPages []string, onTop bool, fileName, desc string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                                      UpdateImageWatermarksFile adds image stamps/watermarks to all selected pages of inFile and writes the result to outFile.

                                                                                                                                                                                                                                                      func UpdatePDFWatermarksFile

                                                                                                                                                                                                                                                      func UpdatePDFWatermarksFile(inFile, outFile string, selectedPages []string, onTop bool, fileName, desc string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                                        UpdatePDFWatermarksFile adds PDF stamps/watermarks to all selected pages of inFile and writes the result to outFile.

                                                                                                                                                                                                                                                        func UpdateTextWatermarksFile

                                                                                                                                                                                                                                                        func UpdateTextWatermarksFile(inFile, outFile string, selectedPages []string, onTop bool, text, desc string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                                          UpdateTextWatermarksFile adds text stamps/watermarks to all selected pages of inFile and writes the result to outFile.

                                                                                                                                                                                                                                                          func Validate

                                                                                                                                                                                                                                                          func Validate(rs io.ReadSeeker, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                                            Validate validates a PDF stream read from rs.

                                                                                                                                                                                                                                                            func ValidateContext

                                                                                                                                                                                                                                                            func ValidateContext(ctx *pdfcpu.Context) error

                                                                                                                                                                                                                                                              ValidateContext validates a PDF context.

                                                                                                                                                                                                                                                              func ValidateFile

                                                                                                                                                                                                                                                              func ValidateFile(inFile string, conf *pdfcpu.Configuration) error

                                                                                                                                                                                                                                                                ValidateFile validates inFile.

                                                                                                                                                                                                                                                                Example
                                                                                                                                                                                                                                                                Output:
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                

                                                                                                                                                                                                                                                                func WatermarkContext

                                                                                                                                                                                                                                                                func WatermarkContext(ctx *pdfcpu.Context, selectedPages pdfcpu.IntSet, wm *pdfcpu.Watermark) error

                                                                                                                                                                                                                                                                  WatermarkContext applies wm for selected pages to ctx.

                                                                                                                                                                                                                                                                  func WriteContext

                                                                                                                                                                                                                                                                  func WriteContext(ctx *pdfcpu.Context, w io.Writer) error

                                                                                                                                                                                                                                                                    WriteContext writes a PDF context to w.

                                                                                                                                                                                                                                                                    func WriteContextFile

                                                                                                                                                                                                                                                                    func WriteContextFile(ctx *pdfcpu.Context, outFile string) error

                                                                                                                                                                                                                                                                      WriteContextFile writes a PDF context to outFile.

                                                                                                                                                                                                                                                                      Types

                                                                                                                                                                                                                                                                      type ReadSeekerCloser

                                                                                                                                                                                                                                                                      type ReadSeekerCloser interface {
                                                                                                                                                                                                                                                                      	io.ReadSeeker
                                                                                                                                                                                                                                                                      	io.Closer
                                                                                                                                                                                                                                                                      }

                                                                                                                                                                                                                                                                        ReadSeekerCloser combines io.ReadSeeker and io.Closer