Dcm2pdf sometimes creates corrupted pdf.

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
hkl
Posts: 1
Joined: Mon, 2012-11-05, 09:46

Dcm2pdf sometimes creates corrupted pdf.

#1 Post by hkl »

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).

J. Riesmeier
DCMTK Developer
Posts: 2496
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Dcm2pdf sometimes creates corrupted pdf.

#2 Post by J. Riesmeier »

There is a new CP in the pipeline that will probably solve issues like this (in the future): ftp://medical.nema.org/medical/dicom/cp ... oteven.pdf

I will also forward your report to the author of "dcm2pdf".

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1435
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Dcm2pdf sometimes creates corrupted pdf.

#3 Post by Marco Eichelberg »

The bug has been fixed meanwhile in commit #52cf5b48c.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest