170 likes | 382 Views
ColdFusion 8 and PDF Integration. O ğuz Demirkapı Sr. Developer | TeraTech http://www.teratech.com. About Me. Sr. Application Developer at TeraTech Coding since ‘85, CGI Programm i ng since ’94 ColdFusion Developer since ’97 Founder and Manager ( prev .) of CFUG for Turkey
E N D
ColdFusion 8 andPDFIntegration Oğuz Demirkapı Sr. Developer | TeraTech http://www.teratech.com
About Me • Sr. Application Developer at TeraTech • Coding since ‘85, CGI Programming since ’94 • ColdFusion Developer since ’97 • Founder and Manager (prev.) of CFUG for Turkey • Interestedin ColdFusion, Flex, Ajax, Frameworks, i18N, L10N, g13N • Have big interest in epistemology
Why PDF? “Invented by Adobe Systems and perfected over 15 years,Adobe Portable Document Format (PDF) lets you capture andview robust information—from any application, on any computer system—and share it with anyone around the world. Individuals, businesses, and government agencies everywhere trust and rely on Adobe® PDF to communicate their ideas and vision." http://www.adobe.com/products/acrobat/adobepdf.html
Creating PDF • CFDocument <cfdocument format="PDF" overwrite="yes"> This is my first PDF document. </cfdocument> • CFReport <cfreport template="myReport.cfr" format="PDF">
Working with PDF • Tags • cfdocument, cfdocumentsection, cfdocumentitem • cfpdf, cfpdfform, cfpdfformparam, cfpdfsubform • cfprint • Functions • IsPDFFile • IsPDFObject • IsDDX
Working with PDF <cfdocument format="PDF" overwrite="yes“ filename="#GetDirectoryFromPath(GetTemplatePath())#/02_cfdocument.pdf" > <cfdocumentsection name="First Section"> <cfdocumentitem type="header“><h1>TeraTech Training</h1></cfdocumentitem> <cfdocumentitem type="footer“> <cfoutput> Total Pages: #cfdocument.currentpagenumber# / #cfdocument.totalpagecount# <br /> Section Pages: #cfdocument.currentsectionpagenumber# / #cfdocument.totalsectionpagecount# </cfoutput> </cfdocumentitem> <cfloop index="loopid" from="1" to="10“><cfinclude template="tempcontent.cfm“></cfloop> </cfdocumentsection> <cfdocumentsection name="Second Section"> <cfinclude template="tempcontent.cfm"> </cfdocumentsection> </cfdocument>
Working with PDF • Possibilities • Getting info about PDF file • Merging PDF files • Deleting pages from PDF files • Adding/removing Watermark • Security Settings • Thumbnail Generation from PDF files • Server Side Printing
Working with PDF • Getting File Info <cfset myPDFDocument = "test.pdf"> <cfpdf action="getinfo" source="#myPDFDocument#" name="myResult"> <cfdump var="#myResult#" label="PDF Info">
Working with PDF • Merging PDF Files <cfpdf action="merge" directory="#ExpandPath('.')#/myPDFFiles" destination="myFilesFromDirectory.pdf” overwrite="yes"> <cfpdf action="merge" source="#ExpandPath('.')#/myPDFFiles/test.pdf, #ExpandPath('.')#/myPDFFiles/test2.pdf" destination="myMergedPDFFiles.pdf" overwrite="yes">
Working with PDF • Delete Page From PDF Files <cfpdf action="deletepages" source="test.pdf" pages="1-3" overwrite="true">
Working with PDF • Add/Remove Watermark <cfpdf action="addWatermark" copyFrom="TTTraining.pdf" source="test.pdf" rotation="15“ position="100,0" foreground="true" overwrite="yes" destination="myPDFWatermark.pdf"> <cfpdf action="removewatermark" source="myPDFWatermark.pdf" destination="myPDFNoWatermark.pdf" overwrite="yes">
Working with PDF • Security Settings <cfpdf action="protect" source="test.pdf" newUserPassword = "mypass" destination="mySecuredPDF.pdf" overwrite="true" > <cfpdf action="protect" source="test.pdf" newOwnerPassword="mypass" destination="mySecuredPDF2.pdf" overwrite="true" permissions="AllowAssembly, AllowFillIn, AllowModifyAnnotations, AllowModifyContents, AllowScreenReaders, AllowSecure">
Working with PDF • Creating Page Thumbnails <cfpdf action="thumbnail" format="png" resolution="high" overwrite="yes" source="test.pdf" destination="#ExpandPath('.')#/thumbs" transparent="no" scale="30">
Working with PDF • Server Side Printing <cfset aSet=StructNew()> <cfset aSet["paper"] = "letter"> <cfset aSet["sides"] = "duplex"> <cfset aSet["copies"] = "5"> <cfset aSet["printer"] = "\\myserver\myprinter"> <cfprint type="pdf" source="test.pdf" attributeStruct="#aSet#">
PDF Forms • Populating PDF form • Prefilling PDF forms • Form embedding • Data extraction from PDF form • Adobe Acrobat forms • XML Forms Data Format (XFDF) • Adobe LiveCycle Designer • XML Forms Architecture (XFA)
Resources • Adobe PDF Technology Center http://www.adobe.com/devnet/pdf/ • Livedocs http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=formsPDF_01.html • PDFUtils Custom Tag (Ray Camden) http://pdfutils.riaforge.org • MXNA (search as PDF) http://weblogs.macromedia.com/mxna/
Questions & Answers? oguz@teratech.com