Image Magick is free software delivered as a ready-to-run as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license.
- To convert any Pdf’s specific pages into the jpeg images.
- Apply shadow to all converted images.
- Rotate each image according to the given angle.
- Merge all the images.
- Create the Sitecore media library Item of that newly created Image.
- Save the image value in the Image filed of the operational item.
Implementations and Challenges:
To achieve the above requirement we have divided those in the following tasks.
- To convert any Pdf’s specific pages into the jpeg images:
- Browse and Save Pdf: Browse the Pdf from the Sitecore media Library and save it .
- Click Image Magick link: We have created a custom link using core database to link the Image Magick application with Sitecore. In addition, we have created a custom Field type i.e. “Extended Image” (which we have used here for Download Image field).
- Count Pdf’s pages: On click of Image Magick link, it will count the total no. of pages of the saved pdf and a dialogue box will appear in which three text field will get enable according to count of pages. (e.g. if pdf has total 2 pages then only Center and Right Image Number text box will get enable.)
- Provide page no.: We need to provide the specific page no. which we want to convert them into images.
- Click Preview Image: On clicking preview image, it will convert the given pages no. into the images.
- Apply shadow to all converted images: After converting pdf pages into Images, we are applying the shadow to each image created.
- Rotate each image according to the given angle: We are rotating each image according to the angle predefined in the code.
- Merge all the images: After rotating each image, we are merging all the images and creating as one image and previewing it.
In the above case, the images is having transparency so the text is getting overlap. So we will check the “Apply Background” checkbox.
After checking the checkbox, click Preview Image the above image will get converted as shown below.
- Create the Sitecore media library Item: On clicking “Generate and Apply” it will create the Sitecore media library Item of that newly created Image.
- Save the image: Close the Dialogue box and save it.