Cannot convert certain PDF files IM 6.8.0.10 Q16

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by fmw42 »

IM 6.8.0.10 Q16 Mac OSX Snow Leopard

I am having errors when trying to convert certain PDF files. For example take the pdf from the link below

http://www.fmwconcepts.com/misc_tests/p ... s/test.pdf


convert test.pdf test2.pdf

convert: unable to load module `/usr/local/lib/ImageMagick-6.8.0//modules-Q16/coders/pdf.la': file not found @ error/module.c/OpenModule/1277.
convert: no decode delegate for this image format `test.pdf' @ error/constitute.c/ReadImage/550.
convert: no images defined `test2.pdf' @ error/convert.c/ConvertImageCommand/3078.



This comes from saving as PDF on my Mac or equivalently opening it in Adobe Reader and resaving as PDF. Neither work.

However, if I do

convert rose: rose.pdf
convert rose.pdf rose2.pdf

every thing works fine.

What is the error message implying that is missing or what am I doing wrong? How would I fix this or is it an issue of PDF incompatible formats?


P.S. Curious if the link to the pdf.la file is correct? It seems to have // with no subdirectory between them?

/usr/local/lib/ImageMagick-6.8.0//modules-Q16/coders/pdf.la

If I do

find /usr | grep "pdf.la"

It shows as located at (with no //):

/usr/local/lib/ImageMagick-6.8.0/modules-Q16/coders/pdf.la

Is this an error in IM pointing to a bad link?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by magick »

Perhaps there is a problem loading gslib. Try configuring with the --without-gslib configure script option then rebuild and reinstall. Does that fix the problem? If not, try deleting /usr/local/lib/ImageMagick-6.8.0 and reinstalling ImageMagick.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by fmw42 »

magick wrote:Perhaps there is a problem loading gslib. Try configuring with the --without-gslib configure script option then rebuild and reinstall. Does that fix the problem? If not, try deleting /usr/local/lib/ImageMagick-6.8.0 and reinstalling ImageMagick.

1) I am not sure why you had me disable Ghostscript. Do I not need GS to convert a pdf to some other format? When I compile --without-gslib, I get the following:

convert test.pdf test2.pdf

dyld: Library not loaded: /opt/local/lib/libpng15.15.dylib
Referenced from: /opt/local/lib/libgs.9.06.dylib
Reason: image not found
convert: `%s' (%d) "gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=/var/tmp/magick-59812RA6NZrt0TkJn" "-f/var/tmp/magick-59812t17JxLzO3sCY" "-f/var/tmp/magick-59812WHkxlQ9wmMCE" @ error/utility.c/SystemCommand/1890.
convert: Postscript delegate failed `test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/678.
convert: no images defined `test2.pdf' @ error/convert.c/ConvertImageCommand/3078.

Why the libpng error? By the way I am using libpng @1.4.11_0


2) Deleting /usr/local/lib/ImageMagick-6.8.0 and reinstalling ImageMagick, still gives the same error no matter what format I try to convert the pdf file to.

convert test.pdf test2.pdf

convert test.pdf test.jpg

convert: unable to load module `/usr/local/lib/ImageMagick-6.8.0//modules-Q16/coders/pdf.la': file not found @ error/module.c/OpenModule/1277.
convert: no decode delegate for this image format `test.pdf' @ error/constitute.c/ReadImage/550.
convert: no images defined `test2.pdf' @ error/convert.c/ConvertImageCommand/3078.

But see the // in the error message link. Is IM looking in the wrong place?

I do have the file in the correct place:

find /usr | grep "pdf.la"
/usr/local/lib/ImageMagick-6.8.0/modules-Q16/coders/pdf.la
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by magick »

The // is fine. Posix OS's ignore extra directory sentinels.

Another solution is to build a static release of ImageMagick with the --disable-shared configure script command line. Type
  • cd ImageMagick-6.8.1
    make uninstall
    ./configure --disable-shared
    make
    make install
Does it work now?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by fmw42 »

magick wrote:The // is fine. Posix OS's ignore extra directory sentinels.

Another solution is to build a static release of ImageMagick with the --disable-shared configure script command line. Type
  • cd ImageMagick-6.8.1
    make uninstall
    ./configure --disable-shared
    make
    make install
Does it work now?
Sorry I do not understand the rationale behind building a static release to solve this issue?

Nevertheless, I tried the following (note my delegates are from MacPorts):

cd Applications ImageMagick-6.8.1-0
make uninstall
./configure CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-delegate-build --disable-shared --disable-static --disable-opencl \
--with-modules --with-quantum-depth=16 --with-gslib --without-wmf \
--disable-silent-rules --disable-dependency-tracking --disable-openmp --without-pango \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts/ --with-lqr
make
sudo make install


The install did not have any errors, but when doing the following, I get:


convert -version

dyld: Library not loaded: /opt/local/lib/libpng15.15.dylib
Referenced from: /opt/local/lib/libgs.9.06.dylib
Reason: image not found
Trace/BPT trap




Similarly,

convert test.pdf test.jpg
dyld: Library not loaded: /opt/local/lib/libpng15.15.dylib
Referenced from: /opt/local/lib/libgs.9.06.dylib
Reason: image not found
Trace/BPT trap
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by magick »

This problem is related to your libgs installation rather than ImageMagick. ImageMagick links to libgs and when its references libgs it looks for libpng15.15.dylib and since the dependency cannot be satisfied, it exits. Building ImageMagick with the --without-gslib configure script option should fix the problem. Better yet, try re-installing the Ghostscript library and then reinstall ImageMagick.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by fmw42 »

What is libpng15.15.dylib? My only libpng versions are


libpng @1.4.8_0
libpng @1.4.9_0
libpng @1.4.11_0 (active)
libpng @1.5.13_0


I do not see any libpng15 or is that a reference to libpng @1.5.13_0?

I will try switching my libpng version to the newer one and recompile IM.

That fixed the problem.


Thanks for your help

Fred
Last edited by fmw42 on 2012-12-19T17:37:47-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Cannot convert certain PDF files IM 6.8.0.10 Q16

Post by magick »

Chances are, Ghostscript was compiled with libpng15 on some other machine and you downloaded it, perhaps from Mac Ports, and either libpng15 was deleted or it was not downloaded when Ghostscript was installed.
Post Reply