Coder Social home page Coder Social logo

Stream value expected about fpdi HOT 10 CLOSED

setasign avatar setasign commented on September 26, 2024
Stream value expected

from fpdi.

Comments (10)

JanSlabon avatar JanSlabon commented on September 26, 2024

This looks like a fauly PDF file. Any chance to get access to it?

from fpdi.

JanSlabon avatar JanSlabon commented on September 26, 2024

Any news on this?

from fpdi.

JanSlabon avatar JanSlabon commented on September 26, 2024

Ok, I will close this issue because of inactivity.

from fpdi.

cctop avatar cctop commented on September 26, 2024

@JanSlabon

We found this ticket by searching the web. We are getting similar error (shown below) in our production environment. We are purchased and using FPDI_PDF-Parser-2.0.3.

  • Since this issue is already closed, can you reopen this please.
  • And we will be able share the PDF file which is causing the issue via a private email. Please let me know how we could share a production/client pdf file with you directly instead of this public portal.

If you need any other details, please let us know. Thanks and your help is very much appreciated.

Here is the error:

2018-09-01 18:35:17 Error: [setasign\Fpdi\PdfParser\Type\PdfTypeException] Stream value expected.
Request URL: /ExpenseReports/generateFinalPdf
Referer URL: https://www.someurl.com/
Stack Trace:
#0 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php(101): setasign\Fpdi\PdfParser\Type\PdfType::ensureType('setasign\\Fpdi\\P...', Object(setasign\Fpdi\PdfParser\Type\PdfDictionary), 'Stream value ex...')
#1 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php(216): setasign\Fpdi\PdfParser\Type\PdfStream::ensure(Object(setasign\Fpdi\PdfParser\Type\PdfDictionary))
#2 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/src/PdfParser/CrossReference/CrossReference.php(127): setasign\Fpdi\PdfParser\CrossReference\CrossReference->initReaderInstance(Object(setasign\Fpdi\PdfParser\Type\PdfIndirectObject))
#3 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php(188): setasign\FpdiPdfParser\PdfParser\CrossReference\CrossReference->initReaderInstance(Object(setasign\Fpdi\PdfParser\Type\PdfIndirectObject))
#4 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php(64): setasign\Fpdi\PdfParser\CrossReference\CrossReference->readXref(0)
#5 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/src/PdfParser/CrossReference/CrossReference.php(58): setasign\Fpdi\PdfParser\CrossReference\CrossReference->__construct(Object(setasign\FpdiPdfParser\PdfParser\PdfParser), 0)
#6 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/src/PdfParser/PdfParser.php(30): setasign\FpdiPdfParser\PdfParser\CrossReference\CrossReference->__construct(Object(setasign\FpdiPdfParser\PdfParser\PdfParser), 0)
#7 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/PdfParser/PdfParser.php(197): setasign\FpdiPdfParser\PdfParser\PdfParser->getCrossReference()
#8 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/PdfParser/PdfParser.php(179): setasign\Fpdi\PdfParser\PdfParser->getCatalog()
#9 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/PdfReader/PdfReader.php(82): setasign\Fpdi\PdfParser\PdfParser->getPdfVersion()
#10 /var/www/html/Enterprise/cakephp/vendor/tcpdf/FPDI_PDF-Parser-2.0.3/vendor/setasign/fpdi/src/FpdiTrait.php(182): setasign\Fpdi\PdfReader\PdfReader->getPdfVersion()
#11 /var/www/html/Enterprise/cakephp/src/Controller/Component/FileComponent.php(1020): setasign\Fpdi\Fpdi->setSourceFile('/var/www/html/E...')
#12 /var/www/html/Enterprise/cakephp/src/Controller/ExpenseReportsController.php(3572): App\Controller\Component\FileComponent->exportExpenseReportPDFFile(Array, 'AB1342180826161...')
#13 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Controller/Controller.php(441): App\Controller\ExpenseReportsController->generateFinalPdf()
#14 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(119): Cake\Controller\Controller->invokeAction()
#15 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/ActionDispatcher.php(93): Cake\Http\ActionDispatcher->_invoke(Object(App\Controller\ExpenseReportsController))
#16 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/BaseApplication.php(103): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#17 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#18 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Routing/Middleware/RoutingMiddleware.php(107): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#19 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#20 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Routing/Middleware/AssetMiddleware.php(88): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#21 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#22 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Error/Middleware/ErrorHandlerMiddleware.php(93): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#23 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#24 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#25 /var/www/html/Enterprise/cakephp/vendor/cakephp/cakephp/src/Http/Server.php(81): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#26 /var/www/html/Enterprise/cakephp/webroot/index.php(37): Cake\Http\Server->run()
#27 {main}

from fpdi.

JanSlabon avatar JanSlabon commented on September 26, 2024

Please send the PDF in question to [email protected], thanks!

from fpdi.

cctop avatar cctop commented on September 26, 2024

Appreciate your quick response. I believe we may have found the issue.

  • The original file possibly is an paper invoice scanned or taken as a picture in high resolution and saved as PDF. The page size in this document is set to 23.61 x 32.47 in
  • It is still a valid PDF document.
  • I just reprinted using Acrobat reader into 8.50 x 11.00 in standard letter size and then used it in our process. And that worked.
  • Just for your reference, I'm adding a screen shot of the PDF properties page.
    image

What we are trying to do in our process is to combine images and other attachments into a single PDF document. I believe the FPDI-PDF_Parser by default is set to use 8.50 x 11.00 in and not able to handle the large page size file.

Let me know what I'm saying here make sense. If you still need the pdf file, let me know and I'll send it to you.

from fpdi.

JanSlabon avatar JanSlabon commented on September 26, 2024

Your "solution" has nothing to do with the main problem and FPDI does not set any default page size (but FPDF or TCPSD) nor does not support large files. The initial PDF document simply have an invalid/faulty structure in it. The viewer you are using seems to ignore that problem which allowed you to simply reprint it. Maybe a complete resave would also fix this.

The problem IS the in-file and without analyzing it, it is impossible to see how and if we can fix this.

from fpdi.

cctop avatar cctop commented on September 26, 2024

Ok, I just sent you the file in question to [email protected] email address.

from fpdi.

JanSlabon avatar JanSlabon commented on September 26, 2024

Thanks!

The problem with this file is following:
The file includes only a single cross reference but internally it points to a previous one at byte offset 0:

trailer
<< /Prev 0 /Root 5 0 R /Size 6 >>

FPDI finds an object after jumping to this offset but it is simply not a valid cross-reference.

I just fixed this with #58. An official release will follow in the next days or weeks.

from fpdi.

cctop avatar cctop commented on September 26, 2024

Thank you.

from fpdi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.