{"modulePath":"github.com/helloeave/pdfcpu","version":"v0.1.21","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\nPackage api provides support for interacting with pdf.\n\n## Functions\n\n```go\nfunc AddAttachments(fileIn string, files []string, config *pdf.Configuration) error\n```\nAddAttachments embeds files into a PDF.\n\n```go\nfunc AddPermissions(fileIn string, config *pdf.Configuration) error\n```\nAddPermissions sets the user access permissions.\n\n```go\nfunc AddWatermarks(cmd *Command) ([]string, error)\n```\nAddWatermarks adds watermarks to all pages selected.\n\n```go\nfunc ChangeOwnerPassword(cmd *Command) ([]string, error)\n```\nChangeOwnerPassword of fileIn and write result to fileOut.\n\n```go\nfunc ChangeUserPassword(cmd *Command) ([]string, error)\n```\nChangeUserPassword of fileIn and write result to fileOut.\n\n```go\nfunc Decrypt(cmd *Command) ([]string, error)\n```\nDecrypt fileIn and write result to fileOut.\n\n```go\nfunc Encrypt(cmd *Command) ([]string, error)\n```\nEncrypt fileIn and write result to fileOut.\n\n```go\nfunc ExtractAttachments(fileIn, dirOut string, files []string, config *pdf.Configuration) error\n```\nExtractAttachments extracts embedded files from a PDF.\n\n```go\nfunc ExtractContent(cmd *Command) ([]string, error)\n```\nExtractContent dumps \"PDF source\" files from fileIn into dirOut for selected pages.\n\n```go\nfunc ExtractFonts(cmd *Command) ([]string, error)\n```\nExtractFonts dumps embedded fontfiles from fileIn into dirOut for selected pages.\n\n```go\nfunc ExtractImages(cmd *Command) ([]string, error)\n```\nExtractImages dumps embedded image resources from fileIn into dirOut for selected pages.\n\n```go\nfunc ExtractMetadata(cmd *Command) ([]string, error)\n```\nExtractMetadata dumps all metadata dict entries for fileIn into dirOut.\n\n```go\nfunc ExtractPages(cmd *Command) ([]string, error)\n```\nExtractPages generates single page PDF files from fileIn in dirOut for selected pages.\n\n```go\nfunc ImportImages(cmd *Command) ([]string, error)\n```\nImportImages turns image files into a page sequence and writes the result to outFile. In its simplest form this operation converts an image into a PDF.\n\n```go\nfunc ListAttachments(fileIn string, config *pdf.Configuration) ([]string, error)\n```\nListAttachments returns a list of embedded file attachments.\n\n```go\nfunc ListPermissions(fileIn string, config *pdf.Configuration) ([]string, error)\n```\nListPermissions returns a list of user access permissions.\n\n```go\nfunc Merge(cmd *Command) ([]string, error)\n```\nMerge some PDF files together and write the result to fileOut. This corresponds to concatenating these files in the order specified by filesIn. The first entry of filesIn serves as the destination xRefTable where all the remaining files gets merged into.\n\n```go\nfunc MergeContexts(rsc []pdf.ReadSeekerCloser, config *pdf.Configuration) (*pdf.Context, error)\n```\nMergeContexts merges a sequence of PDF's represented by a slice of ReadSeekerCloser.\n\n```go\nfunc NUp(cmd *Command) ([]string, error)\n```\nNUp rearranges pages or images into page grids.\n\n```go\nfunc Optimize(cmd *Command) ([]string, error)\n```\nOptimize reads in fileIn, does validation, optimization and writes the result to fileOut.\n\n```go\nfunc OptimizeContext(ctx *pdf.Context) error\n```\nOptimizeContext optimizes a PDF context.\n\n```go\nfunc ParsePageSelection(s string) ([]string, error)\n```\nParsePageSelection ensures a correct page selection expression.\n\n```go\nfunc Process(cmd *Command) (out []string, err error)\n```\nProcess executes a pdfcpu command.\n\n```go\nfunc ReadContext(rs io.ReadSeeker, fileIn string, fileSize int64, config *pdf.Configuration) (*pdf.Context, error)\n```\nReadContext uses an io.Readseeker to build an internal structure holding its cross reference table aka the Context.\n\n```go\nfunc ReadContextFromFile(fileIn string, config *pdf.Configuration) (*pdf.Context, error)\n```\nReadContextFromFile reads in a PDF file and builds an internal structure holding its cross reference table aka the Context.\n\n```go\nfunc RemoveAttachments(fileIn string, files []string, config *pdf.Configuration) error\n```\nRemoveAttachments deletes embedded files from a PDF.\n\n```go\nfunc Rotate(cmd *Command) ([]string, error)\n```\nRotate rotates selected pages clockwise.\n\n```go\nfunc Split(cmd *Command) ([]string, error)\n```\nSplit generates a sequence of PDF files in dirOut obeying given split span. The default span 1 creates a sequence of single page PDFs.\n\n```go\nfunc Trim(cmd *Command) ([]string, error)\n```\nTrim generates a trimmed version of fileIn containing all pages selected.\n\n```go\nfunc Validate(cmd *Command) ([]string, error)\n```\nValidate validates a PDF file against ISO-32000-1:2008.\n\n```go\nfunc ValidateContext(ctx *pdf.Context) error\n```\nValidateContext validates a PDF context.\n\n```go\nfunc Write(ctx *pdf.Context) error\n```\nWrite generates a PDF file for a given Context.\n\n```go\nfunc WriteContext(ctx *pdf.Context, w io.Writer) error\n```\nWriteContext writes a PDF context.\n\n## Types\n\n```go\ntype Command struct {\n\tMode          pdf.CommandMode    // VALIDATE  OPTIMIZE  SPLIT  MERGE  EXTRACT  TRIM  LISTATT ADDATT REMATT EXTATT  ENCRYPT  DECRYPT  CHANGEUPW  CHANGEOPW LISTP ADDP  WATERMARK  IMPORT  ROTATE  NUP\n\tInFile        *string            //    *         *        *      -       *      *      *       *       *      *       *        *         *          *       *     *       *         -       *     -\n\tInFiles       []string           //    -         -        -      *       -      -      -       *       *      *       -        -         -          -       -     -       -         *       -     *\n\tInDir         *string            //    -         -        -      -       -      -      -       -       -      -       -        -         -          -       -     -       -         -       -     -\n\tOutFile       *string            //    -         *        -      *       -      *      -       -       -      -       *        *         *          *       -     -       *         *       -     *\n\tOutDir        *string            //    -         -        *      -       *      -      -       -       -      *       -        -         -          -       -     -       -         -       -     -\n\tPageSelection []string           //    -         -        -      -       *      *      -       -       -      -       -        -         -          -       -     -       *         -       -     *\n\tConfig        *pdf.Configuration //    *         *        *      *       *      *      *       *       *      *       *        *         *          *       *     *       *         *       *     *\n\tPWOld         *string            //    -         -        -      -       -      -      -       -       -      -       -        -         *          *       -     -       -         -       -     -\n\tPWNew         *string            //    -         -        -      -       -      -      -       -       -      -       -        -         *          *       -     -       -         -       -     -\n\tWatermark     *pdf.Watermark     //    -         -        -      -       -      -      -       -       -      -       -        -         -          -       -     -       -         -       -     -\n\tSpan          int                //    -         -        *      -       -      -      -       -       -      -       -        -         -          -       -     -       -         -       -     -\n\tImport        *pdf.Import        //    -         -        -      -       -      -      -       -       -      -       -        -         -          -       -     -       -         *       -     -\n\tRotation      int                //    -         -        -      -       -      -      -       -       -      -       -        -         -          -       -     -       -         -       *     -\n\tNUp           *pdf.NUp           //    -         -        -      -       -      -      -       -       -      -       -        -         -          -       -     -       -         -       -     *\n}\n```\nCommand represents an execution context.\n\n```go\nfunc AddAttachmentsCommand(pdfFileNameIn string, fileNamesIn []string, config *pdf.Configuration) *Command\n```\nAddAttachmentsCommand creates a new command to add attachments.\n\n```go\nfunc AddPermissionsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command\n```\nAddPermissionsCommand creates a new command to add permissions.\n\n```go\nfunc AddWatermarksCommand(pdfFileNameIn, pdfFileNameOut string, pageSelection []string, wm *pdf.Watermark, config *pdf.Configuration) *Command\n```\nAddWatermarksCommand creates a new command to add Watermarks to a file.\n\n```go\nfunc ChangeOwnerPWCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration, pwOld, pwNew *string) *Command\n```\nChangeOwnerPWCommand creates a new command to change the owner password.\n\n```go\nfunc ChangeUserPWCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration, pwOld, pwNew *string) *Command\n```\nChangeUserPWCommand creates a new command to change the user password.\n\n```go\nfunc DecryptCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command\n```\nDecryptCommand creates a new command to decrypt a file.\n\n```go\nfunc EncryptCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command\n```\nEncryptCommand creates a new command to encrypt a file.\n\n```go\nfunc ExtractAttachmentsCommand(pdfFileNameIn, dirNameOut string, fileNamesIn []string, config *pdf.Configuration) *Command\n```\nExtractAttachmentsCommand creates a new command to extract attachments.\n\n```go\nfunc ExtractContentCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command\n```\nExtractContentCommand creates a new command to extract page content streams.\n\n```go\nfunc ExtractFontsCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command\n```\nExtractFontsCommand creates a new command to extract embedded fonts. (experimental)\n\n```go\nfunc ExtractImagesCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command\n```\nExtractImagesCommand creates a new command to extract embedded images. (experimental\n\n```go\nfunc ExtractMetadataCommand(pdfFileNameIn, dirNameOut string, config *pdf.Configuration) *Command\n```\nExtractMetadataCommand creates a new command to extract metadata streams.\n\n```go\nfunc ExtractPagesCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command\n```\nExtractPagesCommand creates a new command to extract specific pages of a file.\n\n```go\nfunc ImportImagesCommand(imageFileNamesIn []string, pdfFileNameOut string, imp *pdf.Import, config *pdf.Configuration) *Command\n```\nImportImagesCommand creates a new command to import images.\n\n```go\nfunc ListAttachmentsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command\n```\nListAttachmentsCommand create a new command to list attachments.\n\n```go\nfunc ListPermissionsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command\n```\nListPermissionsCommand create a new command to list permissions.\n\n```go\nfunc MergeCommand(pdfFileNamesIn []string, pdfFileNameOut string, config *pdf.Configuration) *Command\n```\nMergeCommand creates a new command to merge files.\n\n```go\nfunc NUpCommand(fileNamesIn []string, pdfFileNameOut string, pageSelection []string, nUp *pdf.NUp, config *pdf.Configuration) *Command\n```\nNUpCommand creates a new command to render PDFs or image files in n-up fashion.\n\n```go\nfunc OptimizeCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command\n```\nOptimizeCommand creates a new command to optimize a file.\n\n```go\nfunc RemoveAttachmentsCommand(pdfFileNameIn string, fileNamesIn []string, config *pdf.Configuration) *Command\n```\nRemoveAttachmentsCommand creates a new command to remove attachments.\n\n```go\nfunc RotateCommand(pdfFileNameIn string, rotation int, pageSelection []string, config *pdf.Configuration) *Command\n```\nRotateCommand creates a new command to rotate pages.\n\n```go\nfunc SplitCommand(pdfFileNameIn, dirNameOut string, span int, config *pdf.Configuration) *Command\n```\nSplitCommand creates a new command to split a file into single page file.\n\n```go\nfunc TrimCommand(pdfFileNameIn, pdfFileNameOut string, pageSelection []string, config *pdf.Configuration) *Command\n```\nTrimCommand creates a new command to trim the pages of a file.\n\n```go\nfunc ValidateCommand(pdfFileName string, config *pdf.Configuration) *Command\n```\nValidateCommand creates a new command to validate a file.\n\n","path":"github.com/helloeave/pdfcpu/pkg/api","name":"api","synopsis":"Package api provides support for interacting with pdf.","isRedistributable":true}
