Symfony Exception

CrossReferenceException

HTTP 500 Internal Server Error

This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)

Exception

setasign\Fpdi\PdfParser\CrossReference\ CrossReferenceException

  1.                 );
  2.             }
  3.             $this->checkForEncryption($stream->value);
  4.             throw new CrossReferenceException(
  5.                 'This PDF document probably uses a compression technique which is not supported by the ' .
  6.                 'free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)',
  7.                 CrossReferenceException::COMPRESSED_XREF
  8.             );
  9.         }
  1.     {
  2.         $this->parser->getStreamReader()->reset($offset);
  3.         $this->parser->getTokenizer()->clearStack();
  4.         $initValue $this->parser->readValue();
  5.         return $this->initReaderInstance($initValue);
  6.     }
  7.     /**
  8.      * Get a cross-reference reader instance.
  9.      *
  1.         $offset $this->findStartXref();
  2.         $reader null;
  3.         /** @noinspection TypeUnsafeComparisonInspection */
  4.         while ($offset != false) { // By doing an unsafe comparsion we ignore faulty references to byte offset 0
  5.             try {
  6.                 $reader $this->readXref($offset $this->fileHeaderOffset);
  7.             } catch (CrossReferenceException $e) {
  8.                 // sometimes the file header offset is part of the byte offsets, so let's retry by resetting it to zero.
  9.                 if ($e->getCode() === CrossReferenceException::INVALID_DATA && $this->fileHeaderOffset !== 0) {
  10.                     $this->fileHeaderOffset 0;
  11.                     $reader $this->readXref($offset $this->fileHeaderOffset);
  1.      * @throws PdfParserException
  2.      */
  3.     public function getCrossReference()
  4.     {
  5.         if ($this->xref === null) {
  6.             $this->xref = new CrossReference($this$this->resolveFileHeader());
  7.         }
  8.         return $this->xref;
  9.     }
in vendor/setasign/fpdi/src/PdfParser/PdfParser.php -> getCrossReference (line 205)
  1.      * @throws CrossReferenceException
  2.      * @throws PdfParserException
  3.      */
  4.     public function getCatalog()
  5.     {
  6.         $trailer $this->getCrossReference()->getTrailer();
  7.         $catalog PdfType::resolve(PdfDictionary::get($trailer'Root'), $this);
  8.         return PdfDictionary::ensure($catalog);
  9.     }
  1.                 PdfParserException::PDF_VERSION_NOT_FOUND
  2.             );
  3.         }
  4.         list(, $major$minor) = $result;
  5.         $catalog $this->getCatalog();
  6.         if (isset($catalog->value['Version'])) {
  7.             $versionParts = \explode(
  8.                 '.',
  9.                 PdfName::unescape(PdfType::resolve($catalog->value['Version'], $this)->value)
  10.             );
  1.      * @return string
  2.      * @throws PdfParserException
  3.      */
  4.     public function getPdfVersion()
  5.     {
  6.         return \implode('.'$this->parser->getPdfVersion());
  7.     }
  8.     /**
  9.      * Get the page count.
  10.      *
in vendor/setasign/fpdi/src/FpdiTrait.php -> getPdfVersion (line 217)
  1.     {
  2.         $this->currentReaderId $this->getPdfReaderId($file);
  3.         $this->objectsToCopy[$this->currentReaderId] = [];
  4.         $reader $this->getPdfReader($this->currentReaderId);
  5.         $this->setMinPdfVersion($reader->getPdfVersion());
  6.         return $reader->getPageCount();
  7.     }
  8.     /**
Fpdi->setSourceFile() in src/Utils/Watermark.php (line 62)
  1.         if (is_null($this->_tplIdx)) {
  2.             // THIS IS WHERE YOU GET THE NUMBER OF PAGES
  3.             $this->numPages $this->setSourceFile($this->fullPathFile);
  4.             $this->_tplIdx $this->importPage(1);
  5.         }
  6.         $this->useTemplate($this->_tplIdx00200);
  7.     }
in vendor/setasign/fpdf/fpdf.php -> Header (line 334)
  1.         $this->_out($fc);
  2.     $this->TextColor $tc;
  3.     $this->ColorFlag $cf;
  4.     // Page header
  5.     $this->InHeader true;
  6.     $this->Header();
  7.     $this->InHeader false;
  8.     // Restore line width
  9.     if($this->LineWidth!=$lw)
  10.     {
  11.         $this->LineWidth $lw;
  1.     public function AddPage($orientation ''$size ''$rotation 0)
  2.     {
  3.         if ($this->currentTemplateId !== null) {
  4.             throw new \BadMethodCallException('Pages cannot be added when writing to a template.');
  5.         }
  6.         parent::AddPage($orientation$size$rotation);
  7.     }
  8.     /**
  9.      * @inheritdoc
  10.      */
FpdfTpl->AddPage() in src/Controller/PapersController.php (line 297)
  1.         $watermark->addText($paper->getType()->getTitle(), $link);
  2.         $watermark->addText('ISSN: '$paper->getType()->getIssn());
  3.         $watermark->addText("Vol:".$paper->getVolumeNo().", No:".$paper->getIssueNo().", ".$paper->getYear());
  4.         $watermark->addText($fileNumber'pageNumber');
  5.         $watermark->AddPage();
  6.         $watermark->SetFont('Arial'''12);
  7.         $watermark->_tplIdx $watermark->importPage(1);
  8.         if($watermark->numPages>1) {
  9.             for($i=2;$i<=$watermark->numPages;$i++) {
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle() in public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

CrossReferenceException

setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException:
This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)

  at vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php:257
  at setasign\Fpdi\PdfParser\CrossReference\CrossReference->initReaderInstance()
     (vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php:209)
  at setasign\Fpdi\PdfParser\CrossReference\CrossReference->readXref()
     (vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php:67)
  at setasign\Fpdi\PdfParser\CrossReference\CrossReference->__construct()
     (vendor/setasign/fpdi/src/PdfParser/PdfParser.php:157)
  at setasign\Fpdi\PdfParser\PdfParser->getCrossReference()
     (vendor/setasign/fpdi/src/PdfParser/PdfParser.php:205)
  at setasign\Fpdi\PdfParser\PdfParser->getCatalog()
     (vendor/setasign/fpdi/src/PdfParser/PdfParser.php:181)
  at setasign\Fpdi\PdfParser\PdfParser->getPdfVersion()
     (vendor/setasign/fpdi/src/PdfReader/PdfReader.php:84)
  at setasign\Fpdi\PdfReader\PdfReader->getPdfVersion()
     (vendor/setasign/fpdi/src/FpdiTrait.php:217)
  at setasign\Fpdi\Fpdi->setSourceFile()
     (src/Utils/Watermark.php:62)
  at App\Utils\Watermark->Header()
     (vendor/setasign/fpdf/fpdf.php:334)
  at FPDF->AddPage()
     (vendor/setasign/fpdi/src/FpdfTplTrait.php:329)
  at setasign\Fpdi\FpdfTpl->AddPage()
     (src/Controller/PapersController.php:297)
  at App\Controller\PapersController->pdf()
     (vendor/symfony/http-kernel/HttpKernel.php:158)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:80)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)