Copy link to clipboard
Copied
In our Application we have functionality to view / download PDF files Below is the code used for download and display in browser
> while ((readLength = bufInputStream.read(buf)) != -1) { outStream.write(buf, 0, readLength); } }
recently we observed like getting popup like "There was an error opening this document. The file is damaged and could not be repaired."
when we checked the contents of good and bad pdf
When we checked with Original PDF , which was streamed have proper header(without NUL)
We printed byte stream data and its coming as
First 500 bytes of PDF stream = [0, 0, 0, 0, 0, 0, 0, 0, 37, 80, 68, 70, 45, 49, 46, 51, 10, 37, -30, -29
Copy link to clipboard
Copied
Not really about Reader. The PDF specification says %PDF must be st the first byte but some software accepts some extra bytes. You can choose to do the same.
%%EOF is required at the end. Nothing should be adding it to a stream. Sounds like your bad PDF is just bad
Copy link to clipboard
Copied
Just want to know from experts on below items
Copy link to clipboard
Copied
metadata of the file has been changed from host and when download via application, what is possibility in change of metadata?
1.From Host file <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.1.1">
2.From App downloaded same file <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.2-c001 63.143651, 2012/04/05-09:01:49 ">
3.xap tag change to xmp when downloaded as below
file at host
<xap:ModifyDate>2018-05-21T08:35:15-04:00</xap:ModifyDate>
App downloaded same file
<xmp:ModifyDate>2018-05-09T22:15:42-04:00</xmp:ModifyDate>
Copy link to clipboard
Copied
I don't know what app or service you are talking about, so it's hard to say where you should find the experts. Clearly this is the wrong forum.