api

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package api provides support for interacting with pdf.

Index

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

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

AddWatermarks adds watermarks to all pages selected.

func ChangeOwnerPassword

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

ChangeOwnerPassword of fileIn and write result to fileOut.

func ChangeUserPassword

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

ChangeUserPassword of fileIn and write result to fileOut.

func Decrypt

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

Decrypt fileIn and write result to fileOut.

func Encrypt

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

Encrypt 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

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

ExtractContent dumps "PDF source" files from fileIn into dirOut for selected pages.

func ExtractFonts

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

ExtractFonts dumps embedded fontfiles from fileIn into dirOut for selected pages.

func ExtractImages

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

ExtractImages dumps embedded image resources from fileIn into dirOut for selected pages.

func ExtractMetadata added in v0.1.16

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

ExtractMetadata dumps all metadata dict entries for fileIn into dirOut.

func ExtractPages

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

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

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

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

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

Optimize reads in fileIn, does validation, optimization and writes the result to fileOut.

func ParsePageSelection

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

ParsePageSelection ensures a correct page selection expression.

func Process

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

Process executes a pdfcpu command.

func Read

func Read(fileIn string, config *pdf.Configuration) (*pdf.Context, error)

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

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

Split generates a sequence of single page PDF files in dirOut creating one file for every page of inFile.

func Trim

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

Trim generates a trimmed version of fileIn containing all pages selected.

func Validate

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

Validate validates a PDF file against ISO-32000-1:2008.

func Write

func Write(ctx *pdf.Context) error

Write generates a PDF file for a given Context.

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.

Jump to

Keyboard shortcuts

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