[reportlab-users] Large images in PDF cause viewing error

Brenner, Aaron L abrenner at pitt.edu
Thu Jul 29 08:38:45 EDT 2010



> -----Original Message-----

> From: reportlab-users-bounces at lists2.reportlab.com [mailto:reportlab-

> users-bounces at lists2.reportlab.com] On Behalf Of Robin Becker

> Sent: Thursday, July 29, 2010 5:23 AM

> To: reportlab-users

> Subject: Re: [reportlab-users] Large images in PDF cause viewing error

>

> On 28/07/2010 19:25, Brenner, Aaron L wrote:

> > Hi all,

> >

> > I'm creating PDFs from jpegs using Reportlab Toolkit. The PDF documents

> are created by first down-sampling large TIFF files to 200ppi jpegs (using

> ImageMagick), and then using Reportlab to assemble them into PDF, adding a

> visible text annotation above each image. The size of each canvas object

> varies depending on the size of the source image, plus the space required

> for the text annotation.

> >

> > These PDFs all open fine when viewing with the Acrobat Reader

> application (9.3.2), but some of the PDFs return an error message and a

> blank first page when viewed through a web browser using the Acrobat PDF

> Plug-In. The errors all seem to occur when the first page image is rather

> large, e.g. over 50" in one dimension (that's calculated at 72 or 96ppi?).

> Errors are consistent with different browsers (presumably using the same

> plug-in, however).

> >

> > I've tried to investigate this problem online and am having trouble

> getting information. I suspect that the plug-in is trying to display the

> first page before it has completed loading. Is there a configuration

> option, or options, available when creating the PDF in Reportlab, that

> could address this behavior? I notice, for example, when viewing document

> properties in Acrobat that "Fast Web View" is not enabled. Adobe seems

> to recommend using Fast Web View for PDFs larger than 4MB

> [http://help.adobe.com/en_US/Acrobat/9.0/Standard/WS58a04a822e3e50102bd615

> 109794195ff-7f52.w.html] Is there a method to enable this in the

> reportlab toolkit?

> >

> > Any other thoughts or suggestions are appreciated.

> >

> > Example file that causes plug-in error (12.55MB) is here:

> > http://digital.library.pitt.edu/u/ulsmanuscripts/pdf/31735051654782.pdf

>

> Aaron, I've just tried using that URL in firefox, chrome & Win XP IE 8 and

> although the download is clearly taking a long time I am seeing the images

> (they

> appear to be plans of a building (Church?)).

>

> My colleague tried this in windows 7 IE 8 and got a message saying there's

> an

> error with that page, but the pictures did show up.

>

> Another colleague was able to download and display in evince, but he

> wasn't

> using a plugin.

>

> It is possible that the large download is timing out for some folks and

> the

> plugin is unable to reach completion of even the first page before the

> connection disappears.


Thanks for the reply, Robin, and thanks for having some folks test the file. The experience of your colleague who had the error message, but was then able to view the page, is consistent with what we've seen here. Sometimes when the first page initially appears blank, paging back and forth in the Acrobat plug-in display brings the image back up OK.

I'm a bit uncomfortable publishing content that might return error messages even if it eventually displays -- so, given that the problem seems to correlate with large page sizes, I suppose I can address it by further down-scaling images that are above a certain size threshold.

That said, I'm still curious about the "Fast Web View" setting and would like to try it. It seems to be designed to better handle this particular scenario. I assume it's just a flag to set somewhere within the PDF encoding? I'll try manually creating the same PDF in Acrobat, where I think I can apply that setting, and I'll see if it does anything to address the behavior.

-Aaron


More information about the reportlab-users mailing list