Actions
Bug #856
closeddcm2pdf sometimes creates corrupted pdf
Start date:
2018-11-19
Due date:
% Done:
100%
Estimated time:
Module:
dcmdata
Operating System:
Compiler:
Description
Dcm2pdf sometimes incorrectly removes the last byte of the pdf.
See dcm2pdf.cc line 315 and further:
315 /* strip pad byte at end of file, if there is one. The PDF format expects 316 * files to end with %%EOF followed by CR/LF. If the last character of the 317 * file is not a CR or LF, we assume it is a pad byte and remove it. 318 */ 319 if (pdfDocument[len-1] != 10 && pdfDocument[len-1] != 13) 320 { 321 --len; 322 }
Some pdf files do not end with a CR/LF character after the %%EOF marker.
When this is the case and there also is no pad byte, the code removes the 'F' character (from the %%EOF marker).
This topic is also addressed by DICOM CP 1851 (January 2019 voting packet).
Actions