Problem loading a PDF, annotating it and saving it to PDF

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
justinhendrickson

Problem loading a PDF, annotating it and saving it to PDF

Post by justinhendrickson »

I've been playing around with the ImageMagick PHP extension, Imagick, and I ran into a problem. I was trying to create an image by pull some PDFs in as images, add some text, then save the file to a new PDF. I don't get any problems creating the file, but when I tried to open the PDF with various programs, I got these results:

With Evince (Gnome document reader), it loads fine.
With acroread, I get "There was an error processing a page. There was a problem reading this document (14)."
With gs, I get "Error: /typecheck in --run--"

Eventually I was able to recreate the problem on the command line with a single command:

convert multipage.pdf -annotate 0x0+30+30 text out.pdf

The resulting PDF file exhibits the same problems I was having with Imagick. Interestingly, removing the -annotate portion results in a functioning PDF file. On a hunch, I removed my annotation calls in my PHP script and the PDF started working as well. Another interesting was that I'm able to convert the PDF, with annotation, to a PNM file, and then convert the PNM file to a PDF without a problem.

I've tried installing various versions of ImageMagick (6.2.4, 6.3.7-8, 6.3.7-9, 6.3.7-10, and svn) but all of them have the same problem.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem loading a PDF, annotating it and saving it to PDF

Post by magick »

Post a URL to your multipage.pdf file so we can download it and reproduce the problem. When we used our own multipage PDF file with your command, we got a valid out.pdf file.
justinhendrickson

Re: Problem loading a PDF, annotating it and saving it to PDF

Post by justinhendrickson »

magick wrote:Post a URL to your multipage.pdf file so we can download it and reproduce the problem. When we used our own multipage PDF file with your command, we got a valid out.pdf file.
I'm going to feel very dumb if it was just the PDF file I was testing. :(

http://djcricket.com/imagick-pdf-test/l ... ar2008.pdf

UPDATE: I tried http://www.irs.gov/pub/irs-pdf/fw2.pdf as well and got a broken PDF.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem loading a PDF, annotating it and saving it to PDF

Post by magick »

We tried your image with ImageMagick 6.3.8-0 Beta and it converted fine and produced valid PDF output. 6.3.8-0 Beta is scheduled for release within a week or two.
justinhendrickson

Re: Problem loading a PDF, annotating it and saving it to PDF

Post by justinhendrickson »

magick wrote:We tried your image with ImageMagick 6.3.8-0 Beta and it converted fine and produced valid PDF output. 6.3.8-0 Beta is scheduled for release within a week or two.
Is that version in your Subversion repository somewhere? I compiled revision 9100 from trunk this morning and it's what I've been doing all my tests against for the later half of this day.

Code: Select all

jhendric@jhendric-desktop:~/Desktop/ImageMagick$ svn info
Path: .
URL: https://www.imagemagick.org/subversion/ImageMagick/trunk
Repository Root: https://www.imagemagick.org/subversion
Repository UUID: aa41f4f7-0bf4-0310-aa73-e5a19afd5a74
Revision: 9100
Node Kind: directory
Schedule: normal
Last Changed Author: cristy
Last Changed Rev: 9098
Last Changed Date: 2008-01-17 20:08:37 -0600 (Thu, 17 Jan 2008)

Code: Select all

jhendric@jhendric-desktop:~/Desktop/ImageMagick$ convert -version
Version: ImageMagick 6.3.8 01/18/08 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
Is there something else that might be causing this problem on my system? Maybe some dependency that I may have overlooked? I know that the version of ImageMagick in Ubuntu's repositories is ancient (6.2.4 or something). GhostScript seems up to date, so I'm not sure could be out of date.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problem loading a PDF, annotating it and saving it to PDF

Post by magick »

The subversion trunk is ImageMagick 6.3.8-0 Beta. We're using Ghostscript 8.61. Not sure why you are having problems. We tried you PDF and command on 5 different OS's and could not reproduce the problem.
justinhendrickson

Re: Problem loading a PDF, annotating it and saving it to PDF

Post by justinhendrickson »

magick wrote:The subversion trunk is ImageMagick 6.3.8-0 Beta. We're using Ghostscript 8.61. Not sure why you are having problems. We tried you PDF and command on 5 different OS's and could not reproduce the problem.
I've confirmed that the problem occurs on two different Ubuntu 7.10 machines as well as a Debian machine (not sure what version it is though). I also confirmed that it works on a FreeBSD virtual machine, so it would seem to be something Debian-based.
Post Reply