Project

General

Profile

Actions

Bug #856

closed

dcm2pdf sometimes creates corrupted pdf

Added by Marco Eichelberg almost 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Application
Target version:
-
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).


Related issues 1 (0 open1 closed)

Related to DCMTK - Conformance #877: Add support for CP-1851 (Add length of encapsulated document when not even) to encapsulate document tools/classesClosedPedro Fernando Arizpe Gómez2019-04-05

Actions
Actions #1

Updated by Marco Eichelberg over 6 years ago

  • Status changed from New to Closed
  • Assignee set to Marco Eichelberg
  • % Done changed from 0 to 100

Closed by commit #52cf5b48c.

Actions #2

Updated by Jörg Riesmeier over 6 years ago

  • Related to Conformance #877: Add support for CP-1851 (Add length of encapsulated document when not even) to encapsulate document tools/classes added
Actions #3

Updated by Michael Onken over 5 years ago

  • Target version deleted (3.6.6)
Actions

Also available in: Atom PDF