Problems with image to PDF conversion
Posted: 2011-06-05T08:32:25-07:00
Hi everybody,
I am using ImageMagic in PHP to convert image files (JPG, GIF, PNG) to PDF. At first I thought this was no problem and I was able to set everything up easily.
PROBLEM:
Some images (some resolutions, some dimensions) convert to PDF but then display an empty or a misplaced image in the resulting PDF. Most images will convert correctly though...
TASKS:
- rotate image by -90 degrees
- center image on page
- force image into A4 format and size
CODE:
I am using the following command to perform the tasks:
QUESTIONS:
1.) What could possibly the problem why *some* images just won't convert correctly? Where is my mistake?
2.) Do I have to RESIZE or SCALE the images in any way to achieve what I want? Am I missing something?
Thank you very much in advance for any ideas!
Chris
I am using ImageMagic in PHP to convert image files (JPG, GIF, PNG) to PDF. At first I thought this was no problem and I was able to set everything up easily.
PROBLEM:
Some images (some resolutions, some dimensions) convert to PDF but then display an empty or a misplaced image in the resulting PDF. Most images will convert correctly though...
TASKS:
- rotate image by -90 degrees
- center image on page
- force image into A4 format and size
CODE:
I am using the following command to perform the tasks:
Code: Select all
convert -rotate -90 -gravity center -page A4+0+0 source.jpg target.pdf 2>&1
1.) What could possibly the problem why *some* images just won't convert correctly? Where is my mistake?
2.) Do I have to RESIZE or SCALE the images in any way to achieve what I want? Am I missing something?
Thank you very much in advance for any ideas!
Chris