ColdFusion 9.0 Resources |
Generating thumbnail images from PDF pagesUse the thumbnail action to generate thumbnail images from PDF pages. If you specify only the source attribute with the thumbnail action, ColdFusion automatically creates a directory relative to the CFM page called thumbnails where it stores a generated JPEG image for each page in the document. The filenames are in the following format: PDFdocumentName_page_n.JPG For example, assume that the source file in the following example has 100 pages: <cfpdf action="thumbnail" source="myBook.pdf"> ColdFusion generates the following files and stores them in the thumbnails directory: myBook_page_1.jpg myBook_page_2.jpg myBook_page_3.jpg ... myBook_page_100.jpg If you specify a destination, ColdFusion does not create the thumbnails directory and stores the files in the specified directory instead. The following code generates a thumbnail image called myBook_page_1.jpg from the first page of myBook.pdf and stores it in a directory called images, which is relative to the CFM page: <cfpdf action="thumbnail" source="myBook.pdf" pages="1" destination="images"> You change the prefix for the thumbnail filename and the change image file format to PNG or TIFF by specifying the imagePrefix and format attributes. The following code generates a file called TOC_page_2.PNG from the second page of myBook.pdf: <cfpdf action="thumbnail" source="myBook.pdf" pages="2" imagePrefix="TOC" format="PNG" destination="images"> The following code generates thumbnails from a range of pages and changes the image background to transparent (the default is opaque): <cfpdf action="thumbnail" source="myBook.pdf" pages="1-10,15,8-16,59" transparent="yes" destination="\myBook\subset" imagePrefix="abridged"> For an example of how to generate thumbnail images and link them to pages in the source PDF document, see the cfpdf tag in the CFML Reference. ColdFusion 9 release has introduced some new attributes for the thumbnail action:
|