Mise à jour des dépendences
This commit is contained in:
parent
bfecdbfe98
commit
4b3fa030d8
180 changed files with 2026 additions and 737 deletions
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package setasign\Fpdi
|
||||
* @copyright Copyright (c) 2019 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @copyright Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
*/
|
||||
|
||||
|
|
@ -19,8 +20,6 @@ use setasign\Fpdi\PdfParser\Type\PdfTypeException;
|
|||
|
||||
/**
|
||||
* Class representing a rectangle
|
||||
*
|
||||
* @package setasign\Fpdi\PdfReader\DataStructure
|
||||
*/
|
||||
class Rectangle
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package setasign\Fpdi
|
||||
* @copyright Copyright (c) 2019 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @copyright Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
*/
|
||||
|
||||
|
|
@ -25,8 +26,6 @@ use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException;
|
|||
|
||||
/**
|
||||
* Class representing a page of a PDF document
|
||||
*
|
||||
* @package setasign\Fpdi\PdfReader
|
||||
*/
|
||||
class Page
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package setasign\Fpdi
|
||||
* @copyright Copyright (c) 2019 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @copyright Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
*/
|
||||
|
||||
|
|
@ -11,8 +12,6 @@ namespace setasign\Fpdi\PdfReader;
|
|||
|
||||
/**
|
||||
* An abstract class for page boundary constants and some helper methods
|
||||
*
|
||||
* @package setasign\Fpdi\PdfReader
|
||||
*/
|
||||
abstract class PageBoundaries
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package setasign\Fpdi
|
||||
* @copyright Copyright (c) 2019 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @copyright Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
*/
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ use setasign\Fpdi\PdfParser\PdfParser;
|
|||
use setasign\Fpdi\PdfParser\PdfParserException;
|
||||
use setasign\Fpdi\PdfParser\Type\PdfArray;
|
||||
use setasign\Fpdi\PdfParser\Type\PdfDictionary;
|
||||
use setasign\Fpdi\PdfParser\Type\PdfIndirectObject;
|
||||
use setasign\Fpdi\PdfParser\Type\PdfIndirectObjectReference;
|
||||
use setasign\Fpdi\PdfParser\Type\PdfNumeric;
|
||||
use setasign\Fpdi\PdfParser\Type\PdfType;
|
||||
|
|
@ -21,8 +23,6 @@ use setasign\Fpdi\PdfParser\Type\PdfTypeException;
|
|||
|
||||
/**
|
||||
* A PDF reader class
|
||||
*
|
||||
* @package setasign\Fpdi\PdfReader
|
||||
*/
|
||||
class PdfReader
|
||||
{
|
||||
|
|
@ -39,7 +39,7 @@ class PdfReader
|
|||
/**
|
||||
* Indirect objects of resolved pages.
|
||||
*
|
||||
* @var PdfIndirectObjectReference[]
|
||||
* @var PdfIndirectObjectReference[]|PdfIndirectObject[]
|
||||
*/
|
||||
protected $pages = [];
|
||||
|
||||
|
|
@ -59,7 +59,6 @@ class PdfReader
|
|||
public function __destruct()
|
||||
{
|
||||
if ($this->parser !== null) {
|
||||
/** @noinspection PhpInternalEntityUsedInspection */
|
||||
$this->parser->cleanUp();
|
||||
}
|
||||
}
|
||||
|
|
@ -165,9 +164,22 @@ class PdfReader
|
|||
$page = $this->parser->getIndirectObject($page->value);
|
||||
$dict = PdfType::resolve($page, $this->parser);
|
||||
$type = PdfDictionary::get($dict, 'Type');
|
||||
|
||||
if ($type->value === 'Pages') {
|
||||
$kids = PdfType::resolve(PdfDictionary::get($dict, 'Kids'), $this->parser);
|
||||
$page = $this->pages[$pageNumber - 1] = $readPages($kids);
|
||||
try {
|
||||
$page = $this->pages[$pageNumber - 1] = $readPages($kids);
|
||||
} catch (PdfReaderException $e) {
|
||||
if ($e->getCode() !== PdfReaderException::KIDS_EMPTY) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
// let's reset the pages array and read all page objects
|
||||
$this->pages = [];
|
||||
$this->readPages(true);
|
||||
// @phpstan-ignore-next-line
|
||||
$page = $this->pages[$pageNumber - 1];
|
||||
}
|
||||
} else {
|
||||
$this->pages[$pageNumber - 1] = $page;
|
||||
}
|
||||
|
|
@ -179,24 +191,25 @@ class PdfReader
|
|||
/**
|
||||
* Walk the page tree and resolve all indirect objects of all pages.
|
||||
*
|
||||
* @throws PdfTypeException
|
||||
* @param bool $readAll
|
||||
* @throws CrossReferenceException
|
||||
* @throws PdfParserException
|
||||
* @throws PdfTypeException
|
||||
*/
|
||||
protected function readPages()
|
||||
protected function readPages($readAll = false)
|
||||
{
|
||||
if (\count($this->pages) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$readPages = function ($kids, $count) use (&$readPages) {
|
||||
$readPages = function ($kids, $count) use (&$readPages, $readAll) {
|
||||
$kids = PdfArray::ensure($kids);
|
||||
$isLeaf = $count->value === \count($kids->value);
|
||||
$isLeaf = ($count->value === \count($kids->value));
|
||||
|
||||
foreach ($kids->value as $reference) {
|
||||
$reference = PdfIndirectObjectReference::ensure($reference);
|
||||
|
||||
if ($isLeaf) {
|
||||
if (!$readAll && $isLeaf) {
|
||||
$this->pages[] = $reference;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package setasign\Fpdi
|
||||
* @copyright Copyright (c) 2019 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @copyright Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
*/
|
||||
|
||||
|
|
@ -13,8 +14,6 @@ use setasign\Fpdi\FpdiException;
|
|||
|
||||
/**
|
||||
* Exception for the pdf reader class
|
||||
*
|
||||
* @package setasign\Fpdi\PdfReader
|
||||
*/
|
||||
class PdfReaderException extends FpdiException
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue