View error in patient reports

penguin8r wrote on Friday, July 20, 2007:

when attempting to run a patient report including their documents, I receive this error:

Document’patientxray062807.PDF’ cannot be converted to JPEG. Perhaps ImageMagick is not installed?

ImageMagick is indeed installed, and if I just go into the patient documents and view the file, it works fine there.

Is there a config option for OpenEMR where I need to give it the path to ImageMagick or something??

Any suggestions appreciated, thanks!!

sunsetsystems wrote on Friday, July 20, 2007:

You can find the offending line in interface/patient_file/report/custom_report.php which is something like:

      if (! is_file($to_file)) exec(“convert -density 200 ‘$from_file’ -append -resize 850 ‘$to_file’”);

Try running a similar convert command yourself at the command line to see what happens.

Rod
www.sunsetsystems.com

drbowen wrote on Saturday, July 21, 2007:

Dear Rod,

could you take a moment to explain what the command

if (! is_file($to_file)) exec(“convert -density 200 ‘$from_file’ -append -resize 850 ‘$to_file’”);

actually is doing?

I think this is taking the input pdf image and does "convert" to a jpeg with a "density" of "200" dots per inch. "append" to "$to_file" and resize to 850 pixels?

Sam Bowen, MD

sunsetsystems wrote on Saturday, July 21, 2007:

Yes, that’s about it.  You can see more info at http://www.imagemagick.org/script/convert.php .

The intent is to convert the PDF to a format that can be displayed "in-line" in the report, and not needing a special viewer like Acrobat.  "-density" and "-resize" are there to make the size and resolution reasonable for printing.  "-append" causes the pages to be stacked vertically into a single image, in the case of a multi-page PDF.

The "if (! is_file($to_file))" part makes sure this command (which can take a while) runs only if the output image has not already been created.

Rod
www.sunsetsystems.com

penguin8r wrote on Monday, July 23, 2007:

Thanks Rod, if I run the command manually, I get these error messages-

end -resize 850 test.jpg
CRIT: limitcheck in .putdeviceprops
convert: Postscript delegate failed ‘filename.PDF’

any ideas, or do I need to just start debugging the ImageMagick install on the OS.

(OS is Ubuntu 6.0.6 LTS, but I’ve had this error on SuSE as well).

Thank You!!

sunsetsystems wrote on Monday, July 23, 2007:

Googling for "Postscript delegate failed" suggests a problem with locating the "gs" binary.  So perhaps GhostScript is not installed or is not in the path.  Just a guess.  Otherwise you might try a similar search and see what else turns up.

Rod
www.sunsetsystems.com