Git Product home page Git Product logo

Comments (5)

JanSlabon avatar JanSlabon commented on July 26, 2024 1

The file has a bunch of null bytes and HTML at its end. Just open it in a text editor and scroll to the end of the file... you will see what I mean. You should contact the vendor that produceds these files, so that they can fix this.

By default FPDI only searches for the initial keyword in the last 5500 bytes. You can increase this by this static property. Anyhow for your file this needs to be larger then 400000 bytes!

from fpdi.

seme1 avatar seme1 commented on July 26, 2024

Here is a link to the pdf file:
https://transferxl.com/08j6RcBC3pPn0S

from fpdi.

seme1 avatar seme1 commented on July 26, 2024

I have over 1k files generated like this one. The vendor is a very large company. It's unlikely that they will change the format of the file only so that I can parse it as every one is using these to print the shipping labels without any issues.

I also increased the value of the static variable trailerSearchLength to 8000000 and it stopped producing error messages and the file was indeed merged. However, the file was missing most of its content. Only the left top portion was copied. The remaining parts are blank.

I also attempting to manually remove the NULL bytes and the HTML at the end of the document. The result is still the same (only left top area is copied from each page, remaining parts are all blank )

from fpdi.

JanSlabon avatar JanSlabon commented on July 26, 2024

For me it works with 500000 bytes.

Anyhow, these PDF files are simply not valid. And you don't have to ask the vendor to change the format! They have to fix it! It is a mix of PDF file with a bunch of invalid data at the end of it. If you have a chance to report this issue, do it! Each generated PDF needs additional 400kb of disc space just because of this. If they produce throusand or millions of these documents they will take it seriously.

You are saying "without any issue": That's because reader applications try to repair these files at opening time. Acrobat e.g. ask me if I want to save it when I close the file... that's because it was repaired automatically.

I don't understand what you mean by "the remaining parts are blank". I just did a test and the imported document looks exactly the same as the input file.

from fpdi.

seme1 avatar seme1 commented on July 26, 2024

Thank you for your response. The problem was caused by me setting the wrong dimensions for the newformat parameter. It seems to be working perfectly fine now.

Thanks again for your input. I'll also communicate with the vendor to inform them about format of their PDF files.

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.