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)
- Trying to access array offset on value of type null HOT 2
- Multiple pages HOT 1
- PHP 8.1 - Deprecated error in setasign\Fpdi\Tcpdf\Fpdi HOT 5
- Add text with custom font decode with makefont doesn't works HOT 4
- Czech diacritics in Write method HOT 1
- Texts on the end of page (y > -25) && (y < 0) overflow on to the next page HOT 2
- Is it possible to perform incremental updates with this library? HOT 2
- Cant open generated file in chrome android and ios devices HOT 2
- gzuncompress function returns Data Error HOT 5
- External links are not preserved HOT 11
- This PDF document is encrypted and cannot be processed with FPDI HOT 4
- setSourceFile from stream - Error "Object (id:24) not found at location (93829)" HOT 1
- Smart function to add long text (more than one row) HOT 2
- Class "FPDF" not found in FpdfTpl.php HOT 2
- Class FpdfTpl not found in Fpdi:22 HOT 6
- 合并后印章没有了 HOT 1
- Line in the header after merging PDFs HOT 3
- Undefined array key "rect" Error in FpdiTrait.php HOT 4
- Fix Release-Action
- Pages are overwritten after merging PDFs with more than 50 pages HOT 6
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.