Closed iopazo closed 3 years ago
Here is the code that gives you an error: https://github.com/vbuch/node-signpdf/blob/develop/src/helpers/removeTrailingNewLine.js#L18
I am on mobile and with only a text editpr available I see this: http://imgur.com/gallery/dapeKIz This looks like an unexpected symbol at the end of the document but i am not sure what it is and if it is valid in PDF1.7. Need to research that when I have access to a computer.
Yup. Now on a desktop I see it has a NUL byte at the end: https://imgur.com/gallery/0w9fNth Let me track what the spec has to say on that.
OK. So the first finding is a bug. The specs say in section 7.5.1 that lines may end with \r
, \n
or both. This needs to be fixed when removing the last character.
It also says "the last line shall contain only the EOF marker." in section 7.5.5. Considering that all lines end with \r
, \n
or both, I would say that the null byte at the end of this file makes it invalid, though the viewers tend to ignore it. I would not go for trimming the end of the file for this specific case. As per the spec, it is an invalid ending of the file.
So how should I solve this problem ? All my pdf's have that null byte in the end and I can't trim a buffer.
@PedroS11 If I was doing this for my PDFs I would go, get the last char and check it explicitly. If it is the one, I would feed the signer with a buffer that doesn't have it. This is: I would do it out of the library to keep the library closer to the specs.
I think there is not much to add here, unless this is really an issue with the lib which I think is not the case. Closing.
Dear Valery , Any luck with fixing the issue: The lines may end with \r, \n or both?
I have many pdfs ( generated from magento ) which have only \r before %%EOF. (There is no Null charecter after EOF) and node-signpdf produces the above error "Error: A PDF file must end with an EOF line."
Noone has fixed that, so... PRs welcome.
This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions.
I'm facing this error too. Something news about fix that?
Hi , i have the same issue and i would like to know if there is a fix . i Have a pdf file with %EOF but i always recieve the same error
I had some problems when reading the pdf file from the buffer, since once called the function .sign (), this throws the following error:
Imagine the problem was with one of my PDF files, but checking these if they have the final line.
Here is my integration:
comprobante_incorporacion.pdf
From already thank you very much!