public class CmsPdfThumbnailGenerator extends java.lang.Object
Constructor and Description |
---|
CmsPdfThumbnailGenerator() |
Modifier and Type | Method and Description |
---|---|
byte[] |
generateThumbnail(java.io.InputStream pdfInputStream,
int boxWidth,
int boxHeight,
java.lang.String imageFormat,
int pageIndex)
Generates the image data for a thumbnail from a PDF.
|
public CmsPdfThumbnailGenerator()
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 databoxWidth
- the width of the box in which the thumbnail should fitboxHeight
- the height of the box in which the thumbnail should fitimageFormat
- 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