Monday, April 27, 2015

ImageMagick integration with liferay to generate better for document(pdf,docs etc)


As i have mentioned in my previous blog about document files preview(pdf,doc etc),When we are uploading any document(image,pdf) to document
and media portlet then by default liferay using PDFBox to generate preview for image, pdf. But when we are uploading large pdf files
then liferay is not providing preview by default. For generating preview of large files we need to integrate  imageMagick with liferay as
a external service and have to enable the service in liferay application.

Below integrating imageMagick in liferay :




In above screen i have uploaded two pdf files, 1>small size , preview generated properly 2>large size, preview not genrated, we can't see content of pdf.


 If we not configure imageMagick with liferay and try to view
large pdf files it will show below error message.

"Liferay is not configured to use ImageMagick for generating Document Library previews and will default to PDFBox. For better quality previews,
install ImageMagick and enable"


ImageMagic Installation :

Step 1 : Download imageMagick from http://www.imagemagick.org/script/binary-releases.php#windows  and install in your system.

Step 2 : After installing imageMagic in system , now we need to enable this feature in liferay.
Login with admin credential.
Below screenshot showing how to enable.







In above screenshot i have given path of imageMagick C:\Program Files\ImageMagick-6.9.1-Q16 where i have installed in my system, in my case i have installed in C drive and checked enable option and save.

Step 3 : After completing this step we need to install ghostscript and have to configure with liferay, without this imageMagic feature will not work.
Download ghostscipt from http://ghostscript.com/download/gsdnld.html and install in your system.

After completing installation go to the same location in liferay portal where we have configure imageMagick , and in path field we need to configure ghostscript also.

In path field before imageMagick installed path  C:\Program Files\ImageMagick-6.9.1-Q16  give
 "  ; "  and set ghostScript path also. like below is the complete path.

C:\Program Files\gs\gs9.16\bin ;C:\Program Files\ImageMagick-6.9.1-Q16

Step 4 : After completing these steps restart server ,After server restarted now we can test this feature.

For testing this feature we can upload large size pdf and try to read/view generated preview.

Note: Preview generation time will depends on file size, so please keep patience after uploading file.
In my case for some files it has taken more than 10 mins to generate preview.








1 comment:

  1. Using these software is easy as you will only have to upload or select the PDF file from which the images have to be extracted and the software will get the job done. The images can be extracted to a variety of image formats like JPG, GIF, PNG, etc and will be of decent quality. Adobe CS6 Production Premium

    ReplyDelete