Opened 2 months ago

Closed 2 months ago

Last modified 2 months 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 2 months ago.
Proposed patch

Download all attachments as: .zip

Change History (4)

Changed 2 months ago by bugbuster

Attachment: pdfcreatecopy.cpp.patch added

Proposed patch

comment:1 Changed 2 months ago by Even Rouault

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 Changed 2 months ago by Even Rouault

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 Changed 2 months ago by Even Rouault

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