update FPDI to 2.3.7
This commit is contained in:
parent
0f4ec3d32d
commit
0c18bca69f
8 changed files with 29 additions and 34 deletions
|
@ -29,7 +29,7 @@ class Fpdi extends FpdfTpl
|
|||
*
|
||||
* @string
|
||||
*/
|
||||
const VERSION = '2.3.6';
|
||||
const VERSION = '2.3.7';
|
||||
|
||||
protected function _enddoc()
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ class FixedReader extends AbstractReader implements ReaderInterface
|
|||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return int|false
|
||||
*/
|
||||
public function getOffsetFor($objectNumber)
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ class LineReader extends AbstractReader implements ReaderInterface
|
|||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return int|false
|
||||
*/
|
||||
public function getOffsetFor($objectNumber)
|
||||
{
|
||||
|
|
|
@ -87,37 +87,28 @@ class Lzw implements FilterInterface
|
|||
$this->nextData = 0;
|
||||
$this->nextBits = 0;
|
||||
|
||||
$oldCode = 0;
|
||||
$prevCode = 0;
|
||||
|
||||
$uncompData = '';
|
||||
|
||||
while (($code = $this->getNextCode()) !== 257) {
|
||||
if ($code === 256) {
|
||||
$this->initsTable();
|
||||
$code = $this->getNextCode();
|
||||
|
||||
if ($code === 257) {
|
||||
break;
|
||||
}
|
||||
|
||||
} elseif ($prevCode === 256) {
|
||||
$uncompData .= $this->sTable[$code];
|
||||
$oldCode = $code;
|
||||
} elseif ($code < $this->tIdx) {
|
||||
$string = $this->sTable[$code];
|
||||
$uncompData .= $string;
|
||||
|
||||
$this->addStringToTable($this->sTable[$prevCode], $string[0]);
|
||||
} else {
|
||||
if ($code < $this->tIdx) {
|
||||
$string = $this->sTable[$code];
|
||||
$uncompData .= $string;
|
||||
$string = $this->sTable[$prevCode];
|
||||
$string .= $string[0];
|
||||
$uncompData .= $string;
|
||||
|
||||
$this->addStringToTable($this->sTable[$oldCode], $string[0]);
|
||||
$oldCode = $code;
|
||||
} else {
|
||||
$string = $this->sTable[$oldCode];
|
||||
$string .= $string[0];
|
||||
$uncompData .= $string;
|
||||
|
||||
$this->addStringToTable($string);
|
||||
$oldCode = $code;
|
||||
}
|
||||
$this->addStringToTable($string);
|
||||
}
|
||||
$prevCode = $code;
|
||||
}
|
||||
|
||||
return $uncompData;
|
||||
|
@ -163,7 +154,7 @@ class Lzw implements FilterInterface
|
|||
/**
|
||||
* Returns the next 9, 10, 11 or 12 bits.
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
protected function getNextCode()
|
||||
{
|
||||
|
|
|
@ -46,9 +46,8 @@ class PdfStream extends PdfType
|
|||
|
||||
// Find the first "newline"
|
||||
while (($firstByte = $reader->getByte($offset)) !== false) {
|
||||
if ($firstByte !== "\n" && $firstByte !== "\r") {
|
||||
$offset++;
|
||||
} else {
|
||||
$offset++;
|
||||
if ($firstByte === "\n" || $firstByte === "\r") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -60,11 +59,7 @@ class PdfStream extends PdfType
|
|||
);
|
||||
}
|
||||
|
||||
$sndByte = $reader->getByte($offset + 1);
|
||||
if ($firstByte === "\n" || $firstByte === "\r") {
|
||||
$offset++;
|
||||
}
|
||||
|
||||
$sndByte = $reader->getByte($offset);
|
||||
if ($sndByte === "\n" && $firstByte !== "\n") {
|
||||
$offset++;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,8 @@ class PdfReader
|
|||
return;
|
||||
}
|
||||
|
||||
$readPages = function ($kids, $count) use (&$readPages, $readAll) {
|
||||
$expectedPageCount = $this->getPageCount();
|
||||
$readPages = function ($kids, $count) use (&$readPages, $readAll, $expectedPageCount) {
|
||||
$kids = PdfArray::ensure($kids);
|
||||
$isLeaf = ($count->value === \count($kids->value));
|
||||
|
||||
|
@ -222,6 +223,11 @@ class PdfReader
|
|||
} else {
|
||||
$this->pages[] = $object;
|
||||
}
|
||||
|
||||
// stop if all pages are read - faulty documents exists with additional entries with invalid data.
|
||||
if (count($this->pages) === $expectedPageCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Fpdi extends \TCPDF
|
|||
*
|
||||
* @string
|
||||
*/
|
||||
const VERSION = '2.3.6';
|
||||
const VERSION = '2.3.7';
|
||||
|
||||
/**
|
||||
* A counter for template ids.
|
||||
|
@ -140,6 +140,7 @@ class Fpdi extends \TCPDF
|
|||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @return string
|
||||
*/
|
||||
protected function _getxobjectdict()
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ class Fpdi extends FpdfTpl
|
|||
*
|
||||
* @string
|
||||
*/
|
||||
const VERSION = '2.3.6';
|
||||
const VERSION = '2.3.7';
|
||||
|
||||
public function _enddoc()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue