Documentation ¶
Overview ¶
Package api provides support for interacting with pdf.
Index ¶
- func AddAttachments(fileIn string, files []string, config *pdf.Configuration) error
- func AddPermissions(fileIn string, config *pdf.Configuration) error
- func AddWatermarks(cmd *Command) ([]string, error)
- func ChangeOwnerPassword(cmd *Command) ([]string, error)
- func ChangeUserPassword(cmd *Command) ([]string, error)
- func Decrypt(cmd *Command) ([]string, error)
- func Encrypt(cmd *Command) ([]string, error)
- func ExtractAttachments(fileIn, dirOut string, files []string, config *pdf.Configuration) error
- func ExtractContent(cmd *Command) ([]string, error)
- func ExtractFonts(cmd *Command) ([]string, error)
- func ExtractImages(cmd *Command) ([]string, error)
- func ExtractMetadata(cmd *Command) ([]string, error)
- func ExtractPages(cmd *Command) ([]string, error)
- func ListAttachments(fileIn string, config *pdf.Configuration) ([]string, error)
- func ListPermissions(fileIn string, config *pdf.Configuration) ([]string, error)
- func Merge(cmd *Command) ([]string, error)
- func Optimize(cmd *Command) ([]string, error)
- func ParsePageSelection(s string) ([]string, error)
- func Process(cmd *Command) (out []string, err error)
- func Read(fileIn string, config *pdf.Configuration) (*pdf.Context, error)
- func RemoveAttachments(fileIn string, files []string, config *pdf.Configuration) error
- func Split(cmd *Command) ([]string, error)
- func Trim(cmd *Command) ([]string, error)
- func Validate(cmd *Command) ([]string, error)
- func Write(ctx *pdf.Context) error
- type Command
- func AddAttachmentsCommand(pdfFileNameIn string, fileNamesIn []string, config *pdf.Configuration) *Command
- func AddPermissionsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command
- func AddWatermarksCommand(pdfFileNameIn, pdfFileNameOut string, pageSelection []string, ...) *Command
- func ChangeOwnerPWCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration, ...) *Command
- func ChangeUserPWCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration, ...) *Command
- func DecryptCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command
- func EncryptCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command
- func ExtractAttachmentsCommand(pdfFileNameIn, dirNameOut string, fileNamesIn []string, ...) *Command
- func ExtractContentCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, ...) *Command
- func ExtractFontsCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, ...) *Command
- func ExtractImagesCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, ...) *Command
- func ExtractMetadataCommand(pdfFileNameIn, dirNameOut string, config *pdf.Configuration) *Command
- func ExtractPagesCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, ...) *Command
- func ListAttachmentsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command
- func ListPermissionsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command
- func MergeCommand(pdfFileNamesIn []string, pdfFileNameOut string, config *pdf.Configuration) *Command
- func OptimizeCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command
- func RemoveAttachmentsCommand(pdfFileNameIn string, fileNamesIn []string, config *pdf.Configuration) *Command
- func SplitCommand(pdfFileNameIn, dirNameOut string, config *pdf.Configuration) *Command
- func TrimCommand(pdfFileNameIn, pdfFileNameOut string, pageSelection []string, ...) *Command
- func ValidateCommand(pdfFileName string, config *pdf.Configuration) *Command
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAttachments ¶
func AddAttachments(fileIn string, files []string, config *pdf.Configuration) error
AddAttachments embeds files into a PDF.
func AddPermissions ¶
func AddPermissions(fileIn string, config *pdf.Configuration) error
AddPermissions sets the user access permissions.
func AddWatermarks ¶ added in v0.1.16
AddWatermarks adds watermarks to all pages selected.
func ChangeOwnerPassword ¶
ChangeOwnerPassword of fileIn and write result to fileOut.
func ChangeUserPassword ¶
ChangeUserPassword of fileIn and write result to fileOut.
func ExtractAttachments ¶
func ExtractAttachments(fileIn, dirOut string, files []string, config *pdf.Configuration) error
ExtractAttachments extracts embedded files from a PDF.
func ExtractContent ¶
ExtractContent dumps "PDF source" files from fileIn into dirOut for selected pages.
func ExtractFonts ¶
ExtractFonts dumps embedded fontfiles from fileIn into dirOut for selected pages.
func ExtractImages ¶
ExtractImages dumps embedded image resources from fileIn into dirOut for selected pages.
func ExtractMetadata ¶ added in v0.1.16
ExtractMetadata dumps all metadata dict entries for fileIn into dirOut.
func ExtractPages ¶
ExtractPages generates single page PDF files from fileIn in dirOut for selected pages.
func ListAttachments ¶
func ListAttachments(fileIn string, config *pdf.Configuration) ([]string, error)
ListAttachments returns a list of embedded file attachments.
func ListPermissions ¶
func ListPermissions(fileIn string, config *pdf.Configuration) ([]string, error)
ListPermissions returns a list of user access permissions.
func Merge ¶
Merge 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.
func Optimize ¶
Optimize reads in fileIn, does validation, optimization and writes the result to fileOut.
func ParsePageSelection ¶
ParsePageSelection ensures a correct page selection expression.
func Read ¶
Read reads in a PDF file and builds an internal structure holding its cross reference table aka the Context.
func RemoveAttachments ¶
func RemoveAttachments(fileIn string, files []string, config *pdf.Configuration) error
RemoveAttachments deletes embedded files from a PDF.
func Split ¶
Split generates a sequence of single page PDF files in dirOut creating one file for every page of inFile.
Types ¶
type Command ¶
type Command struct { Mode pdf.CommandMode // VALIDATE OPTIMIZE SPLIT MERGE EXTRACT TRIM LISTATT ADDATT REMATT EXTATT ENCRYPT DECRYPT CHANGEUPW CHANGEOPW LISTP ADDP WATERMARK InFile *string // * * * - * * * * * * * * * * * * * InFiles []string // - - - * - - - * * * - - - - - - - InDir *string // - - - - - - - - - - - - - - - - - OutFile *string // - * - * - * - - - - * * * * - - * OutDir *string // - - * - * - - - - * - - - - - - - PageSelection []string // - - - - * * - - - - - - - - - - * Config *pdf.Configuration // * * * * * * * * * * * * * * * * * PWOld *string // - - - - - - - - - - - - * * - - - PWNew *string // - - - - - - - - - - - - * * - - - Watermark *pdf.Watermark // - - - - - - - - - - - - - - - - - }
Command represents an execution context.
func AddAttachmentsCommand ¶
func AddAttachmentsCommand(pdfFileNameIn string, fileNamesIn []string, config *pdf.Configuration) *Command
AddAttachmentsCommand creates a new command to add attachments.
func AddPermissionsCommand ¶
func AddPermissionsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command
AddPermissionsCommand creates a new command to add permissions.
func AddWatermarksCommand ¶ added in v0.1.16
func AddWatermarksCommand(pdfFileNameIn, pdfFileNameOut string, pageSelection []string, wm *pdf.Watermark, config *pdf.Configuration) *Command
AddWatermarksCommand creates a new command to add Watermarks to a file.
func ChangeOwnerPWCommand ¶
func ChangeOwnerPWCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration, pwOld, pwNew *string) *Command
ChangeOwnerPWCommand creates a new command to change the owner password.
func ChangeUserPWCommand ¶
func ChangeUserPWCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration, pwOld, pwNew *string) *Command
ChangeUserPWCommand creates a new command to change the user password.
func DecryptCommand ¶
func DecryptCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command
DecryptCommand creates a new command to decrypt a file.
func EncryptCommand ¶
func EncryptCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command
EncryptCommand creates a new command to encrypt a file.
func ExtractAttachmentsCommand ¶
func ExtractAttachmentsCommand(pdfFileNameIn, dirNameOut string, fileNamesIn []string, config *pdf.Configuration) *Command
ExtractAttachmentsCommand creates a new command to extract attachments.
func ExtractContentCommand ¶
func ExtractContentCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command
ExtractContentCommand creates a new command to extract page content streams.
func ExtractFontsCommand ¶
func ExtractFontsCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command
ExtractFontsCommand creates a new command to extract embedded fonts. (experimental)
func ExtractImagesCommand ¶
func ExtractImagesCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command
ExtractImagesCommand creates a new command to extract embedded images. (experimental
func ExtractMetadataCommand ¶ added in v0.1.16
func ExtractMetadataCommand(pdfFileNameIn, dirNameOut string, config *pdf.Configuration) *Command
ExtractMetadataCommand creates a new command to extract metadata streams.
func ExtractPagesCommand ¶
func ExtractPagesCommand(pdfFileNameIn, dirNameOut string, pageSelection []string, config *pdf.Configuration) *Command
ExtractPagesCommand creates a new command to extract specific pages of a file.
func ListAttachmentsCommand ¶
func ListAttachmentsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command
ListAttachmentsCommand create a new command to list attachments.
func ListPermissionsCommand ¶
func ListPermissionsCommand(pdfFileNameIn string, config *pdf.Configuration) *Command
ListPermissionsCommand create a new command to list permissions.
func MergeCommand ¶
func MergeCommand(pdfFileNamesIn []string, pdfFileNameOut string, config *pdf.Configuration) *Command
MergeCommand creates a new command to merge files.
func OptimizeCommand ¶
func OptimizeCommand(pdfFileNameIn, pdfFileNameOut string, config *pdf.Configuration) *Command
OptimizeCommand creates a new command to optimize a file.
func RemoveAttachmentsCommand ¶
func RemoveAttachmentsCommand(pdfFileNameIn string, fileNamesIn []string, config *pdf.Configuration) *Command
RemoveAttachmentsCommand creates a new command to remove attachments.
func SplitCommand ¶
func SplitCommand(pdfFileNameIn, dirNameOut string, config *pdf.Configuration) *Command
SplitCommand creates a new command to split a file into single page file.
func TrimCommand ¶
func TrimCommand(pdfFileNameIn, pdfFileNameOut string, pageSelection []string, config *pdf.Configuration) *Command
TrimCommand creates a new command to trim the pages of a file.
func ValidateCommand ¶
func ValidateCommand(pdfFileName string, config *pdf.Configuration) *Command
ValidateCommand creates a new command to validate a file.