Property | Type | Description | |
---|---|---|---|
$ignoreWarnings | whether to ignore any errors if some non-empty output file was still created. Default is false. |
Property | Type | Description | |
---|---|---|---|
$_command | the command instance that executes pdftk | ||
$_data | the PDF data as returned from getData() | ||
$_dataFields | the PDF form field data as returned from getDataFields() | ||
$_dataFields_utf8 | |||
$_data_utf8 | |||
$_error | the error message | ||
$_handle | a counter for autogenerated handles | ||
$_output | the output filename. If null (default) a tmp file is used as output. If false, no output option is added at all. | ||
$_pdf | if the input was an instance, we keep a reference here, so that it won't get unlinked before this object gets destroyed | ||
$_tmpFile | the temporary output file | ||
$_tmpOutputContentType | the content type of the tmp output |
Method | Description | |
---|---|---|
__construct ( string | |
||
addFile ( string | |
||
allow ( string | null $permissions = null ) : |
Set PDF permissions | |
background ( string $file ) : |
Apply a PDF as watermark to the background of a single PDF file. | |
burst ( string | null $filepattern = null ) : boolean | Split the PDF document into pages | |
cat ( integer | string | array $start, integer | string | null $end = null, string | null $handle = null, string | null $qualifier = null, string $rotation = null ) : |
Assemble (catenate) pages from the input files. | |
compress ( boolean $compress = true ) : |
Restore/remove compression | |
dropXfa ( ) : |
Drop XFA data from forms created with newer Acrobat. | |
dropXmp ( ) : |
Drop XMP meta data | |
execute ( ) : boolean | Execute the pdftk command and store the output file to a temporary location or $this->_output if set. | |
fillForm ( string | array $data, $encoding = 'UTF-8', $dropXfa = true, $format = 'xfdf' ) : |
Fill a PDF form | |
flatten ( ) : |
Flatten the PDF form fields values into a single PDF file. | |
generateFdfFile ( string $name ) : |
Generate the FDF file for a single PDF file. | |
getCommand ( ) : |
||
getData ( boolean $utf8 = true ) : string | boolean | ||
getDataFields ( boolean $utf8 = true ) : string | boolean | ||
getError ( ) : string | ||
getTmpFile ( ) : mikehaertl\tmp\File | ||
keepId ( $id = 'first' ) : |
When combining multiple PDFs, use either the first or last ID in the output. | |
multiBackground ( string $file ) : |
Apply multiple PDF pages as watermark to the corresponding pages of a single PDF file. | |
multiStamp ( string $file ) : |
Add multiple pages from $file as overlay to the corresponding pages of a single PDF file. | |
needAppearances ( ) : |
Set need_appearances flag in PDF | |
passwordEncryption ( integer $strength = 128 ) : |
||
saveAs ( string $name ) : boolean | Execute the operation and save the output file | |
send ( string | null $filename = null, boolean $inline = false ) : boolean | Send PDF to client, either inline or as download (triggers PDF creation) | |
setPassword ( string $password ) : |
||
setUserPassword ( string $password ) : |
||
shuffle ( integer | array $start, integer | null $end = null, string $handle = null, string | null $qualifier = null, string $rotation = null ) : |
Shuffle pages from the input files. | |
stamp ( string $file ) : |
Add $file as overlay to a single PDF file. |
Method | Description | |
---|---|---|
constrainSingleFile ( ) | Make sure, that only one file is present | |
nextHandle ( ) : string |
public __construct ( string | |
||
string | |
a pdf filename or Pdf instance or an array of filenames/instances indexed by a handle. The array values can also be arrays of the form array($filename, $password) if some files are password protected. | |
$options | array | Options to pass to set on the Command instance, e.g. the pdftk binary path |
public addFile ( string | |
||
$name | string | |
the PDF filename or Pdf instance to add for processing |
$handle | string | null | one or more uppercase letters A..Z to reference this file later. If no handle is provided, an internal handle is autocreated, consuming the range Z..A |
$password | string | null | the owner (or user) password if any |
return | the pdf instance for method chaining |
public background ( string $file ) : |
||
$file | string | name of the background PDF file. Only the first page is used. |
return | the pdf instance for method chaining |
public cat ( integer | string | array $start, integer | string | null $end = null, string | null $handle = null, string | null $qualifier = null, string $rotation = null ) : |
||
$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. |
return | the pdf instance for method chaining |
protected constrainSingleFile ( ) |
public dropXfa ( ) : |
||
return | the pdf instance for method chaining |
public dropXmp ( ) : |
||
return | the pdf instance for method chaining |
public flatten ( ) : |
||
return | the pdf instance for method chaining |
public generateFdfFile ( string $name ) : |
||
$name | string | name of the FDF file |
return | the pdf instance for method chaining |
public getCommand ( ) : |
||
return | the command instance that executes pdftk |
public getTmpFile ( ) : mikehaertl\tmp\File | ||
return | mikehaertl\tmp\File | the temporary output file instance |
public keepId ( $id = 'first' ) : |
||
return | the pdf instance for method chaining |
public multiBackground ( string $file ) : |
||
$file | string | name of the background PDF file. |
return | the pdf instance for method chaining |
public multiStamp ( string $file ) : |
||
$file | string | name of the PDF file to add as overlay |
return | the pdf instance for method chaining |
public needAppearances ( ) : |
||
return | the pdf instance for method chaining |
protected nextHandle ( ) : string | ||
return | string | the next handle in the series A, B, C, ... Z, AA, AB... |
public passwordEncryption ( integer $strength = 128 ) : |
||
$strength | integer | the password encryption strength. Default is 128 |
return | the pdf instance for method chaining |
public send ( string | null $filename = null, boolean $inline = false ) : boolean | ||
$filename | string | null | the filename to send. If empty, the PDF is streamed inline. |
$inline | boolean | whether to force inline display of the PDF, even if filename is present. |
return | boolean | whether PDF was created successfully |
public setPassword ( string $password ) : |
||
$password | string | the owner password to set on the output PDF |
return | the pdf instance for method chaining |
public setUserPassword ( string $password ) : |
||
$password | string | the user password to set on the output PDF |
return | the pdf instance for method chaining |
public shuffle ( integer | array $start, integer | null $end = null, string $handle = null, string | null $qualifier = null, string $rotation = null ) : |
||
$start | integer | array | the start page number or an array of page numbers. |
$end | integer | null | the end page number or null for single page (or list if $start is an array) |
$handle | string | the handle of the input file to use |
$qualifier | string | null | the page number qualifier, either 'even' or 'odd' or null for none |
$rotation | string | the rotation to apply to the pages. See cat() for more details. |
return | the pdf instance for method chaining |
protected $_dataFields |
protected $_output |
protected $_pdf |
protected $_tmpOutputContentType |