Comments (5)
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.
Here is a link to the pdf file:
https://transferxl.com/08j6RcBC3pPn0S
from fpdi.
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.
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.
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)
- Custom Font HOT 3
- Added Text missing except on first page when viewing with some PDF software (incl. Acrobat) HOT 1
- setasign\\FpdiPdfParser\\PdfParser\\PdfPars Class not founded HOT 3
- PDF/A-3 with TCPDF (parameter not transmit)
- How wrap long title HOT 3
- FPDI - Getting "CrossReferenceException::OBJECT_NOT_FOUND" while trying to ImportPage from existing PDF file
- Indirect references in link annotation dictionaries creates corrupted PDFs (when FPDI is used with FPDF)
- Unable to find PDF file header. HOT 2
- while I setSourceFile ,then importPage, the seal missed HOT 1
- Problem with Y Coordinate on different page size HOT 2
- Undefined property: setasign\Fpdi\Tcpdf\Fpdi::$PDFVersion HOT 8
- Set Meta Data HOT 3
- Getting error while adding custom font. HOT 1
- (Question) Replace an Image inside a PDF HOT 1
- Snyk ReDoS vulnerability HOT 1
- WriteHTML() not possible anymore HOT 2
- Don't work without composer autoload HOT 5
- doesn't support cryllic alphabet HOT 3
- Parser have issue here HOT 2
- Undefined TCPDF constant caused by opcache preloading HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fpdi.