Adobe COLDFUSION 9 Manual page 942

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
<cfpdf action = "removeheaderfooter" source="..\mybook.pdf" destination = "new.pdf">
Use this action to remove the header and footer from a PDF document or from specified pages in a document.
Extracting images and text
You can extract text and images from a PDF document using the
The
action extracts all words from the specified page numbers in the PDF document, as shown in the
extracttext
following code snippet:
<cfpdf action = "extracttext" source = "../myBook.pdf" pages = "5-20, 29, 80" destination
="../adobe/textdoc.txt"
The
action extracts all images from the specified page number in a PDF document, as shown in the
extractimage
following code snippet:
<cfpdf action = "extractimage" source = "../myBook.pdf" pages = "1-200" destination =
"..\mybookimages" imageprefix = "mybook">
The images are extracted and saved in the directory that you specify in the destination attribute. You can specify a
prefix for the images (imageprefix) being extracted, otherwise the system prefixes the image name similar to "cf+page
number". To save the images in a specific format, use the format attribute.
Performing page level transformations
You can scale a page, specify the position, and rotation values for pages in a PDF document using the
action. This action has four attributes that define the size (hscale, vscale), position(position), and rotation (rotation)
of a page. The following code snippet shows the usage. The value for rotation needs to be in steps (0, 90, 180, 270). If
you specify any other value, the system generates an error.
<cfpdf action = "transform"
source = "..\myBook.pdf"
destination = "..\new\myBook.pdf">
hscale = ".5"
vscale = ".15"
position = "8, 10"
rotation = "180">
Deleting pages from a PDF document
Use the
action to remove pages from a PDF document and write the result to a file. You can specify a
deletepages
single page, a page range (for example, "81–97"), or a comma-separated list of pages to delete, as the following example
shows:
<cfpdf action="deletePages" source="myBook.pdf" pages="10-15,21,89"
destination="abridged.pdf" overwrite="yes">
Protecting PDF files
Use the
action to password-protect, set permissions, and encrypt PDF documents for security.
protect
Setting passwords
ColdFusion supports two types of passwords: an owner password and a user password. An owner password controls
the ability to change the permissions on a document. When you specify an owner password, you set permissions to
restrict the operations users can perform, such as the ability to print a document, change its content, and extract
content. The following code creates an owner password for a document:
extracttext
Last updated 8/5/2010
and
actions.
extractimage
transform
937

Advertisement

Table of Contents
loading

Table of Contents