Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7083 closed defect (fixed)

PDF pagesize limit : incorrect test

Reported by: bugbuster Owned by: warmerdam
Priority: normal Milestone: 2.2.3
Component: default Version: 2.2.1
Severity: normal Keywords: PDF
Cc:

Description

It seems to me the correction made by #5412 is not sufficient. In pdfcreatecopy.cpp, the default DPI is modified whenever the image width (resp. height) is larger than MAXIMUM_SIZE_UNIT (i.e. the max size supported by Acrobat). In such case, we take :

dfDPI =(int) (0.5 + nWidth / MAXIMUM_SIZE_UNIT /USER_UNIT_IN_INCH)

In the above formula, we should not take the closest integer, but the upper integer.

As an example, I have an 25808 X 15000 image which is converted to PDF. The PDF plugin adjusts the DPI to 129 (see DEBUG log) :

dfDPI = (int)(0.5 + 25808 / 14400 * 72)
      = (int)(0.5 + 129.04)
      = 129

I do have an error when opennig the image with Acrobat Reader.
I attached a proposed patch where I replaced 0.5 by 1.0.

Attachments (1)

pdfcreatecopy.cpp.patch (1017 bytes ) - added by bugbuster 7 years ago.
Proposed patch

Download all attachments as: .zip

Change History (4)

by bugbuster, 7 years ago

Attachment: pdfcreatecopy.cpp.patch added

Proposed patch

comment:1 by Even Rouault, 7 years ago

Resolution: fixed
Status: newclosed

In 40416:

PDF: round to upper integer when computing a DPI such that page size remains within limits accepted by Acrobat (derived from patch by bugbuster, fixes #7083)

comment:2 by Even Rouault, 7 years ago

In 40417:

PDF: round to upper integer when computing a DPI such that page size remains within limits accepted by Acrobat (derived from patch by bugbuster, fixes #7083)

comment:3 by Even Rouault, 7 years ago

Milestone: 2.2.3
Note: See TracTickets for help on using tickets.