PHP Класс mikehaertl\pdftk\Command

This class represents an pdftk shell command. It extends a standard shellcommand and adds pdftk specific features to add options and operations.
Автор: Michael Härtl ([email protected])
Наследование: extends mikehaertl\shellcommand\Command
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_command the pdftk binary
$_escapeOperationArgument whether to force escaping of the operation argument e.g. for filenames
$_files list of input files to process as array('name' => $filename, 'password' => $pw) indexed by handle
$_operation the operation to perform
$_operationArgument operation arguments, e.g. a list of page ranges or a filename or tmp file instance
$_options list of command options, either strings or array with arguments to addArg()

Открытые методы

Метод Описание
addFile ( string $name, string $handle, string | null $password = null ) : Command
addOption ( string $option, string | File | null $argument = null, $escape = null ) : Command
addPageRange ( integer | string | array $start, integer | string | null $end = null, string | null $handle = null, string | null $qualifier = null, string $rotation = null ) : Command Add a page range as used by some operations
execute ( string | null $filename = null ) : boolean
getFileCount ( ) : integer
getOperation ( ) : string | null
getOperationArgument ( ) : string | array | null
setOperation ( string $operation ) : Command
setOperationArgument ( string $value, boolean $escape = false ) : Command

Защищенные методы

Метод Описание
checkExecutionStatus ( ) Ensure that the command was not exectued yet. Throws exception otherwise.
processInputFiles ( ) Process input PDF files and create respective command arguments
processOperation ( ) Process opearation and create respective command arguments
processOptions ( string | null $filename = null ) Process options and create respective command arguments

Описание методов

addFile() публичный метод

public addFile ( string $name, string $handle, string | null $password = null ) : Command
$name string the PDF file to add for processing
$handle string one or more uppercase letters A..Z to reference this file later.
$password string | null the owner (or user) password if any
Результат Command the command instance for method chaining

addOption() публичный метод

public addOption ( string $option, string | File | null $argument = null, $escape = null ) : Command
$option string the pdftk option to add
$argument string | File | null the argument to add, either string, File instance or null if none
Результат Command the command instance for method chaining

addPageRange() публичный метод

Add a page range as used by some operations
public addPageRange ( integer | string | array $start, integer | string | null $end = null, string | null $handle = null, string | null $qualifier = null, string $rotation = null ) : Command
$start integer | string | array the start page number or an array of page numbers. If an array, the other arguments will be ignored. $start can also be bigger than $end for pages in reverse order.
$end integer | string | null the end page number or null for single page (or list if $start is an array)
$handle string | null the handle of the file to use. Can be null if only a single file was added.
$qualifier string | null the page number qualifier, either 'even' or 'odd' or null for none
$rotation string the rotation to apply to the pages.
Результат Command the command instance for method chaining

checkExecutionStatus() защищенный метод

Ensure that the command was not exectued yet. Throws exception otherwise.
protected checkExecutionStatus ( )

execute() публичный метод

public execute ( string | null $filename = null ) : boolean
$filename string | null the filename to add as 'output' option or null if none
Результат boolean whether the command was executed successfully

getFileCount() публичный метод

public getFileCount ( ) : integer
Результат integer the number of files added to the command

getOperation() публичный метод

public getOperation ( ) : string | null
Результат string | null the current operation or null if none set

getOperationArgument() публичный метод

public getOperationArgument ( ) : string | array | null
Результат string | array | null the current operation argument as string or array or null if none set

processInputFiles() защищенный метод

Process input PDF files and create respective command arguments
protected processInputFiles ( )

processOperation() защищенный метод

Process opearation and create respective command arguments
protected processOperation ( )

processOptions() защищенный метод

Process options and create respective command arguments
protected processOptions ( string | null $filename = null )
$filename string | null if provided an 'output' option will be added

setOperation() публичный метод

public setOperation ( string $operation ) : Command
$operation string the operation to perform
Результат Command the command instance for method chaining

setOperationArgument() публичный метод

public setOperationArgument ( string $value, boolean $escape = false ) : Command
$value string the operation argument
$escape boolean whether to escape the operation argument
Результат Command the command instance for method chaining

Описание свойств

$_command защищенное свойство

the pdftk binary
protected $_command

$_escapeOperationArgument защищенное свойство

whether to force escaping of the operation argument e.g. for filenames
protected $_escapeOperationArgument

$_files защищенное свойство

list of input files to process as array('name' => $filename, 'password' => $pw) indexed by handle
protected $_files

$_operation защищенное свойство

the operation to perform
protected $_operation

$_operationArgument защищенное свойство

operation arguments, e.g. a list of page ranges or a filename or tmp file instance
protected $_operationArgument

$_options защищенное свойство

list of command options, either strings or array with arguments to addArg()
protected $_options