PDF enhancements

PDF enhancements

Adobe ColdFusion (2016 release) release provides new actions for cfpdf tag, such as sanitization, import and export of metadata. Read on for a quick introduction to the new cfpdf actions in Adobe ColdFusion (2016 release).

Sanitize

Overview

The Sanitize action removes metadata from your PDF document so that sensitive information is not inadvertently passed along when you publish your PDF.

Sanitize removes the following:

  • Metadata
  • Attached files
  • Scripts
  • Search indexes
  • Form data
  • Review and comment data
  • Obscured text and images
  • Unreferenced data
  • Links
  • Actions and javascripts
  • Overlapping objects

Usage scenario

Sanitize a report before publishing to a general audience.

When dealing with classified information, sanitization reduces a document’s classification level, possibly yielding an unclassified document.

Syntax

<cfpdf
required
action="sanitize"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”/>

Attributes

Attribute name

Req/optional

Description

 

action

Req

Action to take: sanitize

 

source

Req

absolute or relative

pathname to a PDF file| PDF document variable or

cfdocument variable

 

destination/name

Req

destination = "PDF output file pathname".

name = “PDF document variable name”.

If the destination file exists, set the overwrite attribute to true. If the destination file does not exist, ColdFusion creates the file, if the parent directory exists.

Code samples

<cfpdf action="sanitize" source="C:\dev\font1.pdf" name="Myvar" overwrite="true"/>

Exporting and importing comments

Overview

You can export comments from a PDF document to an XFDF file. You can also import comments from an XFDF file in the specified PDF document.

For exporting comments, you can specify the source and the destination of the XFDF file. For importing comments, you can specify the source of the PDF file, the source of the XFDF file, and the destination path.

Syntax

Export Comments

<cfpdf
required
action="export"
type="comment"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
exportTo = "destination of xfdf file">

Import Comments

<cfpdf
required
action="import"
type="comment"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
importFrom = "source of xfdf file"
Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>

Attributes

Attribute name

Action

Req/optional

Description

 

action

N/A

Req

Action to take:

export

import

 

Type

comment

 

Req

To specify if it is for importing or exporting comment

source

export

import

 

Req

absolute or relative

pathname to a PDF file

destination/name

Import

Req

destination = "PDF output file pathname".

name = “PDF document variable name”.

If the destination file exists, set the overwrite attribute to yes. If the destination file does not exist, ColdFusion creates the file, if the parent directory exists.

exportTo

comment

 

Req

source of xfdf file for comment

importFrom

comment

Req

source of xfdf file for comment

Code samples

<!--- Export comment --->
<cfpdf action="export" type="comment" source="c:\source.pdf" exportto="c:\destination.xfdf">
</cfpdf>

		
	





<!--- Import comment --->
<cfpdf action="import" type="comment" source="c:\source.pdf" importfrom="c:\import.xfdf" destination="c:\destination.pdf">
</cfpdf>
Note:

A sample xfdf file (cf_comment3_exported.xfdf) is attached to this pdf for your reference. You can click the attachment icon on the left pane in pdf and save the file.

Exporting and importing metadata

Overview

PDF documents created in Acrobat 5.0 or later contain document metadata in XML format. Metadata includes information about the document and its contents, such as the author’s name, keywords, and copyright information, that can be used by search utilities.

For exporting metadata, specify the source of the PDF and destination of the XMP file. For importing metadata, specify the source of the PDF, the source of XMP file and the destination for the file to be placed.

The Extensible Metadata Platform (XMP) provides Adobe applications with a common XML framework that standardizes the creation, processing, and interchange of document metadata across publishing workflows. You can save and import the document metadata XML source code in XMP format, making it easier to share metadata across different documents.

Note:

Virtual file system is not supported for import and export actions.

Syntax

Export Metadata:

<cfpdf
required
action="export"
type="metadata"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
exportTo = "destination of xmp file"/>

Import Metadata

<cfpdf
required
action="import"
type="metadata"
source = "absolute or relative pathname to a PDF file|PDF document variable|cfdocument variable"
importFrom = "source of xmp file"
Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”/>

Attributes

Attribute name

Action

Req/optional

Description

 

action

N/A

Req

Action to take:

export

import

 

Type

metadata

Req

To specify if it is for importing or exporting metadata

source

export

import

Req

absolute or relative

pathname to a PDF file

destination/name

import

Req

destination = "PDF output file pathname".

name = “PDF document variable name”.

If the destination file exists, set the overwrite attribute to yes. If the destination file does not exist, ColdFusion creates the file, if the parent directory exists.

exportTo

metadata

Req

source of xmp file for metadata.

importFrom

metadata

Req

source of xmp file for metadata.

Code samples

<!--- Export metadata --->
<cfpdf action="export" type="metadata" source="c:\source.pdf" exportto="c:\destination.xmp"></cfpdf>
<!--- Import metadata --->
<cfpdf action="import" type="metadata" source="c:\source.pdf" importfrom="c:\import.xmp" destination="c:\destination.pdf"> </cfpdf>
Note:

A sample xmp file (cf_metadata3_exported.xmp) is attached.

Download

PDF archiving

Overview

You can archive pdf files. PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for the long-term digital preservation of electronic documents.

During PDF conversion, the file that is being processed is checked against the specified standard. PDF/A differs from PDF by prohibiting features ill-suited to long-term archiving, such as font linking (as opposed to font embedding).

In previous versions of ColdFusion, there was support for PDF/A-1b standard. In Adobe ColdFusion (2016 release), there is extra support for PDF/A-2b standard.

Syntax

<cfpdf
required
action="archive"
source="#sourcefilename#"
Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>
optional
standard = "2b"/>

Attributes

Attribute name

Req/optional

Description

 

action

Req

Action to take:

archive

source

Req

absolute or relative

pathname to a PDF file| PDF document variable or

cfdocument variable

destination/name

Req

destination = "PDF output file pathname".

name = “PDF document variable name”.

If the destination file exists, set the overwrite attribute to yes. If the destination file does not exist, ColdFusion creates the file, if the parent directory exists.

standard

Optional

Specify the standard that you want to apply. The
 
values are “1b”, “2b” or “3b”. The default value is “1b”.
 

Code samples

<cfpdf action="archive" source="C:\Hello World.pdf" name="Myvar" overwrite="true" standard="2b"/>

Attaching files to a pdf

Overview

You can attach PDFs and other types of files to a PDF. If you move the PDF to a new location, the attachments move with it. By using cfpdfparam, you can specify the location of the attachment, the filename for the attachment, description of the attachment, encoding, and mimetype for attaching file. Files can be attached at document level.

Syntax

required
action="addAttachments"
source = "absolute or relative pathname to a PDF file|PDF document
variable|cfdocument variable|directory path"
Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”
<cfpdfparam
required
source= "path of attachment"
filename = "filename for the attachment"
encoding = "encoding for filename" />
optional
description = "descriptive text"
mimetype = "application/pdf, text/html">
/>

Note:
 
  • Use at least one cfpdfparam.
  • Virtual file system is not supported for addAttachments action.

Attributes

ttribute name

Req/optional

Description

 

action

Req

Action to take:

addAttachments

 

source

 

 

Req

absolute or relative

pathname to a PDF file| PDF document variable or

cfdocument variable

filename

Req

filename for the attachment

 

mimetype

Optional

Some of the sample mimetype attribute values are:  text/html, application/pdf.

 

encoding

Req

type of encoding for filename

description

Optional

Description for the attachment

destination/name

Req

destination = "PDF output file pathname".

name = “PDF document variable name”.

If the destination file exists, set the overwrite attribute to yes . If the destination file does not exist, ColdFusion creates the file, if the parent directory exists.

Code samples

<cfpdf action="addAttachments" source="C:\cf_file3.pdf" name="Myvar">
<cfpdfparam  source="C:\file1.txt" filename="file1.txt" description="descriptive text"  encoding="UTF-8" />
<cfpdfparam  source="C:\file2.txt" filename="file2.txt" description="descriptive text"   encoding="UTF-8"/>
</cfpdf>

Adding stamp

Overview

You apply a stamp to a PDF in the same way you apply a rubber stamp to a paper document. You can choose from a list of predefined stamps.

You can specify the page and the location to add the stamp in addition to the content and icon.

Syntax

required
action="addStamp"
source = "absolute or relative pathname to a PDF file|PDF document
variable|cfdocument variable"
Use any one of the following attributes:
destination = "PDF output file pathname"
name = “PDF document variable name”>

pages = "page number|page range|comma-separated page numbers"

<!--- It is recommended that that ratio of the stamp width:height is 10:3--->

coordinate = "x1,y1,x2,y2"

note = "content of stamp" />
/>

Attributes

Attribute name

Req/optional

Description

 

action

Req

Action to take:

addStamp

 

source

 

 

Req

absolute or relative

pathname to a PDF file| PDF document variable or

cfdocument variable

 

destination/name

Req

destination = "PDF output file pathname".

name = “PDF document variable name”.

If the destination file exists, set the overwrite attribute to yes . If the destination file does not exist, ColdFusion creates the file, if the parent directory exists.

iconname

optional(default is draft)

Mention the name of the icon. For a detailed list of supported icon names, refer to the list below.

note

optional

A brief description of the content associated with icon.

pages

Req

Specify the page number to add stamp.

coordinates

Req

Add the position of co-ordinates

in the pages to add stamp

Code samples

<cfpdf action="addStamp" source="#sourcefile#" destination="#destinationfile#" >
<cfpdfparam pages="2" coordinate = "397,532,519,564" iconname="Approved" note="stamp1"/> </cfpdf>

List of icons

  • Approved
  • Experimental
  • NotApproved
  • AsIs
  • Expired
  • NotForPublicRelease
  • Confidential
  • Final
  • Sold
  • Departmental
  • ForComment
  • TopSecret
  • Draft
  • ForPublicRelease

Redaction

Overview

You can redact an image or text in a PDF document.

Syntax

<cfpdf action="redact" source="source PDF document" destination="destination PDF document" overwrite="true | false">

<cfpdfparam pages="from page-to page" coordinates="llx,lly,urx,ury">

</cfpdf>

Attributes

Attributes for cfpdf when action=”redact”

Attribute name

Req/Opt

Description

action

Req

Action to take- redact

source

Req

Source PDF document

destination

Req

Destination PDF document

overwrite

Req

If the destination file exists, set the overwrite attribute to True. If the destination file does not exist, ColdFusion creates the file, if the parent directory exists.

Attribute for cfpdfparam when action=”redact” in cfpdf

pages

Req

Specify the pages on which redaction is to be applied.

coordinates

Opt

Add the position of the coordinates in the pages where you want to redact a word or an image.
llx - the lower left x-coordinate value.

lly - the lower left y-coordinate value.

urx - the upper right x-coordinate value.

ury - the upper right y-coordinate value.

If you want to redact an image, you need the coordinates parameter to pass the location of the image.

Code sample

<cfpdf action="redact" source="#sourcefile#" destination="#destinationfile#" overwrite="true">
<cfpdfparam pages="1-2" coordinates="0,0,100,100">
</cfpdf>

 Adobe

Get help faster and easier

New user?