Skip to content

Commit

Permalink
Add utility methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Dec 28, 2022
1 parent 58baba3 commit 61dafe5
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/Tcpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,36 @@ public function __construct(
$this->unit = $unit;
$this->isunicode = $isunicode;
$this->subsetfont = $subsetfont;
$this->setPDFMode($mode);
$this->setCompressMode($compress);
$this->setPDFVersion();
$this->encrypt = $encobj;
$this->initClassObjects();
}

/**
* Set the pdf mode.
*
* @param string $mode Input PDFA mode.
*/
protected function setPDFMode($mode)
{
$this->pdfx = ($mode == 'pdfx');
$matches = array('', '0');
$this->pdfa = 0;
$matches = array('', '0');
if (preg_match('/^pdfa([1-3])$/', $mode, $matches) === 1) {
$this->pdfa = (int) $matches[1];
}
}

/**
* Set the compression mode.
*
* @param bool $compress Set to false to disable stream compression.
*/
protected function setCompressMode($compress)
{
$this->compress = (((bool) $compress) && ($this->pdfa != 3));
$this->setPDFVersion();
$this->encrypt = $encobj;
$this->initClassObjects();
}

/**
Expand Down

0 comments on commit 61dafe5

Please sign in to comment.