pauln / tcpdi_parser

Parser for use with TCPDI, based on TCPDF_PARSER
GNU Lesser General Public License v3.0
27 stars 47 forks source link

TCPDI_PARSER ERROR [tcpdi-56a25ce24b2d6]: Unable to find startxref #11

Closed gismofx closed 8 years ago

gismofx commented 8 years ago

I'm attempting to merge/combine TWO pdf files. They are encoded/text PDF files so I'm using "setSourceData". Also, I'm using a modified example file

code here: http://paste.ofcode.org/vVb6tf83tcWj8mGBYRJxea

I'm getting this error: TCPDI_PARSER ERROR [tcpdi-56a25ce24b2d6]: Unable to find startxref

pauln commented 8 years ago

Hi @gismofx, Can you please isolate which of the two files is causing the error, and either attach a copy of the troublesome PDF to this issue or email it to me at tcpdi-samples at next.gen.nz? If both files cause the issue, feel free to attach/send both - more data points may help isolate the issue more easily.

pauln commented 8 years ago

Actually, looking more closely at your sample code, it may be a simple fix: your variable names suggest that you may be attempting to pass Base64-encoded data into setSourceData. If that's the case, try changing line 20 of your code to: $pageCount = $this->setSourceData(base64_decode($file)); as the setSourceData function is expecting the raw PDF content (not Base64-encoded).

gismofx commented 8 years ago

@pauln Thanks. Actually I fixed that issue with the solution you mentioned above. I needed to decode the PDFs. now I have a new issue with TCPDI: https://github.com/pauln/tcpdi/issues/3 and http://stackoverflow.com/questions/34953197/combining-pdfs-with-php-from-encoded-pdfs-error-template-does-not-exist

pauln commented 8 years ago

@gismofx Great - glad to hear you got past this issue; we can continue over on pauln/tcpdi#3.