cli

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 5 Imported by: 12

Documentation

Overview

Package cli provides pdfcpu command line processing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAttachments

func AddAttachments(cmd *Command) ([]string, error)

AddAttachments embeds inFiles into a PDF context read from inFile and writes the result to outFile.

func AddBoxes added in v0.3.8

func AddBoxes(cmd *Command) ([]string, error)

AddBoxes adds page boundaries to inFile's page tree and writes the result to outFile.

func AddKeywords added in v0.3.2

func AddKeywords(cmd *Command) ([]string, error)

AddKeywords adds keywords to inFile's document info dict and writes the result to outFile.

func AddProperties added in v0.3.2

func AddProperties(cmd *Command) ([]string, error)

AddProperties adds properties to inFile's document info dict and writes the result to outFile.

func AddWatermarks

func AddWatermarks(cmd *Command) ([]string, error)

AddWatermarks adds watermarks or stamps to selected pages of inFile and writes the result to outFile.

func Booklet added in v0.3.9

func Booklet(cmd *Command) ([]string, error)

Booklet arranges selected PDF pages to outFile in an order and arrangement that form a small book.

func ChangeOwnerPassword

func ChangeOwnerPassword(cmd *Command) ([]string, error)

ChangeOwnerPassword of inFile and write result to outFile.

func ChangeUserPassword

func ChangeUserPassword(cmd *Command) ([]string, error)

ChangeUserPassword of inFile and write result to outFile.

func Collect added in v0.3.2

func Collect(cmd *Command) ([]string, error)

Collect creates a custom page sequence for selected pages of inFile and writes result to outFile.

func Create added in v0.3.13

func Create(cmd *Command) ([]string, error)

Create renders page content corresponding to declarations found in inJSONFile and writes the result to outFile. If inFile is present, page content will be appended,

func CreateCheatSheetsFonts added in v0.3.7

func CreateCheatSheetsFonts(cmd *Command) ([]string, error)

CreateCheatSheetsFonts creates single page PDF cheat sheets for user fonts in current dir.

func Crop added in v0.3.8

func Crop(cmd *Command) ([]string, error)

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

func Decrypt

func Decrypt(cmd *Command) ([]string, error)

Decrypt inFile and write result to outFile.

func Dump added in v0.4.0

func Dump(cmd *Command) ([]string, error)

Dump known object to stdout.

func Encrypt

func Encrypt(cmd *Command) ([]string, error)

Encrypt inFile and write result to outFile.

func ExportFormFields added in v0.4.0

func ExportFormFields(cmd *Command) ([]string, error)

ExportFormFields returns a representation of inFile's form as outFileJSON.

func ExtractAttachments

func ExtractAttachments(cmd *Command) ([]string, error)

ExtractAttachments extracts inFiles from a PDF context read from inFile and writes the result to outFile.

func ExtractContent

func ExtractContent(cmd *Command) ([]string, error)

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

func ExtractFonts

func ExtractFonts(cmd *Command) ([]string, error)

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

func ExtractImages

func ExtractImages(cmd *Command) ([]string, error)

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

func ExtractMetadata

func ExtractMetadata(cmd *Command) ([]string, error)

ExtractMetadata dumps all metadata dict entries for inFile into outDir.

func ExtractPages

func ExtractPages(cmd *Command) ([]string, error)

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

func FillFormFields added in v0.4.0

func FillFormFields(cmd *Command) ([]string, error)

FillFormFields fills out inFile's form using data represented by inFileJSON.

func ImportImages

func ImportImages(cmd *Command) ([]string, error)

ImportImages appends PDF pages containing images to outFile which will be created if necessary. ImportImages 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.

func Info

func Info(cmd *Command) ([]string, error)

Info gathers information about inFile and returns the result as []string.

func InsertPages

func InsertPages(cmd *Command) ([]string, error)

InsertPages inserts a blank page before or after each selected page.

func InstallFonts added in v0.3.1

func InstallFonts(cmd *Command) ([]string, error)

InstallFonts installs True Type fonts into the pdfcpu pconfig dir.

func ListAnnotations added in v0.3.12

func ListAnnotations(cmd *Command) ([]string, error)

ListAnnotations returns inFile's page annotations.

func ListAttachments

func ListAttachments(cmd *Command) ([]string, error)

ListAttachments returns a list of embedded file attachments for inFile.

func ListBoxes added in v0.3.8

func ListBoxes(cmd *Command) ([]string, error)

ListBoxes returns inFile's page boundaries.

func ListFonts added in v0.3.1

func ListFonts(cmd *Command) ([]string, error)

ListFonts gathers information about supported fonts and returns the result as []string.

func ListFormFields added in v0.4.0

func ListFormFields(cmd *Command) ([]string, error)

ListFormFields returns inFile's form field ids.

func ListImages added in v0.3.12

func ListImages(cmd *Command) ([]string, error)

ListImages returns inFiles embedded images.

func ListKeywords added in v0.3.2

func ListKeywords(cmd *Command) ([]string, error)

ListKeywords returns a list of keywords for inFile.

func ListPermissions

func ListPermissions(cmd *Command) ([]string, error)

ListPermissions of inFile.

func ListProperties added in v0.3.2

func ListProperties(cmd *Command) ([]string, error)

ListProperties returns inFile's properties.

func LockFormFields added in v0.4.0

func LockFormFields(cmd *Command) ([]string, error)

LockFormFields makes some or all form fields of inFile read-only.

func MergeAppend added in v0.3.3

func MergeAppend(cmd *Command) ([]string, error)

MergeAppend merges inFiles in the order specified and writes the result to outFile.

func MergeCreate added in v0.3.3

func MergeCreate(cmd *Command) ([]string, error)

MergeCreate merges inFiles in the order specified and writes the result to outFile.

func MultiFillFormFields added in v0.4.0

func MultiFillFormFields(cmd *Command) ([]string, error)

MultiFillFormFields fills out multiple instances of inFile's form using JSON or CSV data.

func NUp

func NUp(cmd *Command) ([]string, error)

NUp renders selected PDF pages or image files to outFile in n-up fashion.

func Optimize

func Optimize(cmd *Command) ([]string, error)

Optimize inFile and write result to outFile.

func Process

func Process(cmd *Command) (out []string, err error)

Process executes a pdfcpu command.

func RemoveAnnotations added in v0.3.12

func RemoveAnnotations(cmd *Command) ([]string, error)

RemoveAnnotations deletes annotations from inFile's page tree and writes the result to outFile.

func RemoveAttachments

func RemoveAttachments(cmd *Command) ([]string, error)

RemoveAttachments deletes inFiles from a PDF context read from inFile and writes the result to outFile.

func RemoveBoxes added in v0.3.8

func RemoveBoxes(cmd *Command) ([]string, error)

RemoveBoxes deletes page boundaries from inFile's page tree and writes the result to outFile.

func RemoveFormFields added in v0.4.0

func RemoveFormFields(cmd *Command) ([]string, error)

RemoveFormFields removes some form fields from inFile.

func RemoveKeywords added in v0.3.2

func RemoveKeywords(cmd *Command) ([]string, error)

RemoveKeywords deletes keywords from inFile's document info dict and writes the result to outFile.

func RemovePages

func RemovePages(cmd *Command) ([]string, error)

RemovePages removes selected pages.

func RemoveProperties added in v0.3.2

func RemoveProperties(cmd *Command) ([]string, error)

RemoveProperties deletes properties from inFile's document info dict and writes the result to outFile.

func RemoveWatermarks added in v0.2.5

func RemoveWatermarks(cmd *Command) ([]string, error)

RemoveWatermarks remove watermarks or stamps from selected pages of inFile and writes the result to outFile.

func ResetFormFields added in v0.4.0

func ResetFormFields(cmd *Command) ([]string, error)

ResetFormFields sets some or all form fields of inFile to the corresponding default value.

func Resize added in v0.4.0

func Resize(cmd *Command) ([]string, error)

Resize selected pages and write result to outFile.

func Rotate

func Rotate(cmd *Command) ([]string, error)

Rotate selected pages of inFile and write result to outFile.

func SetPermissions

func SetPermissions(cmd *Command) ([]string, error)

SetPermissions of inFile.

func Split

func Split(cmd *Command) ([]string, error)

Split inFile into single page PDFs and write result files to outDir.

func Trim

func Trim(cmd *Command) ([]string, error)

Trim inFile and write result to outFile.

func UnlockFormFields added in v0.4.0

func UnlockFormFields(cmd *Command) ([]string, error)

UnlockFormFields makes some or all form fields of inFile writeable.

func Validate

func Validate(cmd *Command) ([]string, error)

Validate inFile against ISO-32000-1:2008.

Types

type Command

type Command struct {
	Mode           model.CommandMode
	InFile         *string
	InFileJSON     *string
	InFiles        []string
	InDir          *string
	OutFile        *string
	OutFileJSON    *string
	OutDir         *string
	PageSelection  []string
	PWOld          *string
	PWNew          *string
	Span           int
	Rotation       int
	BoolVal        bool
	IntVals        []int
	StringVals     []string
	StringMap      map[string]string
	Input          io.ReadSeeker
	Inputs         []io.ReadSeeker
	Output         io.Writer
	Box            *model.Box
	Import         *pdfcpu.Import
	NUp            *model.NUp
	PageBoundaries *model.PageBoundaries
	Resize         *model.Resize
	Watermark      *model.Watermark
	Conf           *model.Configuration
}

Command represents an execution context.

func AddAttachmentsCommand

func AddAttachmentsCommand(inFile, outFile string, fileNames []string, conf *model.Configuration) *Command

AddAttachmentsCommand creates a new command to add attachments.

func AddAttachmentsPortfolioCommand added in v0.3.2

func AddAttachmentsPortfolioCommand(inFile, outFile string, fileNames []string, conf *model.Configuration) *Command

AddAttachmentsPortfolioCommand creates a new command to add attachments to a portfolio.

func AddBoxesCommand added in v0.3.8

func AddBoxesCommand(inFile, outFile string, pageSelection []string, pb *model.PageBoundaries, conf *model.Configuration) *Command

AddBoxesCommand creates a new command to add page boundaries for selected pages.

func AddKeywordsCommand added in v0.3.2

func AddKeywordsCommand(inFile, outFile string, keywords []string, conf *model.Configuration) *Command

AddKeywordsCommand creates a new command to add keywords.

func AddPropertiesCommand added in v0.3.2

func AddPropertiesCommand(inFile, outFile string, properties map[string]string, conf *model.Configuration) *Command

AddPropertiesCommand creates a new command to add document properties.

func AddWatermarksCommand

func AddWatermarksCommand(inFile, outFile string, pageSelection []string, wm *model.Watermark, conf *model.Configuration) *Command

AddWatermarksCommand creates a new command to add Watermarks to a file.

func BookletCommand added in v0.3.9

func BookletCommand(inFiles []string, outFile string, pageSelection []string, nup *model.NUp, conf *model.Configuration) *Command

BookletCommand creates a new command to render PDFs or image files in booklet fashion.

func ChangeOwnerPWCommand

func ChangeOwnerPWCommand(inFile, outFile string, pwOld, pwNew *string, conf *model.Configuration) *Command

ChangeOwnerPWCommand creates a new command to change the owner password.

func ChangeUserPWCommand

func ChangeUserPWCommand(inFile, outFile string, pwOld, pwNew *string, conf *model.Configuration) *Command

ChangeUserPWCommand creates a new command to change the user password.

func CollectCommand added in v0.3.2

func CollectCommand(inFile, outFile string, pageSelection []string, conf *model.Configuration) *Command

CollectCommand creates a new command to create a custom PDF page sequence.

func CreateCheatSheetsFontsCommand added in v0.3.7

func CreateCheatSheetsFontsCommand(fontFiles []string, conf *model.Configuration) *Command

CreateCheatSheetsFontsCommand creates single page PDF cheat sheets in current dir.

func CreateCommand added in v0.3.13

func CreateCommand(inFileJSON, inFilePDF, outFilePDF string, conf *model.Configuration) *Command

CreateCommand creates a new command to create a PDF file.

func CropCommand added in v0.3.8

func CropCommand(inFile, outFile string, pageSelection []string, box *model.Box, conf *model.Configuration) *Command

CropCommand creates a new command to apply a cropBox to selected pages.

func DecryptCommand

func DecryptCommand(inFile, outFile string, conf *model.Configuration) *Command

DecryptCommand creates a new command to decrypt a file.

func DumpCommand added in v0.4.0

func DumpCommand(inFilePDF string, vals []int, conf *model.Configuration) *Command

DumpCommand creates a new command to dump objects on stdout.

func EncryptCommand

func EncryptCommand(inFile, outFile string, conf *model.Configuration) *Command

EncryptCommand creates a new command to encrypt a file.

func ExportFormCommand added in v0.4.0

func ExportFormCommand(inFilePDF, outFileJSON string, conf *model.Configuration) *Command

ExportFormCommand creates a new command to export a PDF form.

func ExtractAttachmentsCommand

func ExtractAttachmentsCommand(inFile string, outDir string, fileNames []string, conf *model.Configuration) *Command

ExtractAttachmentsCommand creates a new command to extract attachments.

func ExtractContentCommand

func ExtractContentCommand(inFile string, outDir string, pageSelection []string, conf *model.Configuration) *Command

ExtractContentCommand creates a new command to extract page content streams.

func ExtractFontsCommand

func ExtractFontsCommand(inFile string, outDir string, pageSelection []string, conf *model.Configuration) *Command

ExtractFontsCommand creates a new command to extract embedded fonts. (experimental)

func ExtractImagesCommand

func ExtractImagesCommand(inFile string, outDir string, pageSelection []string, conf *model.Configuration) *Command

ExtractImagesCommand creates a new command to extract embedded images. (experimental)

func ExtractMetadataCommand

func ExtractMetadataCommand(inFile string, outDir string, conf *model.Configuration) *Command

ExtractMetadataCommand creates a new command to extract metadata streams.

func ExtractPagesCommand

func ExtractPagesCommand(inFile string, outDir string, pageSelection []string, conf *model.Configuration) *Command

ExtractPagesCommand creates a new command to extract specific pages of a file.

func FillFormCommand added in v0.4.0

func FillFormCommand(inFilePDF, inFileJSON, outFilePDF string, conf *model.Configuration) *Command

FillFormCommand creates a new command to fill a PDF form with data.

func ImportImagesCommand

func ImportImagesCommand(imageFiles []string, outFile string, imp *pdfcpu.Import, conf *model.Configuration) *Command

ImportImagesCommand creates a new command to import images.

func InfoCommand

func InfoCommand(inFile string, pageSelection []string, conf *model.Configuration) *Command

InfoCommand creates a new command to output information about inFile.

func InsertPagesCommand

func InsertPagesCommand(inFile, outFile string, pageSelection []string, conf *model.Configuration, mode string) *Command

InsertPagesCommand creates a new command to insert a blank page before or after selected pages.

func InstallFontsCommand added in v0.3.1

func InstallFontsCommand(fontFiles []string, conf *model.Configuration) *Command

InstallFontsCommand installs true type fonts for embedding.

func ListAnnotationsCommand added in v0.3.12

func ListAnnotationsCommand(inFile string, pageSelection []string, conf *model.Configuration) *Command

ListAnnotationsCommand creates a new command to list annotations for selected pages.

func ListAttachmentsCommand

func ListAttachmentsCommand(inFile string, conf *model.Configuration) *Command

ListAttachmentsCommand create a new command to list attachments.

func ListBoxesCommand added in v0.3.8

func ListBoxesCommand(inFile string, pageSelection []string, pb *model.PageBoundaries, conf *model.Configuration) *Command

ListBoxesCommand creates a new command to list page boundaries for selected pages.

func ListFontsCommand added in v0.3.1

func ListFontsCommand(conf *model.Configuration) *Command

ListFontsCommand returns a list of supported fonts.

func ListFormFieldsCommand added in v0.4.0

func ListFormFieldsCommand(inFiles []string, conf *model.Configuration) *Command

ListFormFieldsCommand creates a new command to list the field ids from a PDF form.

func ListImagesCommand added in v0.3.12

func ListImagesCommand(inFiles []string, pageSelection []string, conf *model.Configuration) *Command

ListImagesCommand creates a new command to list annotations for selected pages.

func ListKeywordsCommand added in v0.3.2

func ListKeywordsCommand(inFile string, conf *model.Configuration) *Command

ListKeywordsCommand create a new command to list keywords.

func ListPermissionsCommand

func ListPermissionsCommand(inFile string, conf *model.Configuration) *Command

ListPermissionsCommand create a new command to list permissions.

func ListPropertiesCommand added in v0.3.2

func ListPropertiesCommand(inFile string, conf *model.Configuration) *Command

ListPropertiesCommand creates a new command to list document properties.

func LockFormCommand added in v0.4.0

func LockFormCommand(inFile, outFile string, fieldIDs []string, conf *model.Configuration) *Command

LockFormCommand creates a new command to lock PDF form fields.

func MergeAppendCommand added in v0.3.3

func MergeAppendCommand(inFiles []string, outFile string, conf *model.Configuration) *Command

MergeAppendCommand creates a new command to merge files. Any existing outFile PDF content will be preserved and serves as the beginning of the merge result.

func MergeCreateCommand added in v0.3.3

func MergeCreateCommand(inFiles []string, outFile string, conf *model.Configuration) *Command

MergeCreateCommand creates a new command to merge files. Outfile will be created. An existing outFile will be overwritten.

func MultiFillFormCommand added in v0.4.0

func MultiFillFormCommand(inFilePDF, inFileData, outDir, outFilePDF string, merge bool, conf *model.Configuration) *Command

MultiFillFormCommand creates a new command to fill multiple PDF forms with JSON or CSV data.

func NUpCommand

func NUpCommand(inFiles []string, outFile string, pageSelection []string, nUp *model.NUp, conf *model.Configuration) *Command

NUpCommand creates a new command to render PDFs or image files in n-up fashion.

func OptimizeCommand

func OptimizeCommand(inFile, outFile string, conf *model.Configuration) *Command

OptimizeCommand creates a new command to optimize a file.

func RemoveAnnotationsCommand added in v0.3.12

func RemoveAnnotationsCommand(inFile, outFile string, pageSelection []string, idsAndTypes []string, objNrs []int, conf *model.Configuration) *Command

RemoveAnnotationsCommand creates a new command to remove annotations for selected pages.

func RemoveAttachmentsCommand

func RemoveAttachmentsCommand(inFile, outFile string, fileNames []string, conf *model.Configuration) *Command

RemoveAttachmentsCommand creates a new command to remove attachments.

func RemoveBoxesCommand added in v0.3.8

func RemoveBoxesCommand(inFile, outFile string, pageSelection []string, pb *model.PageBoundaries, conf *model.Configuration) *Command

RemoveBoxesCommand creates a new command to remove page boundaries for selected pages.

func RemoveFormFieldsCommand added in v0.4.0

func RemoveFormFieldsCommand(inFile, outFile string, fieldIDs []string, conf *model.Configuration) *Command

RemoveFormFieldsCommand creates a new command to remove fields from a PDF form.

func RemoveKeywordsCommand added in v0.3.2

func RemoveKeywordsCommand(inFile, outFile string, keywords []string, conf *model.Configuration) *Command

RemoveKeywordsCommand creates a new command to remove keywords.

func RemovePagesCommand

func RemovePagesCommand(inFile, outFile string, pageSelection []string, conf *model.Configuration) *Command

RemovePagesCommand creates a new command to remove selected pages.

func RemovePropertiesCommand added in v0.3.2

func RemovePropertiesCommand(inFile, outFile string, propKeys []string, conf *model.Configuration) *Command

RemovePropertiesCommand creates a new command to remove document properties.

func RemoveWatermarksCommand added in v0.2.5

func RemoveWatermarksCommand(inFile, outFile string, pageSelection []string, conf *model.Configuration) *Command

RemoveWatermarksCommand creates a new command to remove Watermarks from a file.

func ResetFormCommand added in v0.4.0

func ResetFormCommand(inFile, outFile string, fieldIDs []string, conf *model.Configuration) *Command

ResetFormCommand creates a new command to lock PDF form fields.

func ResizeCommand added in v0.4.0

func ResizeCommand(inFile, outFile string, pageSelection []string, resize *model.Resize, conf *model.Configuration) *Command

ResizeCommand creates a new command to scale selected pages.

func RotateCommand

func RotateCommand(inFile, outFile string, rotation int, pageSelection []string, conf *model.Configuration) *Command

RotateCommand creates a new command to rotate pages.

func SetPermissionsCommand

func SetPermissionsCommand(inFile, outFile string, conf *model.Configuration) *Command

SetPermissionsCommand creates a new command to add permissions.

func SplitCommand

func SplitCommand(inFile, dirNameOut string, span int, conf *model.Configuration) *Command

SplitCommand creates a new command to split a file into single page files.

func TrimCommand

func TrimCommand(inFile, outFile string, pageSelection []string, conf *model.Configuration) *Command

TrimCommand creates a new command to trim the pages of a file.

func UnlockFormCommand added in v0.4.0

func UnlockFormCommand(inFile, outFile string, fieldIDs []string, conf *model.Configuration) *Command

UnlockFormCommand creates a new command to unlock PDF form fields.

func ValidateCommand

func ValidateCommand(inFiles []string, conf *model.Configuration) *Command

ValidateCommand creates a new command to validate a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL