Using cfdocument



In addition to the existing functionality, the cfdocumenttag lets you read, write, and process Word documents and PowerPoint presentations. All versions of Microsoft office applications from 97 to 2003 are supported.

Working with documents using OpenOffice

OpenOffice is an open-source office software that supports word processing, spreadsheets, presentations, and more. OpenOffice stores data in an international open standard format. See http://www.openoffice.org/ for details.

ColdFusion 9 supports OpenOffice, which uses the cfdocument tag to convert a Word document (.doc format) to PDF.

When you use cfdocument to convert a document file, the tag first checks for an OpenOffice installation. When the OpenOffice installation is found, the tag processes the rich text conversion through the OpenOffice libraries.

The cfdocument attributes, userPassword and permissions are used to open the converted PDF documents. For complete information about the cfdocument attributes that support OpenOffice document conversion, see the CFML Reference.

To install OpenOffice, see http://download.openoffice.org/index.html . See the ColdFusion 9 Installation Guide for information about installing and configuring OpenOffice.

Example

The following example converts a document, MyDocument.doc, to a PDF file. The PDF conversion occurs only when you specify the format attribute as "pdf".

Note: When you convert, specify only the absolute path, for example, "c:\documents\MyDocument.doc"
<cfdocument 
    format="pdf" 
    srcfile="C:\documents\MyDocument.doc" 
    filename="C:\documents\MyDocument.pdf"> 
</cfdocument>
Note: If you do not specify the filename attribute, the converted PDF opens in a browser.

Working with PowerPoint presentation files

You use the cfdocument tag to convert a PowerPoint presentation (PPT file) to a PDF document.

Example

The following example converts a PowerPoint presentation to a PDF file.

<cfdocument 
    format="pdf" 
    srcfile="C:\presentations\MyPresentation.ppt" 
    filename="C:\presentations\MyPresentation.pdf"> 
</cfdocument>