/**
* @param string|Pdf $name the PDF filename or Pdf instance to add for processing
* @param string|null $handle 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
* @param string|null $password the owner (or user) password if any
* @return Pdf the pdf instance for method chaining
*/
public function addFile($name, $handle = null, $password = null)
{
if ($handle === null) {
$handle = $this->nextHandle();
}
if ($name instanceof Pdf) {
// Keep a reference to the object to prevent unlinking
$this->_pdf = $name;
if (!$name->getCommand()->getExecuted()) {
// @todo: Catch errors!
$name->execute();
}
$name = (string) $name->getTmpFile();
}
$this->getCommand()->addFile($name, $handle, $password);
return $this;
}