In ColdFusion (2018 release), script functions implemented as CFCs are deprecated in ColdFusion.
Provides services to manipulate existing PDF documents in CFScript.
Mode |
Syntax |
|---|---|
Creating the service |
new pdf()}}or {{createObject("component", "pdf") |
Initializing the attributes |
Any one of the following:
|
Executing the service action |
pdfService.action_method(attribute-value pair) |
addQuads |
algo |
align |
ascending |
bottomMargin |
compressTiffs |
copyFrom |
ddxfile |
destination |
directory |
encodeAll |
encrypt |
flatten |
foreground |
format |
height |
hires |
honourSpaces |
hScale |
image |
imagePrefix |
info |
inputFiles |
isBase64 |
jpgDpi |
keepBookmark |
leftMargin |
maxBreadth |
maxLength |
maxScale |
name |
newOwnerPassword |
newUserPassword |
noAttachments |
noBookmarks |
noComments |
noJavascripts |
noLinks |
noMetadata |
noThumbnails |
numberFormat |
opacity |
order |
outputFiles |
overridePage |
overwrite |
package |
pages |
password |
permissions |
position |
resolution |
rightMargin |
rotation |
saveOption |
scale |
showOnPrint |
source |
stopOnError |
text |
topMargin |
transparent |
type |
useStructure |
version |
vscale |
width |
|
All attributes supported by the tag cfpdf can be used as attribute-value pairs. For example,
<cfpdf action="getInfo" source="myBook.pdf" name="PDFInfo"> |
can be used as
pdfInfo = pdfService.getPdfInfo(source="myBook.pdf", name="pdfinfo"); |
For details, see the Attributes section for the cfpdf tag__.
addParam
Description |
Used in CFScript to add cfpdfparam tags. Applicable only to action="merge". |
Returns |
Nothing |
Syntax |
pdfService.addParam(attribute-value pair) |
Arguments |
All attributes supported by the cfpdfparam tag can be used as attribute-value pairs. |
The following PDF actions are available as methods. All these methods have similar arguments and syntax.
addWatermark |
removeWatermark |
deletePages |
getPDFInfo |
setPDFInfo |
merge |
processDDX |
protect |
read |
write |
thumbnail |
transform |
optimize |
extractImage |
extractText |
addHeader |
addFooter |
removeHeaderFooter |
|
|
Note: In the list, setPDFInfo and getPDFInfo do not have identical actions in cfpdf. cfpdf action="setinfo" and cfpdf action="getinfo" represent them respectively. |
Description |
All methods correspond to the PDF actions specified for the tag cfpdf. For details of each method, refer to the corresponding section for cfpdf. |
Returns |
Depends on the action. If the name attribute is specified, the result of the pdf operation is returned. Else, an empty string. For example, the following code returns a structure containing the pdf information for "book.pdf": |
Syntax |
serviceName.methodName(attribute-value pair) |
Arguments |
All attributes supported by the cfpdf tag for a given action are supported. |
setAttributes
Description |
Sets attributes for the pdf function. |
Returns |
Nothing |
Syntax |
pdfService.setAttributes (attribute-value pair) |
Arguments |
All attributes supported by the cfpdf tag. |
getAttributes
Description |
Gets the attributes that were set for the pdf function. |
Returns |
Returns a struct with all or some of the attribute values. |
Syntax |
pdfService.get_Attributes_ (attributelist) |
Arguments |
A comma-separated list of attributes. If no list is specified, all defined attributes are returned. |
clearAttributes
Description |
Removes all attributes added for the pdf function. |
Returns |
Nothing |
Syntax |
pdfService.clearAttributes(attribute_list) |
Arguments |
A comma-separated list of attributes that must be removed. |
clearParams
Description |
Removes params that were added using addParam method. |
Returns |
Nothing |
Syntax |
pdfService.clearParams() |
Arguments |
None |
clear
Description |
Removes all attributes and params added using the addParam method. |
Returns |
Nothing |
Syntax |
pdfService.clear() |
Arguments |
None |
ColdFusion 9: Added this function.
This function corresponds to the cfpdf tag. For usage details, refer to the Usage section for cfpdf.
<h3>PDF Thumbnail</h3> |
Sign in to your account