public class CmsPdfThumbnailGenerator extends java.lang.Object
|Constructor and Description|
|Modifier and Type||Method and Description|
Generates the image data for a thumbnail from a PDF.
public byte generateThumbnail(java.io.InputStream pdfInputStream, int boxWidth, int boxHeight, java.lang.String imageFormat, int pageIndex) throws java.lang.Exception
The given width and height determine the box in which the thumbnail should fit. The resulting image will always have these dimensions, even if the aspect ratio of the actual PDF page is different from the ratio of the given width and height. In this case, the size of the rendered page will be reduced, and the rest of the image will be filled with blank space.
If one of width or height is negative, then that dimension is chosen so the resulting aspect ratio is the aspect ratio of the PDF page.
pdfInputStream- the input stream for reading the PDF data
boxWidth- the width of the box in which the thumbnail should fit
boxHeight- the height of the box in which the thumbnail should fit
imageFormat- the image format (png, jpg, gif)
pageIndex- the index of the page for which to render the thumbnail (starting at 0)
java.lang.Exception- if something goes wrong