User Guide Cancel

cfpdf

  1. CFML Reference User Guide
  2. ColdFusion functions
    1. ColdFusion functions by category
    2. Functions a-b
      1. Abs
      2. ACos
      3. AddSOAPRequestHeader
      4. AddSOAPResponseHeader
      5. AjaxLink
      6. AjaxOnLoad
      7. ApplicationStop
      8. ArrayAppend
      9. ArrayAvg
      10. ArrayClear
      11. ArrayContains
      12. ArrayContainsNoCase
      13. ArrayDelete
      14. ArrayDeleteAt
      15. ArrayDeleteNoCase
      16. ArrayEach
      17. ArrayFilter
      18. ArrayFind
      19. ArrayFindAll
      20. ArrayFindAllNoCase
      21. ArrayFindNoCase
      22. ArrayInsertAt
      23. ArrayIsDefined
      24. ArrayIsEmpty
      25. ArrayLen
      26. ArrayMap
      27. ArrayMax
      28. ArrayMin
      29. ArrayNew
      30. ArrayPrepend
      31. ArrayReduce
      32. ArrayResize
      33. ArraySet
      34. ArraySetMetadata
      35. ArraySlice
      36. ArraySort
      37. ArraySum
      38. ArraySwap
      39. ArrayToList
      40. Asc
      41. ASin
      42. Atn
      43. AuthenticatedContext
      44. AuthenticatedUser
      45. BinaryDecode
      46. BinaryEncode
      47. BitAnd
      48. BitMaskClear
      49. BitMaskRead
      50. BitMaskSet
      51. BitNot
      52. BitOr
      53. BitSHLN
      54. BitSHRN
      55. BitXor
      56. BooleanFormat
    3. Functions-c-d
      1. CacheGet
      2. CacheGetAllIds
      3. CacheGetMetadata
      4. CacheGetProperties
      5. CacheGetSession
      6. CacheIdExists
      7. CachePut
      8. CacheRegionExists
      9. CacheRegionNew
      10. CacheRegionRemove
      11. CacheRemove
      12. CacheRemoveAll
      13. CacheSetProperties
      14. CallStackDump
      15. CallStackGet
      16. CanDeSerialize
      17. Canonicalize
      18. CanSerialize
      19. Ceiling
      20. CharsetDecode
      21. CharsetEncode
      22. Chr
      23. CJustify
      24. Compare
      25. CompareNoCase
      26. Cos
      27. CreateDate
      28. CreateDateTime
      29. CreateObject
      30. CreateObject: .NET object
      31. CreateObject: COM object
      32. CreateObject: component object
      33. CreateObject: CORBA object
      34. CreateObject: Java or EJB object
      35. CreateObject: web service object
      36. CreateODBCDate
      37. CreateODBCDateTime
      38. CreateODBCTime
      39. CreateSignedJWT
      40. CreateEncryptedJWT
      41. CreateTime
      42. CreateTimeSpan
      43. CreateUUID
      44. CSRFGenerateToken
      45. CSRFVerifyToken
      46. DateAdd
      47. DateCompare
      48. DateConvert
      49. DateDiff
      50. DateFormat
      51. DatePart
      52. DateTimeFormat
      53. Day
      54. DayOfWeek
      55. DayOfWeekAsString
      56. DayOfYear
      57. DaysInMonth
      58. DaysInYear
      59. DE
      60. DecimalFormat
      61. DecodeForHTML
      62. DecodeFromURL
      63. DecrementValue
      64. Decrypt
      65. DecryptBinary
      66. DeleteClientVariable
      67. Deserialize
      68. DeserializeJSON
      69. DeserializeXML
      70. DirectoryCopy
      71. DirectoryCreate
      72. DirectoryDelete
      73. DirectoryExists
      74. DirectoryList
      75. DirectoryRename
      76. DollarFormat
      77. DotNetToCFType
      78. Duplicate
    4. Functions-e-g
      1. EncodeForCSS
      2. EncodeForDN
      3. EncodeForHTML
      4. EncodeForHTMLAttribute
      5. EncodeForJavaScript
      6. EncodeForLDAP
      7. EncodeForURL
      8. EncodeForXML
      9. EncodeForXMLAttribute
      10. EncodeForXpath
      11. Encrypt
      12. EncryptBinary
      13. EntityDelete
      14. EntityLoad
      15. EntityLoadByExample
      16. EntityLoadByPK
      17. EntityMerge
      18. EntityNew
      19. EntityReload
      20. EntitySave
      21. EntityToQuery
      22. Evaluate
      23. Exp
      24. ExpandPath
      25. FileClose
      26. FileCopy
      27. FileDelete
      28. FileExists
      29. FileGetMimeType
      30. FileIsEOF
      31. FileMove
      32. FileOpen
      33. FileRead
      34. FileReadBinary
      35. FileReadLine
      36. FileSeek
      37. FileSetAccessMode
      38. FileSetAttribute
      39. FileSetLastModified
      40. FileSkipBytes
      41. FileUpload
      42. FileUploadAll
      43. FileWrite
      44. FileWriteLine
      45. Find
      46. FindNoCase
      47. FindOneOf
      48. FirstDayOfMonth
      49. Fix
      50. Floor
      51. FormatBaseN
      52. GeneratePBKDFKey
      53. GenerateSecretKey
      54.  GetApplicationMetadata
      55. GetAuthUser
      56. GetBaseTagData
      57. GetBaseTagList
      58. GetBaseTemplatePath
      59. GetClientVariablesList
      60. GetComponentMetaData
      61. GetContextRoot
      62. GetCPUUsage
      63. GetCurrentTemplatePath
      64. GetDirectoryFromPath
      65. GetEncoding
      66. GetException
      67. GetFileFromPath
      68. GetFileInfo
      69. GetFreeSpace
      70. GetFunctionCalledName
      71. GetFunctionList
      72. GetGatewayHelper
      73. GetHttpRequestData
      74. GetHttpTimeString
      75. GetK2ServerDocCount
      76. GetK2ServerDocCountLimit
      77. GetLocale
      78. GetLocaleDisplayName
      79. GetLocalHostIP
      80. GetMetaData
      81. GetMetricData
      82. GetPageContext
      83. GetPrinterInfo
      84. GetPrinterList
      85. GetProfileSections
      86. GetProfileString
      87. GetReadableImageFormats
      88. GetSafeHTML
      89. GetSAMLAuthRequest
      90. GetSAMLLogoutRequest
      91. GenerateSAMLSPMetadata
      92. GetSOAPRequest
      93. GetSOAPRequestHeader
      94. GetSOAPResponse
      95. GetSOAPResponseHeader
      96. GetSystemFreeMemory
      97. GetSystemTotalMemory
      98. GetTempDirectory
      99. GetTempFile
      100. GetTemplatePath
      101. GetTickCount
      102. GetTimeZoneInfo
      103. GetToken
      104. GetTotalSpace
      105. GetUserRoles
      106. GetVFSMetaData
      107. GetWriteableImageFormats
    5. Functions-h-im
      1. Hash
      2. HMac
      3. Hour
      4. HQLMethods
      5. HTMLCodeFormat
      6. HTMLEditFormat
      7. IIf
      8. ImageAddBorder
      9. ImageBlur
      10. ImageClearRect
      11. ImageCopy
      12. ImageCreateCaptcha
      13. ImageCrop
      14. ImageDrawArc
      15. ImageDrawBeveledRect
      16. ImageDrawCubicCurve
      17. ImageDrawLine
      18. ImageDrawLines
      19. ImageDrawOval
      20. ImageDrawPoint
      21. ImageDrawQuadraticCurve
      22. ImageDrawRect
      23. ImageDrawRoundRect
      24. ImageDrawText
      25. ImageFlip
      26. ImageGetBlob
      27. ImageGetBufferedImage
      28. ImageGetEXIFMetadata
      29. ImageGetEXIFTag
      30. ImageGetHeight
      31. ImageGetIPTCMetadata
      32. ImageGetIPTCTag
      33. ImageGetMetadata
      34. ImageGetWidth
      35. ImageGrayscale
      36. ImageInfo
      37. ImageMakeColorTransparent
      38. ImageMakeTranslucent
      39. ImageNegative
      40. ImageNew
      41. ImageOverlay
      42. ImagePaste
      43. ImageRead
      44. ImageReadBase64
      45. ImageResize
      46. ImageRotate
      47. ImageRotateDrawingAxis
      48. ImageScaleToFit
      49. ImageSetAntialiasing
      50. ImageSetBackgroundColor
      51. ImageSetDrawingColor
      52. ImageSetDrawingStroke
      53. ImageSetDrawingTransparency
      54. ImageSharpen
      55. ImageShear
      56. ImageShearDrawingAxis
      57. ImageTranslate
      58. ImageTranslateDrawingAxis
      59. ImageWrite
      60. ImageWriteBase64
      61. ImageXORDrawingMode
    6. Functions-in-k
      1. IncrementValue
      2. InputBaseN
      3. Insert
      4. Int
      5. InvalidateOauthAccesstoken
      6. Invoke
      7. InitSAMLAuthRequest
      8. InitSAMLLogoutRequest
      9. InvokeCFClientFunction
      10. IsArray
      11. IsAuthenticated
      12. IsAuthorized
      13. IsBinary
      14. IsBoolean
      15. IsClosure
      16. IsCustomFunction
      17. IsDate
      18. IsDateObject
      19. IsDDX
      20. IsDebugMode
      21. IsDefined
      22. IsImage
      23. IsImageFile
      24. IsInstanceOf
      25. IsIPv6
      26. IsJSON
      27. IsK2ServerABroker
      28. IsK2ServerDocCountExceeded
      29. IsK2ServerOnline
      30. IsLeapYear
      31. IsLocalHost
      32. IsNull
      33. IsNumeric
      34. IsNumericDate
      35. IsObject
      36. isOnline
      37. IsPDFArchive
      38. IsPDFFile
      39. IsPDFObject
      40. IsProtected
      41. IsQuery
      42. isSamlLogoutResponse
      43. isSafeHTML
      44. IsSimpleValue
      45. IsSOAPRequest
      46. IsSpreadsheetFile
      47. IsSpreadsheetObject
      48. IsStruct
      49. IsUserInAnyRole
      50. IsUserInRole
      51. IsUserLoggedIn
      52. IsValid
      53. IsValidOauthAccesstoken
      54. IsWDDX
      55. IsXML
      56. IsXmlAttribute
      57. IsXmlDoc
      58. IsXmlElem
      59. IsXmlNode
      60. IsXmlRoot
      61. JavaCast
      62. JSStringFormat
    7. Functions-l
      1. LCase
      2. Left
      3. Len
      4. ListAppend
      5. ListChangeDelims
      6. ListContains
      7. ListContainsNoCase
      8. ListDeleteAt
      9. ListEach
      10. ListFilter
      11. ListFind
      12. ListFindNoCase
      13. ListFirst
      14. ListGetAt
      15. ListInsertAt
      16. ListLast
      17. ListLen
      18. ListMap
      19. ListPrepend
      20. ListQualify
      21. ListReduce
      22. ListRemoveDuplicates
      23. ListRest
      24. ListSetAt
      25. ListSort
      26. ListToArray
      27. ListValueCount
      28. ListValueCountNoCase
      29. LJustify
      30. Location
      31. Log
      32. Log10
      33. LSCurrencyFormat
      34. LSDateFormat
      35. LSDateTimeFormat
      36. LSEuroCurrencyFormat
      37. LSIsCurrency
      38. LSIsDate
      39. LSIsNumeric
      40. LSNumberFormat
      41. LSParseCurrency
      42. LSParseDateTime
      43. LSParseEuroCurrency
      44. LSParseNumber
      45. LSTimeFormat
      46. LTrim
    8. Functions-m-r
      1. Max
      2. Mid
      3. Min
      4. Minute
      5. Month
      6. MonthAsString
      7. Now
      8. NumberFormat
      9. ObjectEquals
      10. ObjectLoad
      11. ObjectSave
      12. OnWSAuthenticate
      13. ORMClearSession
      14. ORMCloseAllSessions
      15. ORMCloseSession
      16. ORMEvictCollection
      17. ORMEvictEntity
      18. ORMEvictQueries
      19. ORMExecuteQuery
      20. ORMFlush
      21. ORMFlushall
      22. ORMGetSession
      23. ORMGetSessionFactory
      24. ORMIndex
      25. ORMIndexPurge
      26. ORMReload
      27. ORMSearch
      28. ORMSearchOffline
      29. ParagraphFormat
      30. ParameterExists
      31. ParseDateTime
      32. Pi
      33. PrecisionEvaluate
      34. ProcessSAMLResponse
      35. ProcessSAMLLogoutRequest
      36. Quarter
      37. PreserveSingleQuotes
      38. QueryAddColumn
      39. QueryAddRow
      40. QueryConvertForGrid
      41. QueryExecute
      42. QueryFilter
      43. QueryGetResult
      44. QueryGetRow
      45. QueryKeyExists
      46. QueryMap
      47. QueryNew
      48. QueryReduce
      49. QuerySetCell
      50. QuotedValueList
      51. QueryEach
      52. Rand
      53. Randomize
      54. RandRange
      55. ReEscape
      56. REFind
      57. REFindNoCase
      58. ReleaseComObject
      59. REMatch
      60. REMatchNoCase
      61. RemoveCachedQuery
      62. RemoveChars
      63. RepeatString
      64. Replace
      65. ReplaceList
      66. ReplaceNoCase
      67. REReplace
      68. REReplaceNoCase
      69. RestDeleteApplication
      70. RestSetResponse
      71. RestInitApplication
      72. Reverse
      73. Right
      74. RJustify
      75. Round
      76. RTrim
    9. Functions-s
      1. Second
      2. SendGatewayMessage
      3. SendSAMLLogoutResponse
      4. Serialize
      5. SerializeJSON
      6. SerializeXML
      7. SessionInvalidate
      8. SessionRotate
      9. SessionGetMetaData
      10. SessionInvalidate
      11. SessionRotate
      12. SetDay
      13. SetEncoding
      14. SetHour
      15. SetLocale
      16. SetMonth
      17. SetProfileString
      18. SetVariable
      19. SetYear
      20. Sgn
      21. Sin
      22. Sleep
      23. SpanExcluding
      24. SpanIncluding
      25. SpreadsheetAddAutoFilter
      26. SpreadsheetAddColumn
      27. SpreadsheetAddFreezePane
      28. SpreadsheetAddImage
      29. SpreadsheetAddInfo
      30. SpreadsheetAddPageBreaks
      31. SpreadsheetAddRow
      32. SpreadsheetAddRows
      33. SpreadsheetAddSplitPane
      34. SpreadsheetCreateSheet
      35. SpreadsheetDeleteColumn
      36. SpreadsheetDeleteColumns
      37. SpreadsheetDeleteRow
      38. SpreadsheetDeleteRows
      39. SpreadsheetFormatCell
      40. SpreadsheetFormatColumn
      41. SpreadsheetFormatCellRange
      42. SpreadsheetFormatColumn
      43. SpreadsheetFormatColumns
      44. SpreadsheetFormatRow
      45. SpreadsheetFormatRows
      46. SpreadsheetGetCellComment
      47. SpreadsheetGetCellFormula
      48. SpreadsheetGetCellValue
      49. SpreadsheetGetColumnCount
      50. SpreadsheetInfo
      51. SpreadsheetMergeCells
      52. SpreadsheetNew
      53. SpreadsheetRead
      54. SpreadsheetReadBinary
      55. SpreadsheetRemoveSheet
      56. SpreadsheetSetActiveSheet
      57. SpreadsheetSetActiveSheetNumber
      58. SpreadsheetSetCellComment
      59. SpreadsheetSetCellFormula
      60. SpreadsheetSetCellValue
      61. SpreadsheetSetColumnWidth
      62. SpreadsheetSetFooter
      63. SpreadsheetSetHeader
      64. SpreadsheetSetRowHeight
      65. SpreadsheetShiftColumns
      66. SpreadsheetShiftRows
      67. SpreadsheetWrite
      68. Sqr
      69. StripCR
      70. StructAppend
      71. StructClear
      72. StructCopy
      73. StructCount
      74. StructDelete
      75. StructEach
      76. StructFilter
      77. StructFind
      78. StructFindKey
      79. StructFindValue
      80. StructGet
      81. StructGetMetadata
      82. StructInsert
      83. StructIsEmpty
      84. StructKeyArray
      85. StructKeyExists
      86. StructKeyList
      87. StructMap
      88. StructNew
      89. StructReduce
      90. StructSetMetadata
      91. StructSort
      92. StructToSorted
      93. StructUpdate
      94. StoreSetMetadata
      95. StoreGetACL
      96. StoreGetMetadata
      97. StoreAddACL
      98. StoreSetACL
    10. Functions-t-z
      1. Tan
      2. ThreadJoin
      3. ThreadTerminate
      4. Throw
      5. TimeFormat
      6. ToBase64
      7. ToBinary
      8. ToScript
      9. ToString
      10. Trace
      11. Transactionandconcurrency
      12. TransactionCommit
      13. TransactionRollback
      14. TransactionSetSavePoint
      15. Trim
      16. UCase
      17. URLDecode
      18. URLEncodedFormat
      19. URLSessionFormat
      20. Val
      21. ValueList
      22. VerifyClient
      23. Week
      24. Wrap
      25. WriteDump
      26. WriteLog
      27. WriteOutput
      28. WSGetAllChannels
      29. WSGetSubscribers
      30. WSPublish
      31. WSSendMessage
      32. XmlChildPos
      33. XmlElemNew
      34. XmlFormat
      35. XmlGetNodeType
      36. XmlNew
      37. XmlParse
      38. XmlSearch
      39. XmlTransform
      40. XmlValidate
      41. Year
      42. YesNoFormat
  3. ColdFusion Tags
    1. ColdFusion tag summary
    2. ColdFusion tags by category
      1. Application framework tags
        1. cfapplication
        2. cfassociate
        3. cferror
        4. cfimport
        5. cfinterface
        6. cflock
        7. cfscript
        8. cfthread
      2. Communications tags
        1. cfexchangecalendar
        2. cfexchangeconnection
        3. cfexchangecontact
        4. cfexchangefilter
        5. cfexchangemail
        6. cfexchangetask
        7. cffeed
        8. cfmail
        9. cfmailparam
        10. cfmailpart
        11. cfpopcfimap
      3. Database manipulation tags
        1. cfdbinfo
        2. cfinsert
        3. cfobjectcache
        4. cfprocparam
        5. cfprocresult
        6. cfquery
        7. cfqueryparam
        8. cfstoredproc
        9. cftransaction
        10. cfupdate
      4. Data output tags
        1. cfchart
        2. cfchartdata
        3. cfchartseries
        4. cfcol
        5. cfcontent
        6. cfdocument
        7. cfdocumentitem
        8. cfdocumentsection
        9. cfflush
        10. cfheader
        11. cflog
        12. cfoutput
        13. cfpresentation
        14. cfpresentationslide
        15. cfpresenter
        16. cfprocessingdirective
        17. cfprint
        18. cfreport
        19. cfreportparam
        20. cfsilent
        21. cftable
      5. Debugging tags
        1. cfdump
        2. cftimer
        3. cftrace
      6. Exception handling tags
        1. cfcatch
        2. cferror
        3. cffinally
        4. cfrethrow
        5. cfthrow
        6. cftry
      7. Extensibility tags
        1. cfchart
        2. cfchartdata
        3. cfchartseries
        4. cfcollection
        5. cfcomponent
        6. cfexecute
        7. cfftp
        8. function
        9. cfindex
        10. cfinterface
        11. cfinvoke
        12. cfinvokeargument
        13. cfobject
        14. cfproperty
        15. cfreport
        16. cfreportparam
        17. cfreturn
        18. cfsearch
        19. cfsharepoint
        20. cfspreadsheet
        21. cfwddx
        22. cfxml
      8. File management tags
        1. cfdirectory
        2. cffile
        3. cffileupload
        4. cfftp
        5. cfzip
        6. cfzipparam
      9. Flow-control tags
        1. cfabort
        2. cfbreak
        3. cfcase
        4. cfcontinue
        5. cfdefaultcase
        6. cfelse
        7. cfelseif
        8. cfexecute
        9. cfexit
        10. cfif
        11. cfinclude
        12. cflocation
        13. cfloop
        14. cfrethrow
        15. cfswitch
        16. cfthrow
        17. cftry
      10. Forms tags
        1. cfapplet
        2. cfcalendar
        3. cffileupload
        4. cfform
        5. cfformgroup
        6. cfformitem
        7. cfgrid
        8. cfgridcolumn
        9. cfgridrow
        10. cfgridupdate
        11. cfinput
        12. cfpdf
        13. cfpdfform
        14. cfpdfformparam
        15. cfpdfparam
        16. cfpdfsubform
        17. cfselect
        18. cfslider
        19. cftextarea
        20. cftree
        21. cftreeitem
      11. Internet Protocol tags
        1. cfajaximport
        2. cfajaxproxy
        3. cfftp
        4. cffeed
        5. cfimap
        6. cfhttp
        7. cfhttpparam
        8. cfldap
        9. cfmail
        10. cfmailparam
        11. cfmailpart
        12. cfpop
        13. cfsprydataset
      12. Page processing tags
        1. cfcache
        2. cfcontent
        3. cfflush
        4. cfheader
        5. cfhtmlhead
        6. cfinclude
        7. cfprocessingdirective
        8. cfsetting
        9. cfsilent
      13. Security tags
        1. cflogin
        2. cfloginuser
        3. cflogout
        4. cfNTauthenticate
      14. Variable manipulation tags
        1. cfcookie
        2. cfdump
        3. cfparam
        4. cfregistry
        5. cfsavecontent
        6. cfschedule
        7. cfset
        8. cfsetting
      15. Other tags
        1. cfimage
        2. cflog
        3. cfregistry
    3. Tags a-b
      1. cfabort
      2. cfajaximport
      3. cfajaxproxy
      4. cfapplet
      5. cfapplication
      6. cfargument
      7. cfassociate
      8. cfauthenticate
      9. cfbreak
    4. Tags c
      1. cfcache
      2. cfcalendar
      3. cfcase
      4. cfcatch
      5. cfchart
      6. cfchartdata
      7. cfchartseries
      8. cfclient
      9. cfclientsettings
      10. cfcol
      11. cfcollection
      12. cfcomponent
      13. cfcontent
      14. cfcontinue
      15. cfcookie
      16. Tags d-e
    5. Tags f
      1. cffeed
      2. cffile
      3. cffile action = "append"
      4. cffile action = "copy"
      5. cffile action = "delete"
      6. cffile action = "move"
      7. cffile action = "read"
      8. cffile action = "readBinary"
      9. cffile action = "rename"
      10. cffile action = "upload"
      11. cffile action = "uploadAll"
      12. cffile action = "write"
      13. cffileupload
      14. cffinally
      15. cfflush
      16. cfform
      17. cfformgroup
      18. cfformitem
      19. cfftp
      20. cfftp: Connection: file and directory operations
      21. cfftp: Opening and closing FTP server connections
      22. cfftp : Opening and closing secure FTP server connections
      23. cfftp action = "listDir"
      24. cffunction
    6. Tags g-h
      1. cfgraph
      2. cfgraphdata
      3. cfgrid
      4. cfgridcolumn
      5. cfgridrow
      6. cfgridupdate
      7. cfheader
      8. cfhtmlhead
      9. cfhtmltopdf
      10. cfhtmltopdfitem
      11. cfhttp
      12. cfhttpparam
    7. Tags i
      1. cfif
      2. cfimage
      3. cfimap
      4. cfimapfilter
      5. cfimpersonate
      6. cfimport
      7. cfinclude
      8. cfindex
      9. cfinput
      10. cfinsert
      11. cfinterface
      12. cfinvoke
      13. cfinvokeargument
    8. Tags j-l
      1. cfjava
      2. cflayout
      3. cflayoutarea
      4. cfldap
      5. cflocation
      6. cflock
      7. cflog
      8. cflogin
      9. cfloginuser
      10. cflogout
      11. cfloop
      12. cfloop : conditional loop
      13. cfloop : index loop
      14. cfloop : looping over a COM collection or structure
      15. cfloop : looping over a date or time range
      16. cfloop : looping over a list, a file, or an array
      17. cfloop : looping over a query
    9. Tags m-o
      1. cfmail
      2. cfmailparam
      3. cfmailpart
      4. cfmap
      5. cfmapitem
      6. cfmediaplayer
      7. cfmenu
      8. cfmenuitem
      9. cfmessagebox
      10. cfmodule
      11. cfNTauthenticate
      12. cfoauth
      13. cfobject
      14. cfobject: .NET object
      15. cfobject: COM object
      16. cfobject: component object
      17. cfobject: CORBA object
      18. cfobject: Java or EJB object
      19. cfobject: web service object
      20. cfobjectcache
      21. cfoutput
    10. Tags p-q
      1. cfparam
      2. cfpdf
      3. cfpdfform
      4. cfpdfformparam
      5. cfpdfparam
      6. cfpdfsubform
      7. cfpod
      8. cfpop
      9. cfpresentation
      10. cfpresentationslide
      11. cfpresenter
      12. cfprint
      13. cfprocessingdirective
      14. cfprocparam
      15. cfprocresult
      16. cfprogressbar
      17. cfproperty
      18. cfquery
      19. cfqueryparam
    11. Tags r-s
      1. cfregistry
      2. cfreport
      3. cfreportparam
      4. cfrethrow
      5. cfreturn
      6. cfsavecontent
      7. cfschedule
      8. cfscript
      9. cfsearch
      10. cfselect
      11. cfservlet
      12. cfservletparam
      13. cfset
      14. cfsetting
      15. cfsharepoint
      16. cfsilent
      17. cfslider
      18. cfspreadsheet
      19. cfsprydataset
      20. cfstoredproc
      21. cfswitch
    12. Tags t
      1. cftable
      2. cftextarea
      3. cftextinput
      4. cfthread
      5. cfthrow
      6. cftimer
      7. cftooltip
      8. cftrace
      9. cftransaction
      10. cftree
      11. cftreeitem
      12. cftry
    13. Tags u-z
      1. cfupdate
      2. cfwddx
      3. cfwebsocket
      4. cfwindow
      5. cfxml
      6. cfzip
      7. cfzipparam
  4. CFML Reference
    1. Reserved words and variables
      1. Reserved words and variables
      2. Reserved words
      3. Scope-specific built-in variables
      4. Custom tag variables
      5. ColdFusion tag-specific variables
      6. CGI environment (CGI Scope) variables
    2. Ajax JavaScript functions
      1. Ajax JavaScript functions
      2. Function summary Ajax
      3. ColdFusion.Ajax.submitForm
      4. ColdFusion.Autosuggest.getAutosuggestObject
      5. ColdFusion.Layout.enableSourceBind
      6. ColdFusion.MessageBox.getMessageBoxObject
      7. ColdFusion.ProgressBar.getProgressBarObject
      8. ColdFusion.MessageBox.isMessageBoxDefined
      9. JavaScriptFunctionsinColdFusion9Update1
    3. ColdFusion ActionScript functions
      1. ColdFusion ActionScript functions
      2. CF.http
      3. CF.query
    4. ColdFusion mobile functions
      1. ColdFusion Mobile Functions
      2. Accelerometer Functions
      3. Camera Functions
      4. Connection Functions
      5. Contact Functions
      6. Event Functions
      7. File System Functions
      8. Geolocation Functions
      9. Media and Capture Functions
      10. Notification Functions
      11. Splash Screen Functions
      12. Storage Functions
    5. Application.cfc reference
      1. Application.CFC reference
      2. Application variables
      3. Method summary
      4. onAbort
      5. onApplicationEnd
      6. onApplicationStart
      7. onMissingTemplate
      8. onCFCRequest
      9. onError
      10. onRequestEnd
      11. onRequest
      12. onRequestStart
      13. onServerStart
      14. onSessionEnd
      15. onSessionStart
    6. Script functions implemented as CFCs
      1. Script Functions Implemented as CFCs
      2. Accessing the functions
      3. Function summary
      4. ftp
      5. http
      6. mail
      7. pdf
      8. query
      9. Script functions implemented as CFCs in ColdFusion 9 Update 1
      10. storedproc
    7. ColdFusion Flash Form style reference
      1. Styles valid for all controls
      2. Styles for cfform
      3. Styles for cfformgroup with horizontal or vertical type attributes
      4. Styles for box-style cfformgroup elements
      5. Styles for cfformgroup with accordion type attribute
      6. Styles for cfformgroup with tabnavigator type attribute
      7. Styles for cfformitem with hrule or vrule type attributes
      8. Styles for cfinput with radio, checkbox, button, image, or submit type attributes
      9. Styles for cftextarea tag and cfinput with text, password, or hidden type attributes
      10. Styles for cfselect with size attribute value of 1
      11. Styles for cfselect with size attribute value greater than 1
      12. Styles for cfcalendar tag and cfinput with dateField type attribute
      13. Styles for the cfgrid tag
      14. Styles for the cftree tag
      15. ColdFusion Flash Form Style Reference
    8. ColdFusion event gateway reference
      1. ColdFusion Event Gateway reference
      2. addEvent
      3. CFEvent
      4. CFEventclass
      5. Constructor
      6. Gateway development interfaces and classes
      7. getStatus
      8. setCFCPath
      9. setCFCMethod
      10. getOriginatorID
      11. getLogger
      12. getBuddyList
      13. getBuddyInfo
      14. IM gateway message sending commands
      15. IM Gateway GatewayHelper class methods
      16. onIncomingMessage
      17. onIMServerMessage
      18. onBuddyStatus
      19. onAddBuddyResponse
      20. onAddBuddyRequest
      21. IM Gateway CFC incoming message methods
      22. IM gateway methods and commands
      23. CFML CFEvent structure
      24. warn
      25. info
      26. setOriginatorID
      27. data command
      28. submit Multi command
      29. submit command
      30. setGatewayType
      31. setGatewayID
      32. setData
      33. setCFCListeners
      34. outgoingMessage
      35. getStatusTimeStamp
      36. numberOfMessagesReceived
      37. numberOfMessagesSent
      38. removeBuddy
      39. removeDeny
      40. removePermit
      41. setNickName
      42. setPermitMode
      43. setStatus
      44. SMS Gateway CFEvent structure and commands
      45. SMS Gateway incoming message CFEvent structure
      46. getStatusAsString
      47. getProtocolName
      48. getPermitMode
      49. getPermitList
      50. getNickName
      51. getName
      52. getDenyList
      53. getCustomAwayMessage
      54. getQueueSize
      55. getMaxQueueSize
      56. getHelper
      57. getGatewayType
      58. getGatewayServices
      59. getGatewayID_1
      60. getGatewayID
      61. getData
      62. getCFCTimeout
      63. setCFCTimeout
      64. getCFCPath
      65. getCFCMethod
      66. GatewayServices class
      67. Gateway interface
      68. GatewayHelper interface
      69. addPermit
      70. addDeny
      71. addBuddy
      72. error
      73. debug
      74. Logger class
      75. stop
      76. start
      77. CFML event gateway SendGatewayMessage data parameter
      78. restart
      79. fatal
      80. SMS gateway message sending commands
    9. ColdFusion C++ CFX Reference
      1. C++ class overview
      2. Deprecated class methods
      3. CCFXException class
      4. CCFXQuery class
      5. CCFXRequest class
      6. CCFXStringSet class
      7. ColdFusion C++ CFX Reference
    10. ColdFusion Java CFX reference
      1. ColdFusion Java CFX reference
      2. Class libraries overview
      3. Custom tag interface
      4. Query interface
      5. Request interface
      6. Response interface
      7. Debugging classes reference
    11. WDDX JavaScript Objects
      1. WDDX JavaScript objects
      2. JavaScript object overview
      3. WddxRecordset object
      4. WddxSerializer object
  5. Cloud services
    1. ColdFusion and GCP Storage
    2. ColdFusion and GCP Firestore
    3. ColdFusion and GCP PubSub
    4. ColdFusion and Amazon S3
    5. ColdFusion and DynamoDB
    6. ColdFusion and Amazon SQS
    7. ColdFusion and Amazon SNS
    8. ColdFusion and MongoDB
    9. ColdFusion and Azure Blob
    10. ColdFusion and Azure Service Bus
    11. Multi-cloud storage services
    12. Multi-cloud RDS databases
    13. ColdFusion and Azure Cosmos DB

 

Use the cfpdf tag to read an existing PDF, write meta-data to it, merge PDFs together, delete pages, create thumbnails of the pages, extract text and images, add or remove watermarks, electronically sign or unsign documents, sanitize and redact PDF contents for better security, and safeguard the PDFs with a password.

Description

Manipulates existing PDF documents. The following list describes some of the tasks you can perform with the cfpdf tag:

  • Merge several PDF documents into one PDF document.
  • Delete pages from a PDF document.
  • Merge pages from one or more PDF documents and generate a new PDF document.
  • Linearize PDF documents for faster web display.
  • Remove interactivity from forms created in Acrobat to generate flat PDF documents.
  • Encrypt and add password protection to PDF documents.
  • Generate thumbnail images from PDF documents or pages.
  • Add or remove watermarks from PDF documents or pages.
  • Retrieve information associated with a PDF document, such as the software used to generate the file or the author, and set information for a PDF document, such as the title, author and keywords.
  • Create PDF portfolios
  • Add and remove header/footer from PDF documents
  • Optimize PDF documents

History

New actions for <cfpdf> tag in ColdFusion 2016:

ColdFusion 11 has added the following new attributes to the <cfpdf> tag:

  • keystore
  • keystorepassword
  • keyalias
  • keypassword
  • author
  • signaturefieldname
  • unsignall
  • height
  • width

ColdFusion 8: Added this tag.ColdFusion 9: Added new attributes: jpgdpi, maxBreadth, noAttachments, leftMargin, algo, noMetadata, noBookMarks, 

noJavaScripts, useStructure, noFonts

Note:

The license could not be verified: License Certificate has expired!

Note:

 The tag does not support variables for some attributes. For example,

  • Incorrect: <cfpdf action="export" type="comment" source="samplePDFVariable" />

  • Correct: <cfpdf action="export" type="comment" source="c:\source.pdf" exportto="c:\destination.pdf" />

Category

Syntax

Add a watermark to a PDF document 
<cfpdf 
required 
action = "addwatermark" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
one of the following: 
copyfrom = "absolute or relative pathname to a PDF file from which the first page is 
used as a watermark" 
image = "absolute or relative pathname to image file|image variable used as a 
watermark" 
optional 
foreground = "yes|no" 
isBase64 = "yes|no" 
opacity = "watermark opacity" 
overwrite = "yes|no" 
pages = "page or pages to add the watermark" 
password = "user or owner password for the PDF source file" 
position = "position on the page where the watermark is placed" 
rotation = "degree of rotation of the watermark" 
showonprint = "yes|no"> 
// one of the following: 
destination = "PDF output file pathname" 
name = "PDF document variable name" 
image = "image file name to be used as the footer" 
text = "text to be used in the footer" 

<!---  action=sanitize --->
<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”>
<!--- end syntax --->

<!--- action=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">
<!--- end syntax --->

<!--- action=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”>
<!--- end syntax --->

<!--- action=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">
<!--- end syntax --->

<!--- action=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”>
<!--- end syntax --->

<!--- action=archive --->
<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 = "3b"/>
<!--- end syntax --->

<!--- action=addAttachments --->
<cfpdf
// 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 = "eg: application/pdf, text/html">
>
<!--- end syntax --->

<!--- action=addStamp --->
<cfpdf
// 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”>
<cfpdfparam
  pages = "page number|page range|comma-separated page numbers"
  <!--- It is recommended that that ratio of the stamp width:height is
         10:3 ---> 
  coordinates = "llx,lly,urx,ury"
  iconName = "name of icon"
  note = "content of stamp" >
>
<!--- end syntax --->

Add headers 
<cfpdf 
required 
action = "addheader" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
pages = "page or pages to add the footer" 
optional 
isBase64 = "yes|no" 
overwrite = "yes|no" 
password = "user or owner password for the PDF source file" 
showonprint = "yes|no"> 
align = "left|right|center" 
leftmargin = "value of the header left marign" 
rightmargin = "value of the header right margin" 
numberformat = "LOWERCASEROMAN|NUMERIC|UPPERCASEROMAN" <!---used with either 
_PAGENUMBER or _LASTPAGENUMBER---> 
opacity = "header opacity" 
topmargin = "value of the top margin of the header" 
\\one of the following: 
destination = "PDF output file pathname" 
name = "PDF document variable name" 
text = _PAGELABEL: add current page label|_LASTPAGELABEL: add last page label| 
_PAGENUMBER: add current page number|_LASTPAGENUMBER: add last page 
number \\text for the header. You can also add a normal text string. 
image = "image file name to be used as the header" 

Add footer 
<cfpdf 
required 
action = "addfooter" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
pages = "page or pages to add the footer" 
optional 
isBase64 = "yes|no" 
overwrite = "yes|no" 

password = "user or owner password for the PDF source file" 
showonprint = "yes|no"> 
destination = "PDF output file pathname" 
name = "PDF document variable name" 
align = "left|right|center" 
one of the following: 
image = "image file name to be used as the footer" 
text = _PAGELABEL: add current page label|_LASTPAGELABEL: add last page label| 
_PAGENUMBER: add current page number|_LASTPAGENUMBER: add last page 
number \\text for the header 
leftmargin = "value of the footer left marign" 
rightmargin = "value of the footer right margin" 
numberformat 
opacity = "footer opacity" 
bottommargin = "value of the bottom margin" 
Delete pages from a PDF document 
<cfpdf 
required 
action = "deletepages" 
pages = "page or pages to delete" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
optional 
overwrite = "yes|no" 
password = "PDF source file password" 
one of the following: 
destination = "PDF output file pathname" 
name = "PDF document variable name"> 
Delete headers and footers 
<cfpdf 
required 
action = "removeheaderfooter" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
optional 
overwrite = "yes|no" 
pages = "page or pages to add the watermark" 
password = "user or owner password for the PDF source file" 
one of the following: 
destination = "PDF output file pathname" 
name = "PDF document variable name" 
Retrieve information about a PDF document 
<cfpdf 
required 
action = "getinfo" 
name = "structure variable name" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
optional 
password = "PDF source file password"> 

Merge PDF documents into an output PDF file 
<cfpdf 
required 
action = "merge" 
one of the following: 
directory = "directory of PDF files to merge" 
source = "comma-separated list of PDF source files|absolute or relative pathname 
to a PDF file|PDF document variable|cfdocument variable" 
<cfpdfparam> 
\\required only when package is specified as true 
order = "name|time" 
one of the following if <cfpdfparam> is specified: 
name = "PDF document variable name" 
destination = "PDF output file pathname" 
optional 
package = "true|false" <!---create PDF packages if set to true. You can provide 
description in cfpdfparam tag, such as <cfpdfparam file="filename desc="">---> 
ascending = "yes|no" 
keepBookmark = "yes|no" 
overwrite = "yes|no" 
pages = "pages to merge in PDF source file" 
password = "PDF source file password" 
stopOnError = "yes|no" 
\\one of the following: 
destination = "PDF output file pathname" 
name = "PDF document variable name"> 

Use DDX instructions to manipulate PDF documents 
<cfpdf 
required 
ddxfile = "DDX filepath|DDX string" 
inputfiles = "#inputStruct#" 
outputfiles = "#outputStruct#" 
name = "structure name"> 
optional 
action="processddx" 

Set passwords and encrypt PDF documnets 
<cfpdf 
required 
action = "protect" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
at least one of the following: 
newUserPassword = "password" 
newOwnerPassword = "password" 
if newOwnerPassword is specified: 
permissions = "All|AllowAssembly|AllowDegradedPrinting|AllowCopy|AllowFillIn|
AllowModifyAnnotations| 
AllowModifyContents|AllowPrinting|AllowScreenReaders|AllowSecure|None| 
comma-separated list" 
optional 
destination = "PDF output file pathname" 
encrypt = "RC4_40|RC4_128|RC4_128M|AES_128|AES_256R6|AES_256R5|none" 
overwrite = "yes|no" 
password = "source file password"> 

Name a PDF document variable 
<cfpdf 
required 
action = "read" 
name = "PDF document variable name" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
optional 
password = "PDF source file password"> 

Remove a watermark from a PDF document 
<cfpdf 
required 
action = "removeWatermark" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
optional 
overwrite = "yes|no" 
pages = "page or pages from which to remove the watermark" 
password = "PDF source file password"> 
one of the following: 
destination = "PDF output file pathname" 
name = "PDF document variable name" 

Set information about a PDF document 
<cfpdf 
required 
action = "setinfo" 
info = "#structure variable name#" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
optional 
destination = "PDF output file pathname" 
overwrite = "yes|no" 
password = "PDF source file password"> 

Generate thumbnails from pages in a PDF document 
<cfpdf 
required 
action = "thumbnail" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
optional 
destination = "directory path where the thumbnail images are written" 
format = "png|jpeg|tiff" 
imagePrefix = "string used as a prefix in the output filename" 
overwrite = "yes|no" 
password = "PDF source file password"> 
pages = "page or pages to make into thumbnails" 
resolution= "low|high" 
scale = "percentage between 1 and 100" 
transparent = "yes|no"> 
hires = "yes|no" 
overridepage = "yes|no" 
compresstiffs = "yes|no" 
maxscale = "maximum scale of the thumbnail" 
maxlength = "maximum length of the thumbnail" 
maxbreadth = "maximum width of the thumbnail"
jpgdpi = "sets the dpi (dots per inch) value of the jpeg image. The default value is 96 dpi."

Write a PDF document to an output file 
<cfpdf 
required 
action = "write" 
source = "absolute or relative pathname to a PDF file|PDF document variable| 
cfdocument variable" 
\\one of the following 
destination = "PDF output file pathname" 
name = #PDF variable# <!---new variable support added now---> 
optional 
flatten = "yes|no" 
overwrite = "yes|no" 
password = "PDF source file password" 
saveOption = "linear|incremental|full" 
version = "1.1|1.2|1.3|1.4|1.5|1.6"> 
encodeall = "yes|no" 

Reduce the quality of a PDF document 
<cfpdf 
required 
action = "optimize" 
source = "absolute or relative path of the PDF file|PDF document variable| 
cfdocument variable" 
algo = "bilinear|bicubic|nearest_neighbour" <!---algorithm for image 
downsampling---> 
pages = "*" <!----page numbers associated with the objects in the PDF document---> 
optional 
vscale= "Vertical scale of the image to be modified. Valid values are vscale>0" 
hscacle="Horizontal scale of the image to be modified. Valid values are hscale<1" 
destination = "PDF output file pathname" 
name = "PDF document variable" 
noattachments = "Discard all attachments" 
nobookmarks = "Discard all bookmarks" 
nocomments = "Discard all comments" 
nofonts = "Discard all fonts" 
nojavascripts = "Discard all JavaScript actions" 
nolinks = "Discard external cross-references" 
nometadata = "Discard document information and metadata" 
nothumbnails = "Discard embedded page thumbnails" 
overwrite = "true" <!---Overwrite the specified object in the PDF document---> 
password = "" <!--- PDF document password---> 

Extract text 
<cfpdf 
required 
action="extracttext" <!---extract all the words in the PDF.---> 
source= "absolute or relative path of the PDF file|PDF document variable| 
cfdocument variable" 
pages = "*" <!----page numbers from where the text needs to be extracted from the 
PDF document---> 
optional 
addquads = "add the position or quadrants for the text in the PDF" 
honourspaces = "true|false" 
overwrite = "true" <!---Overwrite the specified object in the PDF document---> 
password = "" <!--- PDF document password---> 
type = "string|xml" <!---format in which the text needs to be extracted---> 
one of the following: 
destination = "PDF output file pathname" 
name = "PDF document variable" 
usestructure = "true|false" 
Extract image 
<cfpdf 
required 
action = "extractimage" <!---extract images and save it to a directory---> 
source = "absolute or relative path of the PDF file|PDF document variable| 
cfdocument variable" 
pages = "*" <!---page numbers from where the images need to be extracted---> 
optional 
overwrite = "true|false" <!---overwrite any existing image when set to true---> 
format = "png|tiff|jpg" <!---format in which the images should be extracted---> 
imageprefix = "*" <!---the string that you want to prefix with the image 
name---> 
password = "" <!--- PDF document password---> 
destination = "PDF output file pathname" 

Page level transformations 
<cfpdf 
required 
action = "transform" 
source = "absolute or relative path of the PDF file|PDF document variable| 
cfdocument variable" 
pages = "page or pages to be transformed" 
optional 
hscale = "value of the horizontal scale of the page" 
overwrite = "yes|no" 
password = "PDF source file password" 
position = "x, y" <!---value in pixels---> 
rotation = "0|90|180|270" 
vscale = "length of the page to be transformed" 
one of the following: 
destination = ""Path of the directory where the PDF document will be saved" 
name = "PDF document variable"

// redact
<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>
Note:

You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys.

See also

Attributes

Attribute

Action

Req/Opt

Description

action

N/A

Optional

Action to take:

archive

addAttachments

addStamp

addWatermark

deletePages

export

getInfo

import

merge

processddx

protect

read

removeWatermark

sanitize

setInfo

sign

thumbnail

write

optimize

extracttext

extractimage

addheader

addfooter

removeheaderfooter

transform

unsign

validatesignature

New in ColdFusion 11–Validates all the signatures
in the document. The name attribute will then store
the resultant struct of this operation. The name attribute will contain 2 elements:

    • A Boolean field that indicates whether all the signatures have been deemed
      valid or not. 
    • An array list consisting of the names of all the signatures that were invalid.
      If all the signatures are valid, the array list will be empty.

readsignaturefields

New in ColdFusion 11–Reads all the signature fields and returns a query object in the variable
indicated by the attribute name. This query object will have 4 columns:

    • Name–A fully qualified name of the signature field
    • Certifiable--Indicates if this field can contain an author signature or not
    • Signable–Indicates whether this field can be signed or not
    • Is signed–Indicates whether this field is already signed or not

New in ColdFusion 2016:

  • sanitize
  • export
  • import
  • archive
  • addAttachments
  • addStamp
  • redact

addquads

extracttext

Optional

Add the position or quadrants of the thumbnail

align

addheader
addfooter

Optional

Aligns the header and footer in PDF.

algo

optimize

Required

Specifies the algorithm for image downsampling. The values are bilinear, bicubic, and nearest_neighbour

ascending

merge

Optional

Order in which the PDF files are sorted:

yes: Files are sorted in ascending order

no: Files are sorted in descending order
Applicable only when you specify the directory attribute.

author

sign

Optional

Business transactions, including financial, legal, and other 
regulated transactions,
require high assurance when signing documents.  When documents are distributed electronically, it is important that  recipients can:

Verify document authenticity – confirm the identity of person who signed the document

Verify document integrity –
confirm that the document has
not been altered in transit

Author-based signatures provide both of these security services.

If attribute is not mentioned
then it is treated as author=false

bottomMargin

addfooter

Optional

Specifies the value of the bottomMargin

copyFrom

addWatermark

Optional

Pathname of the PDF document from which to use the first page as a watermark

compresstiffs

thumbnail

Optional

Compress thumbnail which are in TIFF format.

ddxfile

processddx

Required

Pathname of the DDX file, or a string with DDX instructions

destination

addWatermark archive
deletePages
merge
protect
removeWatermark
sign        setInfo
thumbnail
write
optimize
extracttext
extractimage
addheader
addfooter
removeheaderfooter
transform

 

Required for
the write action
Optional for all other actions

Pathname of the modified PDF document. 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.
You can specify the destination attribute or the name attribute, but not both.
For the thumbnail action, the destination is the directory path where the images are written. If you specify a relative pathname to the destination directory, the destination directory is relative to the template directory. If you do not specify a destination directory, ColdFusion creates a directory called thumbnails in the directory in the template directory.
For the optimize action, destination is the path where the PDF document which needs to be optimized is located. For extracttext and extractimage , destination is the path of the PDF document from which the text or image needs to be extracted.
For addheader , addfooter , removeheader footer, destination is the path of the PDF document where you need to add a header or footer, or remove the header and footer.
For transform, destination specifies the directory path of the PDF document where you need to perform page level transformations.

directory

merge

Optional

Directory of the PDF documents to merge. Specify either the directory attribute or the source attribute. If you specify the directory attribute, ColdFusion orders the documents by filename in descending order, by default. To change the order of the files, use the order attribute.

encodeall

write

Optional

Encode streams that are not encoded to optimize page content

encrypt

protect

Optional

Encryption type for the PDF output file. In ColdFusion 2016, there is support for two new encryption algorithms, AES_256R6 and AES_256R5.

  • RC4_40
  • RC4_128
  • RC4_128M
  • AES_128
  • AES_256R6
  • AES_256R5
  • None

Note: The JRE must have "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" installed. This is only required for the new encryption algorithms.

For more information, see the section Encryption for PDF documents.

flatten

write

Optional

Applies to forms created in Acrobat only (not forms created in LiveCycle); specifies whether interactivity is turned off:

yes: the form fields are no longer interactive.

no: the form fields remain interactive.

foreground

addWatermark

Optional

Placement of the watermark on the page:

yes: the watermark appears in the foreground (over the page content).

no: the watermark appears in the background (behind the page content).

format

thumbnail

Optional

File type of thumbnail image output:

jpg

tiff

png

hires

thumbnail

optional

Sets a high resolution for the thumbnail if set to yes.

height

sign

Optional

Height of the signature field.

honourspaces

extracttext

optional

Set this option to "true", for improved readability and spacing.

hscale

optimize

optional

Horizontal scale of the image to be modified. Valid values are hscale<1.

image

addWatermark

Optional

Image used as a watermark. You can specify a pathname, a variable that contains an image file, or a ColdFusion image variable.

imagePrefix

thumbnail

Optional

Prefix used for each image thumbnail file generated. The image filenames use the format: imagePrefixpagen.format. For example, the thumbnail for page 1 of a document with the imagePrefix attribute set to myThumbnail is myThumbnail_page_1.jpg.

info

setInfo

Required

Structure variable for relevant information, for example, " #infoStruct#" . You can specify the Author, Subject, Title, and Keywords for the PDF output file.

inputFiles

processddx

Required

Structure that maps the PDF source files to the input variables in the DDX file, or a string of elements and their pathname.

isBase64

addWatermark

Optional

Valid only when the image attribute is specified. Specifies whether the image used as a watermark is in Base64 format:

yes: the image is in Base64 format.

no: the image is not in Base64 format.

jpgdpi

addThumbnail

Optional

Sets the DPI of the jpeg image. Default is 96 dpi.

keepBookmark

merge

Optional

Specifies whether bookmarks from the source PDF documents are retained in the merged document:

yes: the bookmarks are retained.

no: the bookmarks are removed.

keyalias

sign

Optional

Alias of the key with which the certificate and private key are stored in the keystore . If it is not specified, the first entry in the keystore is chosen as the alias.

keystore

sign

Required

The
location of the keystore file. For example, C:\OpenSSL\bin\keystore.jks.

keypassword

sign

Optional

Password for your private key. If not specified the keystorepassword is used.

keystorepassword

sign

Required

The password of the keystore .

leftmargin

addheader

Optional

Specifies the value of the header left margin

maxbreadth

thumbnail

Optional

Specifies maximum width of the thumbnail

maxlength

thumbnail

Optional

Specifies the maximum length of the thumbnail

maxscale

thumbnail

Optional

Specifies the maximum scale of the thumbnail

name

addWatermark
deletePages
getInfo
merge
processddx
protect
read         
readsignaturefields
removeWatemark
write
tranform
addheader
addfooter
removeheaderfooter

Required:
getInfo
processddx
read readsignaturefields
Optional:
addWatermark
deletePages
merge
protect
removeWatermark
tranform
addheader
addfooter
removeheader
footer

PDF document variable name, for example, myBook.
If the source is a PDF document variable, you cannot specify the name attribute again; you can write the modified PDF document to the destination.
You can specify the destination attribute or the name attribute, but not both.
For the processddxaction , the name represents the structure that is populated with the success or failure of the output variables.

For the  readsignaturefields  action, the name represents the structure thats is populated with the info of all the signature fields in the source PDF document.

 

newOwner
Password

protect

Optional (see Description)

Password used to set permissions on a PDF document.
To change the default permissions, specify the newOwnerPassword attribute. For more information, see the section PDF document passwords.

newUser
Password

protect

Optional (see Description)

Password used to open PDF document.Specify either the newUserPassword attribute or a newOwnerPassword attribute; if you specify both, the passwords must differ. For more information, see the section PDF document passwords.

noattachments

thumbnail

Optional

Removes all attachments from PDF documents.

noattachments

optimize

Optional

Remove all file attachments

nobookmarks

optimize

Optional

Remove bookmarks from PDF document

nocomments

optimize

Optional

Remove comments from PDF document

nofonts

optimize

Optional

Remove font styling

nojavascripts

optimize

Optional

Remove all document level JavaScript actions

nolinks

optimize

Optional

Remove external cross-references

nometadata

optimize

Optional

Remove document information and metadata

nothumbnails

optimize

Optional

Remove embedded page thumbnails

numberformat

addfooter

Optional

Specify the numbering format for PDF pages in the footer.

opacity

addWatermark
addheader
addfooter

Optional

Opacity of the watermark. Valid values are integers in the range 0 (transparent) through 10 (opaque).

order

merge

Optional

Order in which the PDF documents in the directory are merged:

name: orders the documents alphabetically by filename.

time: orders the documents by timestamp.
By default, ColdFusion merges the files in descending order (for example, from Z to A). To change this, set the ascending attribute to yes.

outputFiles

processddx

Required

Structure that contains the output files in the DDX file or string as keys and the pathname to the result file as the value.

overwrite

addSign addWatermark
archive
deletePages
merge
protect
removeWatermark
Sign        setInfo
thumbnail
write
tranform
addheader
addfooter
removeheaderfooter

Optional

Specifies whether PDF output overwrites the destination file:

yes: overwrites the destination file.

no: does not overwrite the destination file.
For the thumbnail action, specifies whether to overwrite the destination directory. If the directory exists, the thumbnails are not generated unless overwrite is set to yes.

package

merge

Optional

Create PDF packages

pages

addWatermark
deletePages
merge
removeWatermark
optimize
extracttext
extractimage     sign
addheader
addfooter
removeheaderfooter
transform

Required:
deletePages
Optional:
addWatermark
merge
removeWatermark
thumbnail
optimize
extractext
extractimage
tranform
addheader
addfooter
removeheader
footer

Page or pages in the source PDF document on which to perform the action. You can specify multiple pages and page ranges as follows: "1,6-9,56-89,100, 110-120".
For the removeWatermark action, the pages attribute applies only to the watermark type. ColdFusion ignores duplicate pages and numbers greater than the total page count. For action=sign, value of attribute pages should consist of just one page number.

 

password

addWatermark addSign     
archive
deletePages
getInfo
merge
protect
read readsignaturefields
removeWatermark
setInfo             sign
thumbnail         unsign
write
optimize
extracttext
extractimage
addheader
addfooter
removeheaderfooter validatesignaturefields
transform

Optional

Owner or user password of the source PDF document, if the document is password-protected.

permissions

protect

Optional

Type of permissions
on the PDF document:

All

AllowAssembly

AllowCopy

AllowDegradedPrinting

AllowFillIn

AllowModifyAnnotations

AllowModifyContents

AllowPrinting

AllowScreenReaders

AllowSecure

None
Except for All or None, you can specify a comma-separated list of permissions. To set permissions,
you must also set the newOwnerPassword attribute.

position

addWatermark             sign

Optional

 The position attribute is the coordinate of the lower left corner of the signature field.

resolution

thumbnail

Optional

Image quality used to generate thumbnail images:

high: use high resolution
(uses more memory).

low: use low resolution.

rotation

addWatermark
transform

Optional

Degree of rotation of the watermark image on the page, for example, "30".

saveOption

write

Optional

Save options for the PDF output:

full: normal save (default)

incremental: required to save modifications to a signed PDF document.

linear: for faster display.

scale

thumbnail

Optional

Size of the thumbnail relative to the source page. The value represents a percentage from 1 through 100.

showOnPrint

addWatermark

Optional

Specify whether to print the watermark with the PDF document:

yes: the watermark is printed with the PDF document.

no: the watermark is display-only.

signature
fieldname

sign                                         unsign

Optional

Name of signature field in which the user wants to sign or the name of the signature field that the user wants to unsign.

source

archive      addWatermark
deletePages
getInfo
merge
protect
read
removeWatermark
setInfo              sign
thumbnail
write
optimize
extracttext
extractimage
addheader
addfooter
removeheaderfooter
unsign
transform

Required (see
Usage section for merge)

PDF document used as the source. The source can be one of the following:

An absolute or relative pathname to a PDF document, for example, c:\work\myPDF.pdf or myPDF.pdf.

A PDF document variable in memory that is generated by the cfdocument tag or the cfpdf tag, for example, " myPDFdoc".

stopOnError

merge

Optional

Valid only if the directory attribute is specified. If the specified directory contains files other than ColdFusion-readable PDF files, ColdFusion either stops merge process or continues.

yes: stops the merge process if invalid PDF files exist in the specified directory.

no: continues the merge process even if invalid files exist in the specified directory.

transparent

thumbnail

Optional

(format="png" only) Specifies whether the image background is transparent or opaque:

yes: the background is transparent.

no: the background is opaque.

unsignall

 unsign

Optional

Unsigns all the signatures in the document.

useStructure

extracttext

Optional

Let's you extract content based on the PDF structure. For better readability of the extracted text, use this attribute together with the attribute honourspaces .

version

write

Optional

Version of the PDF
used to write the document:

1.1

1.2

1.3

1.4

1.5

1.6
For more information, see the section PDF versions.

width

sign

optional

Width of the signature field.

 

Note:

To modify the PDF source document, specify the same file pathname for the source and destination attributes, and set the overwrite attribute to yes.

Archiving a signed PDF created using ColdFusion behaves abnormally when opened using Adobe Acrobat. To fix the document for archiving enable the "Changing the Document" permission under the Security options of Acrobat.

Usage

You use the cfpdf tag to manipulate and assemble existing PDF documents. Although the cfpdf tag provides much of the functionality available in Acrobat, you cannot use this tag to generate a PDF document from another file format. To create PDF output from HTML and CFML content, use the cfdocument tag.
You cannot embed a cfpdf tag within a cfdocument tag or embed a cfdocument tag within a cfdpdf tag; however, you can write the output of a cfdocument tag to a variable and pass the variable to the cfpdf tag. The following example shows how to use the cfdocument tag to create a cover page and add it to a merged PDF document:

<!--- Use the cfdocument tag to create a cover page and write the output to a variable called 
cfdoc. ---> 
<cfdocument format="PDF" name="cfdoc"> 
<html> 
<body> 
<h1>Here is a cover page</h1> 
</body> 
</html> 
</cfdocument> 

<!--- Use the cfpdf tag and cfpdfparam tags to merge individual PDF documents into a new PDF document called new.pdf. Notice that the cfdoc variable created by using the cfdocument tag is the source value of the first cfpdfparam tag. ---> 
<cfpdf action="merge" destination="/samtemp/pdfs/new.pdf" overwrite="yes"> 
<cfpdfparam source="cfdoc"> 
<cfpdfparam source="/samtemp/pdfs/pdf2.pdf"> 
<cfpdfparam source="/samtemp/pdfs/pdf1.pdf"> 
</cfpdf>

You can use the cfpdf tag to assemble interactive PDF form files into a single PDF document and flatten forms created in Acrobat (by using the flatten attribute with the write action); however, to process PDF form data, use the cfpdfform and related tags. You cannot use the cfpdf tag to flatten forms created in Adobe LiveCycle Designer ES.

Reading and writing PDF files

The cfpdf tag provides several options for reading and writing PDF files. You can specify a PDF variable or a PDF file as the source, and you can write the output to a variable or to a file (but not both). The following table explains the read and write operations:

Task

Attributes

Example

Overwrite a source PDF file

Specify the PDF file pathname as the source and do not specify a destination.

<cfpdf action="addWatermark" source="myPDF.pdf" image="myImage.jpg">

Write a PDF document in memory to a file

Specify the PDF variable as the source and a PDF file pathname for the destination.

<cfpdf action="addWatermark" source="myPDF" image="myImage.jpg" destination="outputFile.pdf">

Write a PDF document to a new file

Specify a PDF file pathname as the source and a different PDF file pathname as the destination.

<cfpdf action="addWatermark" source="sourceFile.pdf" image="myImage.jpg" destination="outputFile.pdf">

Write a PDF file to a PDF variable

Specify the PDF file pathname as the source and a PDF variable name.

<cfpdf action="addWatermark" source="sourceFile.pdf" image="myImage.jpg" name="myPDF">

Overwrite a PDF document in memory

Specify the PDF variable name as the source and do not specify a destination.

<cfpdf action="addWatermark" source="myPDF" image="myImage.jpg">

Working with PDF files in memory

ColdFusion gives you the option to write a PDF file to a variable by using the name attribute, which is useful if you want to perform multiple operations on a document before writing it to a file. However, this is practical for small files only because of memory requirements. If you are working with large PDF documents, write the PDF documents to files.ColdFusion recommends that you do not specify the name attribute when you specify a variable as the source because it creates a copy, which increases processing. In most cases, this is unnecessary because you can reuse variables even after you write them to files.

Note:

When you use PDF variables within a try/catch block and ColdFusion generates an error, the variables are unusable after the error is generated.

Printing PDF documents

Use the cfprint tag to print PDF documents. Markups, such as sticky notes, comments, and editorial revisions, are not printed with the document.

  • addWatermark action Use the addwatermarkaction to add a watermark to specified pages in a PDF document. You can add a watermark in one of the following ways:
    • Use the first page of another PDF document as a watermark. ColdFusion overlays the copyfrom page on the source document, without enlarging the image.
    • Specify an image file to use as a watermark.
    • Specify an image in memory by using an image variable.
      The following code shows how to use the first page of a PDF document as a watermark:

<cfpdf action="addWatermark" source="c:\myBook.pdf" copyFrom="e:\yourBook.pdf" 
destination="ourBook.pdf" overwrite="yes">

By default, ColdFusion applies the watermark to all of the pages in the output file, with the watermark image centered on the page. The following code applies a JPEG image as a watermark to the first page of the output file:

<cfpdf action="addWatermark" source="Book.pdf" 
image="../cfdocs/images/artgallery/paul01.jpg" destination="newBook.pdf" pages="1" 
overwrite="yes">

To specify a ColdFusion image as a watermark, use the cfimage tag or Image functions. The addwatermark action also supports RGB and ARGB images, especially the images added using the cfimagetag and related functions. The following example converts an image to grayscale and applies it as a watermark to a PDF file:

<!--- Use the ImageNew function to create a ColdFusion image from a JPEG file. ---> 
<cfset myImage=ImageNew("../cfdocs/images/artgallery/jeff05.jpg")>

<!--- Use the ImageGrayscale function to convert the image to grayscale in memory. ---> 
<cfset ImageGrayscale(myImage)> 

<!--- Specify the image variable to apply the grayscale image as a watermark in the Book.pdf file. Because the source and destination are the same and the overwrite attribute is set to yes, ColdFusion overwrites the source file. ---> 
<cfpdf action="addWatermark" source="Book.pdf" destination="Book.pdf" overwrite="yes" image="#myImage#">

For more information on ColdFusion images, see Creating and Manipulating ColdFusion Images in the Developing ColdFusion Applications.

  • addfooterUse this action to add a footer in a PDF document. Specify the source where the PDF document is located and the destination where the new PDF document with the footer is saved, as shown in the following code snippet:

<cfpdf action = "addfooter" 
source = "../myBook.pdf" 
destination = "../myBookwithfooter.pdf" 
image = "adobelogo.JPG" // Use this attribute to add an image in the 
footer 
align = "right"> // By default, the alignemnt is center

You can also specify an image or text that you have to insert in the footer along with various other attributes such as align, bottommargin, leftmargin, numberformat, and opacity.

  • addheaderUse this action to add header in a PDF document. Specify the source and destination for the PDF document and specify the text or image that you want to insert in the header, as shown in the following code:

<cfpdf action = "addheader" 
source = "../myBook.pdf" 
destination = "../myBookwithheader.pdf" 
text = "Adobe" 
align = "left">
  • deletePages action Use the deletePagesaction to remove pages from a specified PDF document. You can specify a single page, a page range, or a comma-separated list of pages, as the following code shows:
<cfpdf action="deletePages" source="c:\myBook.pdf" pages="1,16-32,89,100-147" 
destination="myLittleBook.pdf">
  • extracttext Use the extracttextaction to extract all words from the specified page numbers in the PDF document, as shown in the following code snippet:
<cfpdf action = "extracttext" source = "../myBook.pdf" pages = "5-20, 29, 80" destination = "../adobe/textdoc.txt"
  • extractimage Use the extractimage action to extract all images from the specified page number in a PDF document, as shown in the 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 i    

  • on to extract information associated with the PDF document, such as the author, title, and creation date. You specify the name of the structure variable that contains the relevant data associated with the file, as the following code shows:

<cfpdf action="getInfo" source="myBook.pdf" name="PDFInfo"> 
<p><cfoutput>#PDFInfo.title#</cfoutput></p> 
<p><cfoutput>#PDFInfo.author#</cfoutput></p> 
<p><cfoutput>#PDFInfo.keywords#</cfoutput></p> 
<p><cfoutput>#PDFInfo.created#</cfoutput></p>

For a complete list of information elements, use the cfdumptag, as the following code shows:

<cfdump var="#PDFInfo#">
Note:

To view the permissions for a PDF document that is password-protected, specify the user password, not the owner password. If you specify the owner password, all permissions are set to Allowed.

Reducing quality of PDF document

The optimize action is used to downsample images and discard unused objects in a PDF document.

  • optimize To downsample images in a PDF document, the algos attribute is used with values bilinear, bicubic, and nearest_neighbour. The following code snippet generates a PDF after image downsampling:

<cfpdf action = "optimize" algo = "bicubic" source "..\myBook.pdf" name = #mybook#>

You can also discard unused objects such as comments, JavaScripts, attachments, bookmarks, and metadata from your PDF document using the following attributes with optimize action:

<cfpdf action = "optimize" 
noJavaScripts 
noThumbnails 
noBookmarks 
noComments 
noMetadata 
noFileAttachments 
noLinks 
nofonts>

Transforming pages in a PDF document

You can scale a page, specify the position, and rotation values for pages in a PDF document.

  • transform The transform 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:

<cfpdf action = "transform" 
required 
source = "..\myBook.pdf" 
optional 
destination = "..\new\myBook.pdf"> 
hscale = ".5" 
vscale = ".15" 
position = "8, 10" 
rotation = "180">

The value for rotation must be in steps (0, 90, 180, 270). If you specify any other value, the system generates an error.

PDF file information elements

The following table describes the information elements you can retrieve with the getinfo action:

Element

Example

Description

Application

Acrobat PDFMaker 7.0.7 for Word

Application used to create the PDF document. This value is read-only.

Author

Harper Lee

Author of the PDF document. You can specify a text string with the setInfo action.

CenterWindowOnScreen

empty string

Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element.

ChangingDocument

Not Allowed

Permissions assigned for editing the PDF content. To change this setting, use the permissions attribute with the protect action.

Commenting

Allowed

Permissions assigned for adding comments to the PDF document. To change this setting, use the permissions attribute with the protect action.

ContentExtraction

Allowed

Permissions assigned for extracting content from the PDF document. To change this setting, use the permissions attribute with the protect action.

CopyContent

Allowed

Permissions assigned for copying content from the PDF document. To change this setting, use the permissions attribute with the protect action.

Created

D:20061121155226-05'00'

System-generated creation date of the PDF document. You can specify a text string with the setInfo action.

DocumentAssembly

Not Allowed

Permissions assigned for merging the PDF document with other PDF documents. To change this setting, use the permissions attribute with the protect action.

Encryption

Password Security

Specifies whether the PDF file is password-protected. To change the encryption algorithm, or add a password, use the protect action.

FilePath

C:\ColdFusion\wwwroot\lion\myDoc.pdf

Absolute pathname for the PDF file. This value is read-only.

FillingForm

Allowed

Permissions assigned for entering data in form fields. To change this setting, use the permissions attribute with the protect action.

FitToWindow

empty string

Display setting for initial view of the PDF document. To change this setting use the processddx action with the InitialViewProfile DDX element.

HideMenubar

empty string

Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element.

HideToolbar

empty string

Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element.

HideWindowUI

empty string

Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element.

Keywords

marketing, sales, production

Keywords specified for searches in the PDF document. You can specify a comma-separated list of keywords with the setInfo action.

Language

EN-US

Language version used to create the source file for the PDF document. This value is read-only.

Modified

D:20061121155226-06'00'

System-generated timestamp for when the PDF file was last modified. You can specify a text string with the setInfo action

PageLayout

OneColumn

Display setting for the initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element.

Printing

Allowed

Permissions assigned for printing the document. To change this setting, use the permissions attribute with the protect action.

Producer

Acrobat Distiller 7.0.5 (Windows)

Version of Acrobat Distiller used to generate the PDF document. This value is read-only.

Properties

empty string

This value is read-only.

Secure

Not Allowed

Display setting that shows whether the PDF document is password protected.

ShowDocumentsOption

empty string

Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element.

ShowWindowsOption

empty string

Display setting for initial view of the PDF document. To change this setting, use the processddx action with the InitialViewProfile DDX element.

Signing

Allowed

Permissions for allowing electronic signatures to the PDF document. To change this setting, use the permissions attribute with the protect action.

Subject

Product Marketing

The subject assigned to the PDF document. You can specify a text string with the setInfo action.

Title

Chapter 1: Getting Started

The title assigned to the PDF document. You can specify a text string with the setInfo action.

TotalPages

25

Total pages in the PDF document. This value is read-only.

Trapped

empty string

Indicates whether trapping is applied to the PDF document. Trapping is used in printing to eliminate gaps between two adjoining ink colors. You can specify a text string with the setInfo action.

Version

1.6

Version of the Adobe PDF generator used to create the PDF document. To change this setting use the version attribute with the write action. For more information, see the section PDF versions.

  • merge action Use the merge action to assemble PDF documents or pages from PDF source files into one output file. The following code shows how to merge all the PDF files in a directory:
<cfpdf action="merge" directory="c:\myPDFfiles" destination="oneBigFile.pdf" 
overwrite="yes">

By default, ColdFusion adds the files in descending order by timestamp. The following code merges the source files in ascending order by filename:

<cfpdf action="merge" directory="c:\book" order="name" ascending="yes" 
destination="c:\book\output1.pdf" overwrite="yes">

This is useful if the source files have logical names, such as Chap0.pdf, Chap1.pdf, Chap2.pdf, and so on.By default, ColdFusion continues the merge process even if it encounters a file in the specified directory that is not a valid PDF document. To stop the merge process if the directory contains files other than valid PDF documents, set the stopOnError attribute to yes:

<cfpdf action="merge" directory="c:\bookfiles" destination="book.pdf" overwrite="yes" 
order="name" ascending="yes" keepBookmark="yes" stopOnError="yes">

To create a PDF file from specific pages in a document, use the source attribute with the pagesattribute. The following code creates a file from pages 1-5 of the source document:

<cfpdf action="merge" source="myBigBook.pdf" pages="1-5" destination="myShortBook.pdf" 
overwrite="yes">

To merge several files into one document, specify the absolute pathnames of the files in a comma-separated list, as the following code shows:

<cfpdf action="merge" source="c:\PDFdocs\myBook\Chap1.pdf, 
c:\PDFdocs\myBook\Chap2.pdf,c:\PDFdocs\myBook\Chap3,pdf" destination="myBook.pdf" 
package = "true" overwrite="yes">

You can now create PDF packages using the package = "true" attribute with the merge action. For more control over the order of files, to assemble files in different locations, and to extract pages from multiple PDF files, use the cfpdfparam tag with the merge action. For more information on merging PDF files, see Assembling PDF Documents in the Developing ColdFusion Applications.
If cfpdf action="merge" and package="yes", all file formats can be used as source. The following sample code has ZIP and JPEG file formats as source:

<cfpdf action="merge" package="yes" destination="./myBook/adobetest.pdf" overwrite="yes"> 
<cfpdfparam source="./inputFiles/c.zip" > 
<cfpdfparam source="./inputFiles/d.jpg" > 
</cfpdf>
  • processddx action Use the proccessddx action to assemble PDF files by processing Document Description XML (DDX) instructions. DDX is a declarative markup language used by Adobe LiveCycle Assembler. You can use DDX instructions to perform advanced tasks, such as adding table of contents pages, headers and footers, automatic page numbers, and text-string watermarks to PDF documents.ColdFusion provides a subset of LiveCycle Assembler functionality. To determine whether you can perform your tasks in ColdFusion or whether you have to purchase LiveCycle Assembler, see the tables in the following sections.
    For complete DDX syntax, see the Adobe LiveCycle Assembler Document Description XML Reference.

Supported DDX elements

The following table lists the DDX elements that ColdFusion supports:

About

Author

Background

Center

DatePattern

DDX

DocumentInformation

DocumentText

Footer

Header

InitialViewProfile

Keyword

Keywords

Left

MasterPassword

Metadata

NoBookmarks

OpenPassword

PageLabel

Password

PasswordAccessProfile

PasswordEncryptionProfile

PDF (see Note)

PDFGroup

Permissions

Right

StyledText

StyleProfile

Subject

TableOfContents

TableOfContentsEntryPattern

TableOfContentsPagePattern

Title

Watermark

 

 

Note:

ColdFusion does not support the certification and mergeLayers attributes of the PDF element.

Restricted DDX elements

New in ColdFusion 11 - The following restricted DDX elements are supported in ColdFusion 11 (Enterprise Edition).

If you are using ColdFusion 10 or earlier, the following DDX elements are excluded by ColdFusion:

ArtBox

AttachmentAppearance

Bookmarks

BlankPage

BleedBox

Comments

Description

FileAttachments

FilenameEncoding

LinkAlias

Links

NoBackgrounds

NoComments

NoFileAttchments

NoFooters

NoForms

NoHeaders

NoLinks

NoPageLabels

NoThumbnails

NoWatermarks

NoXFA

PageMargins

PageSize

PageRotation

PageOverlay

PageUnderlay

PDFsFromBookmarks

Transform

TrimBox

Simple DDX instructions

You can create DDX instructions in any text editor and save the file with a DDX extension. The following example shows the DDX instructions for merging several documents and generating a table of contents with bookmarks from the source PDF documents:

<?xml version="1.0" encoding="UTF-8"?> 
<DDX xmlns="http://ns.adobe.com/DDX/1.0/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd"> 
<PDF result="Out1"> 
<PDF source="Title"/> 
<TableOfContents/> 
<PDF source="Doc1"/> 
<PDF source="Doc2"/> 
<PDF source="Doc3"/> 
</PDF> 
</DDX>

Processing DDX instructions in ColdFusion

The following code processes the DDX instructions in ColdFusion:

<!--- The following code verifies that the DDX file exists and the DDX instructions are valid. ---> 
<cfif IsDDX("Book.ddx")> 

<!--- The following code maps the PDF source files to the PDF source variables in the 
DDX file. ---> 
<cfset inputStruct=StructNew()> 
<cfset inputStruct.Title="Title.pdf"> 
<cfset inputStruct.Doc1="Chap1.pdf"> 
<cfset inputStruct.Doc2="Chap2.pdf"> 
<cfset inputStruct.Doc3="Chap3.pdf"> 

<!--- The following code maps the PDF output file to the PDF result variable in the DDX 
file. ---> 
<cfset outputStruct=StructNew()> 
<cfset outputStruct.Out1="output.pdf"> 

<!--- The following code process the DDX instructions in the Book.ddx file to generate 
a merged document. ---> 
<cfpdf action="processddx" ddxfile="Book.ddx" inputfiles="#inputStruct#" 
outputfiles="#outputStruct#" name="ddxVar"> 
<cfelse> 
<p>The DDX instructions are not valid.</p> 
</cfif> 

<!--- The following code displays a success or failure message. ---> 
<cfoutput>#ddxVar.Out1#</cfoutput>

The name attribute defines a variable that you use to determine the success or failure of the process. Use the cfoutput tag to display the success or failure message, as the previous example shows, or use the cfdump tag to display a structure:

<cfdump var="#ddxVar#">

This code returns the following information for each output file in the structure:

  • "Successful", if the file is assembled successfully.
  • "Reason for failure", if the file is not assembled successfully and the reason for failure is known.
  • "Failure", if the file is not assembled successfully and the reason for failure is not known.
    Use the IsDDX function to determine whether a DDX file or set of instructions is valid.
    For detailed examples, see Assembling PDF Documents in the Developing ColdFusion Applications.
  • protect action Use the protect action to password-protect PDF output files, set permissions, and encrypt PDF output files. When you use the protect action, set a newUserPassword or a newOwnerPassword. (You can set both, as long as the passwords differ.) When you assign a user password to a document, all users must use this password to open the PDF document. The following code adds a user password to a PDF document:

<cfpdf action="protect" source="Finances.pdf" destination="myFinances.pdf" 
newUserPassword="keepOut">

To set the permissions on the output file, set the newOwnerPassword. A user who enters the owner password when accessing the PDF file is considered the owner of file. The following example shows how to set a new owner password:

<cfpdf action="protect" encrypt="AES_128"source="Book.pdf" destination="MysteryBook.pdf" 
overwrite="yes" newOwnerPassword="pssst" permissions="AllowDegradedPrinting">

Because the permissions are set to AllowDegradedPrinting in this example, ColdFusion lets users print the document at 150 DPI, but prohibits all other actions. If a user tries to delete the file, for example, ColdFusion generates an error message indicates that the password was entered incorrectly or the permissions do not allow the action to be performed.ColdFusion does not retain permissions: if you add a newUserPassword attribute, you also must set the permission explicitly.
To work with myVar, you specify newownerpw as the password.

PDF document passwords

A PDF document can have two kinds of passwords: a user password and an owner password. The following table describes the two types of ColdFusion passwords and their equivalents in Acrobat:

ColdFusion password

Acrobat equivalent

Description

User password

Document Open password, user password

Anyone who tries to open the PDF document must enter the password that you specify. A user password does not allow a user to change restricted features in the PDF document.

Owner password

Permissions password, master password

Lets the person who enters the password restrict access to features in a PDF document.

When you protect a PDF, your password changes to the one you provide. ColdFusion updates the variable's saved password to the one you provide. However, if you provide both passwords, ColdFusion uses the owner password. The following protects a PDF:

<cfpdf action="protect" source="myVar" password="oldpassword" 
permissions="none" newuserpassword="newuserpw" 
newownerpassword="newownerpw">

To get all the properties of the PDF, you do the following:

<cfpdf action="info" source="myVar" name="info">

To get only the properties allowed for the user, you do the following:

<cfpdf action="info" source="myVar" password=" newuserpw" name="info">

Permissions for PDF documents

The following table lists the permissions an owner can set for PDF documents:

Permissions

Description

All

There are no restrictions on the PDF document.

AllowAssembly

Users can add the PDF document to a merged document.

AllowCopy

Users can copy text, images, and other file content. This setting is required to generate thumbnail images with the thumbnail action.

AllowDegradedPrinting

Users can print the document at low-resolution (150 DPI).

AllowFillIn

Users can enter data into PDF form fields. Users can sign PDF forms electronically.

AllowModifyAnnotations

Users can add or change comments in the PDF document.

AllowModifyContents

Users can change the file content. Users can add the PDF document to a merged document.

AllowPrinting

Users can print the document at high-resolution (print-production quality). This setting is required for use with the cfprint tag.

AllowScreenReaders

Users can extract content from the PDF document.

AllowSecure

Users can sign the PDF document (with an electronic signature).

None

Users can view the document only.

Encryption for PDF documents

The encrypt attribute sets the type of encryption used for opening a password-protected document. By default, ColdFusion uses the RC4 128-bit encryption algorithm to encrypt PDF files. To change the encryption algorithm, use the encrypt attribute with the protect action. The following code encrypts the PDF output file with the AES algorithm:

<cfpdf action="protect" encrypt="AES_128" source="Book.pdf" destination="MysteryBook.pdf" 
overwrite="yes" newOwnerPassword="pssst" permissions="AllowDegradedPrinting">

ColdFusion supports the following encryption algorithms:

Encryption algorithm

Compatibility

Description

AES_128

Adobe Acrobat 7.0 and later

Advanced Encryption Standard (AES) specifies the Rijndael algorithm, a symmetric block cipher that can process data blocks of 128 bits. This is the highest encryption level.
This encryption algorithm lets users do the following:

  • Encrypt all document contents.
  • Encrypt all document contents except for the metadata.
  • Encrypt only the file attachments.

RC4_128M

Adobe Acrobat 6.0 and later

RC4 specifies the RSA Security software stream cipher for algorithms such as Secure Sockets Layer (SSL), to protect Internet traffic, and WEP, to secure wireless networks.
This encryption algorithm lets users do the following:

  • Encrypt all document contents.
  • Encrypt all document contents except for the metadata.

RC4_128

Adobe Acrobat 5.0 and later

RC4 128-bit encryption. This encryption algorithm lets users encrypt the document contents, but not the document metadata.

RC4_40

Adobe Acrobat 3.0 and later

RC4 40-bit encryption. This is the lowest encryption level.

None

-

The document is not encrypted.

Note:

Document metadata is used in Internet searches. If the metadata is encrypted, search engines cannot search the PDF document. Users running an earlier version of Acrobat cannot open a PDF document with a higher encryption setting. For example, if you specify AES 128 encryption, a user cannot open the document in Acrobat 6.0 or earlier.

  • read action Use the read action to read the source PDF document into the namevariable, as the following code shows:
<cfif IsPDFFile("Book.pdf")> 
<cfpdf action="read" source="Book.pdf" name="myBook"> 
... 
</cfif>
  • removeWatermark action Use the removewatermarkaction to remove a watermark from a PDF document or specified pages in a document. The following example removes a watermark from the first page of a PDF document and writes the output to a new file:
<cfpdf action="removeWatermark" source="Book.pdf" pages="1" destination="newBook.pdf" overwrite="yes">
  • removeheaderfooter action Use this action to remove the header and footer from a PDF document or from specified pages in a document. The following example removes the header and footer from the entire document:
<cfpdf action = "removeheaderfooter" source="..\mybook.pdf" destination = "new.pdf">
  • setInfo action Use the setinfo action to specify information associated with a PDF document to be saved with it. Create a structure that contains the relevant information. Use the info attribute of the cfpdf tag to refer to the structure. The following code shows the elements that you can modify by using the setInfoaction:
<cfset PDFinfo=StructNew()> 
<cfset PDFinfo.Title="Make Way for Ducklings"> 
<cfset PDFinfo.Author="Donald Duck"> 
<cfset PDFinfo.Keywords="Huey,Dewy,Louie"> 
<cfset PDFinfo.Subject="Ducks"> 
<cfpdf action="setInfo" source="chap1.pdf" info="#PDFinfo#" destination="meta1.pdf" overwrite="yes">
  • thumbnail action Use the thumbnail action to generate thumbnail images from the source PDF document.
    If you do not specify a destination directory for the thumbnail files, ColdFusion creates a directory for the thumbnails in the directory where the CFM page is located. If you specify a filename as the source, the thumbnail directory name is a concatenation of the name of the source file and _thumbnails. For example, the following code generates a thumbnail image for each page in myBook.pdf and stores them in a directory called myBook_thumbnails:
<cfpdf action="thumbnail" source="myBook.pdf">

If the CFM page is located in the directory c:\myProject\genThumbnails.cfm, the pathname for the thumbnails directory is c:\myProject\myBook_thumbnails.By default, ColdFusion generates thumbnail files in JPEG format and the images are scaled to 25% of the original.
You can specify individual pages within the source document to generate thumbnails. Also, you can change the size of the thumbnail; the resolution, the output format (JPEG, PNG, or TIFF); and the prefix used for the thumbnail filenames. The following code generates a low-resolution thumbnail from the first page of the source document that is scaled at 50% of the original size:

<cfpdf action="thumbnail" source="myBook.pdf" pages="1" destination="c:\myBook\images" 
imagePrefix="Cover" format="png" scale="50" resolution="low">

The full output file pathname is as follows:

c:\myBook\images\Cover_page_1.png

Note:

To generate thumbnail images, the permissions of the source document must include AllowCopy. For more information, see Permissions for PDF documents in cfpdf.

With ColdFusion 9, the following new attributes were introduced for the thumbnail action:

  • hires: You can set this attribute to true to extract high-resolution images from the page. If a document contains high-resolution images and you want to retain the resolution of the images, then this attribute is useful.
    For example:

<cfpdf action="thumbnail" source="./WORK/myBook.pdf" destination="./WORK/Testing_CFPDF" overwrite="true" hires="yes">
  • overridepage: If you set this attribute to true, the thumbnail generated does not adhere to the PDF page size, but to the image size that is present in that page. If the image is not present, the size is set to the maximum size of the page.
  • compresstiffs: Use this attribute to compress the size of the thumbnail images. As the name of the attribute suggests, it is only valid for the TIFF format. Following is an example:

<cfpdf action="thumbnail" source="C:\WORK\myBook.pdf" destination="C:\WORK\Testing_CFPDF" overwrite="true" hires="yes" format="tiff" compresstiffs="yes">
  • maxscale : Use this attribute to specify an integer value for the maximum scale of the thumbnail images.
  • maxlength: Use this attribute to specify an integer value of the maximum length of the thumbnail images.
  • maxbreadth: Use this attribute to specify an integer value of the maximum width of the thumbnail.
    The following example illustrates the use of maxscale, maxlength, and maxbreadth:

Note: Typically, the value of the scale attribute is set to 100 when using the maxscale attribute.

  • write action Use the writeaction to write the source PDF document, or the PDF document stored in memory as a variable, to a file. The following code converts a PDF file stored in memory to a different PDF version and writes the output to a new file:
<cfpdf action="read" source="Book.pdf" name="myBook"> 
<cfpdf action="write" source="myBook" destination="myBook1.pdf" 
version="1.4">

You can now use either name or destination attributes with the write action. The name attribute takes the value as the PDF document variable. For example, you can write the preceding code snippet as:

<cfpdf action="read" source="Book.pdf" name="myBook"> 
<cfpdf action="write" source="myBook" name=#myBook# 
version="1.4">

The new encodeall attribute encodes all the unencoded streams in the source. However, it does not discriminate between dumb encodings like LZW and encodings like flate, so only unencoded streams get flateencoded.

Note:

You can now register thumbnail fonts using the font management screen.

PDF versions

Change the PDF version so that users running an older version of Acrobat or Adobe Reader can open the file. The following table shows the compatibility between the PDF version and the corresponding Acrobat and Adobe Reader versions:

PDF version

Compatibility

1.1

Acrobat and Adobe Reader 2

1.2

Acrobat and Adobe Reader 3

1.3

Acrobat and Adobe Reader 4

1.4

Acrobat and Adobe Reader 5

1.5

Acrobat and Adobe Reader 6

1.6

Acrobat and Adobe Reader 7

To linearize PDF documents for faster web display, set the saveOption attribute to linear, as the following code shows:

<cfpdf action="write" source="myBook" destination="myBook1.pdf" saveOption="linear" 
overwrite="yes">

Do not use the linear save option if you have to maintain interactivity in PDF forms or if the PDF document is enabled for electronic signatures. To allow for electronic signatures, set the saveOption attribute to incremental, as the following code shows:

<cfpdf action="write" source="myDraft" destination="mySignedDoc.pdf" 
saveOption="incremental" overwrite="yes">

Use the flatten attribute to flatten forms created in Acrobat:

<cfpdf action="write" source="myAcrobatForm.pdf" 
destination="myFlatForm.pdf" flatten="yes" overwrite="yes">
Note:

ColdFusion does not support flattening forms created in Adobe LiveCycle. For more information about forms created in LiveCycle and Acrobat, see Manipulating PDF Forms in ColdFusion in the Developing ColdFusion Applications.

Example

The following example generates thumbnail images from pages in a PDF document and links the thumbnail images to the pages in the PDF document:

<h3>PDF Thumbnail Demo</h3> 

<!--- Create a variable for the name of the PDF document. ---> 
<cfset mypdf="myBook"> 
<cfset thisPath=ExpandPath(".")> 
<!--- Use the getInfo action to retrieve the total page count for the 
PDF document. ---> 
<cfpdf action="getInfo" source="#mypdf#.pdf" name="PDFInfo"> 
<cfset pageCount="#PDFInfo.TotalPages#"> 

<!--- Generate a thumbnail image for each page in the PDF source document, 
create a directory (if it doesn't already exist) in the web root that is 
a concatenation of the PDF source name and the word "thumbnails", and 
save the thumbnail images in that directory. ---> 
<cfpdf action="thumbnail" source="#mypdf#.pdf" overwrite="yes" 
destination="#mypdf#_thumbnails" scale=60> 

<!--- Loop through the images in the thumbnail directory and generate a link 
from each image to the corresponding page in the PDF document. ---> 
<cfloop index="LoopCount" from ="1" to="#pageCount#" step="1"> 
<cfoutput> 
<!--- Click the thumbnail image to navigate to the page in the PDF 
document. ---> 
<a href="#mypdf#.pdf##page=#LoopCount#" target="_blank"> 
<img src="#mypdf#_thumbnails/#mypdf#_page_#LoopCount#.jpg"></a> 
</cfoutput> 
</cfloop>

Archiving PDF documents 

Introduced in ColdFusion 11: Use the action type=”archive” to archive the PDF files based on the ISO's PDF/A standards.PDF/A  is one set of standards among a  suite of PDF-based standards managed by the International Organization for Standardization (ISO). It was developed to enable the long-term preservation of electronic documents and provides specifications for the creation, viewing, and printing of PDF documents, with the intent of preserving final documents of record as self-contained documents.  The standard does not define an archiving strategy or the goals of an archiving system. Rather, it identifies a "profile" for a PDF file that makes it possible to reproduce the visual appearance of the document the exact same way in the future. This profile specifies what must be included in the file, while prohibiting features that are not suitable for long-term archiving.

<!---- Create an archived pdf from source pdf ---à
<cftry>
<cfpdf action="archive" source="#sourcefilename#" destination="#destinationfilename#" overwrite="true" />
<cfcatch>
<cfoutput>#cfcatch.detail#</cfoutput><br><br>
</cfcatch>
</cftry>

Digitally signing the documents

Introduced in ColdFusion 11: Use the action =”sign”,”unsign”,”validatesignature”,"readsignaturefields" for creating a digital signature, removing the digital signature, validating the signatures of a document, and for reading the signature fields respectively.

  • For action =”sign”, the following attributes are available:
    • keystore attribute(Required):The location of the keystore file. For example:C:\OpenSSL\bin\keystore.jks.
    • keystorepassword attribute (Required): The password for the keystore.
    • keyalias attribute (Optional):Alias of the key with which the certificate and private key are stored in the keystore. If it is not specified, the first entry in the keystore is chosen as the alias.
    • keypassword attribute (Optional):Password for your private key. If not specified, the keystorepassword is used.
  • author attribute (Optional): If true, generates an authored signature. If false, then generate an ordinary signature.
<!---- Sign a specific pdf by creating a signature field and signing it with authoured signature -->
<cfpdf action="sign"
source="#inputfilepath##inputfilename#"
destination="#signedfilepath##signedfilename#"
keystore="#certpath#cert.pfx" keystorepassword="certpass"
overwrite="true" pages="1" height="100"
width="100" position="100,100" author="false"
/>
  • For action =”sign” and "unsign", the following attribute is available:
  • signaturefieldname attribute(Optional):Fully qualified name of the existing field on which the user wants to sign (or) the signature field which has to be unsigned.
<!---- Sign a specific signature field in a input pdf ---->
<cfpdf action="sign"
source=”#inputfilepath##inputfilename#"
destination="#signedfilepath##signedfilename#"
keystore="#certpath#cert.jks" keystorepassword="password"
overwrite="true" author="true"
signaturefieldname="sign_me"/>
  • For action =”unsign”, the following attribute is available:
  • Unsignall attribute (Optional): If true, then will unsign all signature fields in the source document.
<cfpdf action="unsign" source="../cfpdf_normalPDFSign.pdf" destination="../results/cfpdf_normalPDFSign.pdf" unsignall="true" overwrite="true">
  • For action =”validatesignature”, the following attribute is available:
  • Name attribute which will store the resultant structure of this operation. It consists of two elements. One is the boolean field which indicates whether all signatures have been deemed valid or not. The second is an array list consisting of the names of all the signatures which were invalid.
<cfpdf action="validatesignature" source="../cfpdf_normalPDFSign.pdf" name="pdfInfo">
<cfoutput>#pdfInfo.SUCCESS#</cfoutput>
  • For action =”readsignaturefields”:
  • Reads all the signature fields and returns a query object in the variable indicated by attribute name. This query object will have five columns. The five columns are:

a) Signed - fully qualified name of the signature field.

b) Authored - indicates if this field can contain an author signature or not.

c) Can_Be_Signed - whether this field can be signed.

d) Can_Be_Authored - tells if this field is already signed or not 

e) Visible - tells if the field is visible.

<!--- Read info about signature fields in a 
input pdf in a variable and dump it --->
<cfpdf action="readsignaturefields"
source="#filepath##inputfilename#" name="signinfo"
password="owner" />
<cfdump var=”#signinfo#”/>

Examples

addAttachments

<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destinationfile="#ExpandPath('file_result.pdf')#">

<cftry>
 <cfpdf action="addAttachments" source="#sourcefile#" destination="#destinationfile#" overwrite="true">
  <cfpdfparam source="#ExpandPath('file1.txt')#" filename="attachment1.txt" Encoding="ASCII" description="file attachment one">
  <cfpdfparam source="#ExpandPath('file2.txt')#" filename="attachment2.txt" Encoding="UTF-16" description="file attachment one"></cfpdfparam>
 </cfpdf>
 <cfcatch type="any">
  <cfdump var="#cfcatch#">
 </cfcatch>
</cftry>

Output

addFooter

<!--- image as footer --->

<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_footer.pdf')#">
<cfpdf action="addfooter" 
  source="#sourcefile#" 
  destination="#destfile#"
  image="adobe.png" 
  overwrite="yes" 
>

<!--- text as footer --->

<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_footer.pdf')#">
<cfpdf action="addfooter" 
  source="#sourcefile#" 
  destination="#destfile#"
  text="This is a sample footer" 
  align="center" 
  overwrite="yes" 
>

Output

addHeader

<!--- text as header --->

<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_header.pdf')#">
<cfpdf action="addheader" 
  source="#sourcefile#" 
  destination="#destfile#"
  text="This is a sample header" 
  align="center" 
  overwrite="yes" 
>

<!--- image as header --->

<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_header.pdf')#">
<cfpdf action="addheader" 
  source="#sourcefile#" 
  destination="#destfile#"
  image="adobe.png"
  overwrite="yes" 
>

Output

addStamp

<cfset sourcefile=ExpandPath('addStamp.pdf')/>
<cfset destinationfile=ExpandPath("addStamp_result.pdf")/>
<cftry>
 <cfpdf action="addStamp" source="#sourcefile#" destination="#destinationfile#" overwrite="true">
  <cfpdfparam pages="2" coordinates = "397,532,519,564" iconname="Approved" note="stamp1">
  <cfpdfparam pages="3-4" coordinates = "397,532,519,564" iconname="Experimental" >
  <cfpdfparam pages="5" coordinates = "397,532,519,564" iconname="NotApproved" >
  <cfpdfparam pages="6" coordinates = "397,532,519,564" iconname="AsIs" note="stamp2">
  <cfpdfparam pages="7-8" coordinates = "397,532,519,564" iconname="Expired" note="stamp3">
  <cfpdfparam pages="9" coordinates = "397,532,519,564" iconname="NotForPublicRelease" >
  <cfpdfparam pages="10" coordinates = "397,532,519,564" iconname="Confidential" >
  <cfpdfparam pages="11" coordinates = "397,532,519,564" iconname="Final" note="stamp4">
  <cfpdfparam pages="12" coordinates = "397,532,519,564" iconname="Sold">
  <cfpdfparam pages="13" coordinates = "397,532,519,564" iconname="Departmental" note="stamp1">
  <cfpdfparam pages="14" coordinates = "397,532,519,564" iconname="Draft">
  <cfpdfparam pages="15" coordinates = "397,532,519,564" iconname="ForPublicRelease">
  <cfpdfparam pages="16" coordinates = "397,532,519,564" iconname="TopSecret">
  <cfpdfparam pages="17" coordinates = "397,532,519,564" iconname="ForComment">
 </cfpdf>
<cfcatch  name="myvar">
 <cfdump  var="#myvar#">
</cfcatch>
</cftry>

Output

addWatermark

<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_watermark.pdf')#">
<cfpdf action="addwatermark" source="#sourcefile#"  
  destination="#destfile#" 
  image="image.png"
  pages="1-2"
  overwrite="yes">

Output

archive

<!--- archive standard=2b --->

<cfset sourcefile="#ExpandPath('hello.pdf')#"/>
<cfset archivedfile="#ExpandPath('Hello_archived.pdf')#"/>

<cftry>
 <cfpdf action="archive" source="#sourcefile#" destination="#archivedfile#" standard="2b" overwrite="true"/>
 <cfcatch name="myvar">
  <cfdump var="#myvar#">
 </cfcatch>
</cftry>

<!--- archive standard=3b --->

<cfset sourcefile="#ExpandPath('hello.pdf')#"/>
<cfset archivedfile="#ExpandPath('Hello_archived.pdf')#"/>

<cftry>
 <cfpdf action="archive" source="#sourcefile#" destination="#archivedfile#" standard="3b" overwrite="true"/>
 <cfcatch name="myvar">
  <cfdump var="#myvar#">
 </cfcatch>
</cftry>


Output

You can check the archiving of any file in Acrobat by going to:

Tools -> Print Production -> Pre Flight -> PDF/A Compliance -> [Verify compliance with

PDF/A-2b or Verify compliance with PDF/A-3b]. This will tell if PDF is compliant/ archived with the given standard or not.

deletePages

<cfset sourcefile="#ExpandPath('file.pdf')#">
<cfset destfile="#ExpandPath('file_pages_deleted.pdf')#">
<cfpdf action="deletepages" 
  pages="5-10" 
  source="#sourcefile#" 
  destination="#destfile#" 
  overwrite="yes"
>

export comment

<cfset sourcefile=ExpandPath("comment.pdf")/>
<cfset destinationfile=ExpandPath("comment_exported.fdf")/>
<cfpdf action="export" 
  type="comment" 
  source="#sourcefile#" 
  exportto="#destinationfile#" 
  overwrite="true" 
>

Output

export metadata

<cfset sourcefile="#ExpandPath('metadata.pdf')#"/>
<cfset destinationfile="#ExpandPath('metadata_exported.xmp')#"/>

<cfpdf action="export" 
  type="metadata" 
  source="#sourcefile#" 
  exportto="#destinationfile#" 
  overwrite="true"
>

Output

extractImage

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action = "extractimage" 
  source = "#sourcefile#" 
  pages = "1-20" 
  destination = "images" 
  imageprefix = "cf_" 
  format="jpg" 
  overwrite="yes"
>

extractText

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action="extracttext" 
  source="#sourcefile#" 
  name="myXML" 
  pages="1-10" 
  overwrite="yes" 
>
<cfcontent type="text/xml" />
<cfoutput>#myXML#</cfoutput>

getInfo

<cfset sourcefile=ExpandPath("coldfusion.pdf")/>
<cfpdf action="getInfo" source="#sourcefile#" name="PDFInfo">
<cfdump var="#PDFInfo#" >

Output

import comments

<cfset sourcefile="#ExpandPath('noComment.pdf')#"/>
<cfset destinationfile="#ExpandPath('withComment.pdf')#"/>
<cfset importfromfilename = "#ExpandPath('comment_exported.xfdf')#">
<cfpdf action="import" 
  type="comment" 
  source="#sourcefile#" 
  importfrom="#importfromfilename#" 
  destination="#destinationfile#" 
  overwrite="true"
>

Output

import metadata

<cfset sourcefile="#ExpandPath('noMetadata.pdf')#"/>
<cfset destinationfile="#ExpandPath('metadataImported.pdf')#"/>
<cfset importfromfilename = "#ExpandPath('metadata_exported.xmp')#">

<cftry>
 <cfpdf action="import" type="metadata" source="#sourcefile#" 
 importfrom="#importfromfilename#" destination="#destinationfile#" overwrite="true" >
 <cfcatch name="mycatch">
  <cfdump var="#mycatch#" >
 </cfcatch>
</cftry>

merge

Merge using a list of pdfs.

<cfset source1="#ExpandPath('coldfusion.pdf')#"/>
<cfset source2="#ExpandPath('security.pdf')#"/>
<cfset source3="#ExpandPath('sessionsecurity.pdf')#"/>
<cfset desfile="#ExpandPath('merged.pdf')#"/>

<cfpdf action="merge" 
  source="#source1#,#source2#,#source3#"
  destination="#desfile#" 
  overwrite="yes"
>

Merge pdfs using cfpdfparam

<cfset source1="#ExpandPath('coldfusion.pdf')#"/>
<cfset source2="#ExpandPath('security.pdf')#"/>
<cfset source3="#ExpandPath('sessionsecurity.pdf')#"/>
<cfset desfile="#ExpandPath('merged_new_PDF.pdf')#"/>
<cfpdf action="merge" destination="#desfile#" overwrite="yes">
    <cfpdfparam source="#source1#" pages="1-5"/>
    <cfpdfparam source="#source2#" pages=2 />
    <cfpdfparam source="#source3#" pages="3-6" />
</cfpdf>

optimize

Using the Nearest Neighbor algorithm, which is the default.

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('optimized_nn.pdf')#"/>
<cfpdf action="optimize" source="#sourcefile#" destination="#desfile#" algo="Nearest_Neighbour" overwrite="yes">

Using the bilinear algorithm.

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('optimized_biliear.pdf')#"/>
<cfpdf action="optimize" source="#sourcefile#" destination="#desfile#" algo="bilinear" overwrite="yes">

Using the bicubic algorithm.

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('optimized_bicubic.pdf')#"/>
<cfpdf action="optimize" source="#sourcefile#" destination="#desfile#" algo="bicubic" overwrite="yes">

processDDX

merge.ddx

<?xml version="1.0" encoding="UTF-8"?> 
<DDX xmlns="http://ns.adobe.com/DDX/1.0/"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://ns.adobe.com/DDX/1.0/ coldfusion_ddx.xsd"> 
<PDF result="Out1"> 
<PDF source="Doc1"/> 
<PDF source="Doc2"/> 
</PDF> 
</DDX>

processDDX .cfm

<cfset source1="#ExpandPath('security.pdf')#"/>
<cfset source2="#ExpandPath('sessionsecurity.pdf')#"/>
<cfset outfile="#ExpandPath('book.pdf')#"/>
<cfset ddxloc="#ExpandPath('merge.ddx')#"/>

<!--- This code creates a structure for the input files. ---> 
<cfset inputStruct=StructNew()> 
<cfset inputStruct.Doc1="#source1#"> 
<cfset inputStruct.Doc2="#source2#">

<!--- This code creates a structure for the output file. --->
<cfset outputStruct=StructNew()>
<cfset outputStruct.Out1="#outfile#">

<!--- This code processes the DDX instructions and generates the book. --->
<cfpdf action="processddx" ddxfile="#ddxloc#" inputfiles="#inputStruct#" outputfiles="#outputStruct#" name="myBook">
<cfdump var="#myBook#">

protect

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfset desfile="#ExpandPath('coldfusion_protected.pdf')#"/>
<cfpdf action="protect" 
  source="#sourceFile#" 
  destination="#desfile#"
  newUserPassword="password"
>

Output

read

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#"/>
<cfpdf action="read" name="myBook" source="#sourcefile#" >
<cfdump var="#myBook#" >

Output

redact

<cfset sourcefile=ExpandPath('redact.pdf')/>
<cfset destinationfile=ExpandPath("redact_result.pdf")/>

<cfpdf action="redact" source="#sourcefile#" destination="#destinationfile#" overwrite="true">
 <cfpdfparam pages="1,2" coordinates="306,426,366,496" >
 <cfpdfparam pages="3" coordinates="100,100,400,400">
 <cfpdfparam pages="*" coordinates="0,0,100,100">
</cfpdf>

Output

removeHeaderFooter

<cfset sourcefile=ExpandPath('coldfusion_header_footer.pdf')/>
<cfset desfile=ExpandPath('coldfusion_no_header_footer.pdf')/>
<cfpdf action = "removeheaderfooter" 
  source="#sourcefile#" 
  destination = "#desfile#" 
  pages="1-5" 
  overwrite="yes" 
>

removeWatermark

<cfset sourcefile=ExpandPath('coldfusion_watermark.pdf')/>
<cfset desfile=ExpandPath('coldfusion_no_watermark.pdf')/>
<cfpdf action = "removewatermark" 
  source="#sourcefile#" 
  destination = "#desfile#" 
  pages="3-5" 
  overwrite="yes" 
>

sanitize

<cfset sourcefile="#ExpandPath('CF_Hotfix.pdf')#"/>
<cfset destinationfile="#ExpandPath('CF_Hotfix_Sanitized.pdf')#"/>
<cfpdf action="sanitize" 
  source="#sourcefile#" 
  destination="#destinationfile#" 
  overwrite="true" 
>

Output - before sanitization

Output - after sanitization

setInfo

<cfset PDFinfo=StructNew()> 
<cfset PDFinfo.Title="Apply Hotfixes to ColdFusion"> 
<cfset PDFinfo.Author="ColdFusion Developer"> 
<cfset PDFinfo.Keywords="ColdFusion,Update, Hotfix, Security Update"> 
<cfset PDFinfo.Subject="ColdFusion Hotfixes">
<cfset sourcefile="file.pdf"/>
<cfset desfile="file_info.pdf"/>
<cfpdf action="setInfo" 
 source="#sourcefile#" 
 info="#PDFinfo#" 
 destination="#desfile#" 
 overwrite="yes"
>

Output

sign

Create a Keystore and generate a key pair. Answer each question when prompted.

keytool - genkey -alias pdfdomain - keyalg RSA - keystore KeyStore.jks - keysize 2048

Generate a CSR based on the new keystore .

keytool - certreq -alias pdfdomain - keystore KeyStore.jks -file pdfdomain . csr

<!---- Sign a specific pdf by creating a signature field and signing it with authoured signature --->
<cfset sourcefile=ExpandPath('coldfusion.pdf')/>
<cfset destinationfile=ExpandPath("cf_signed.pdf")/>
<cfset pathtokeystore=ExpandPath("KeyStore.jks")/>

<cfpdf action="sign"
  source="#sourcefile#"
  destination="#destinationfile#"
  keystore="#pathtokeystore#" 
  keystorepassword="password"
  overwrite="true" 
  pages="1" 
  height="100"
  width="100" 
  position="100,100" 
  author="true"
>

Output

thumbnail

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action="read" name="myDoc" source="#sourcefile#" />
<cfpdf action="thumbnail" source="myDoc" destination="C:\cfpdf\" overwrite="yes" />
<cfimage action="read" name="img" source="C:\cfpdf\thumbnail_page_1.jpg" format="jpg" />

Output

transform

<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfset desfile="#ExpandPath('coldfusion_transformed.pdf')#">
<cfpdf action = "transform"
source = "#sourcefile#"
destination = "#desfile#" 
hscale = ".5"
vscale = ".8"
position = "8, 10"
rotation = "180"
overwrite="yes" 
>

Output

unsign

<cfset sourcefile=ExpandPath('cf_signed.pdf')/>
<cfset destinationfile=ExpandPath("cf_unsigned.pdf")/>
<cfpdf action="unsign" 
 source="#sourcefile#" 
 destination="#destinationfile#" 
 unsignall="true" 
 overwrite="true"
>

Output

validatesSignature

<cfset sourcefile="#ExpandPath('cf_signed.pdf')#">
<cfpdf action="validatesignature" source="#sourceFile#" name="pdfInfo">
<cfoutput>#pdfInfo.SUCCESS#</cfoutput> <!--- returns YES --->

write

<!--- write the properties of the PDF --->
<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfpdf action="write" 
 source="#sourcefile#" 
 name="PDFout" 
 overwrite="yes">
<cfdump var="#PDFout#" >
<!--- Write the PDF document to another PDF --->
<cfset sourcefile="#ExpandPath('coldfusion.pdf')#">
<cfset desfile="#ExpandPath('coldfusion_write.pdf')#">
<cfpdf action="write" 
 source="#sourcefile#" 
 destination="#desfile#"
 overwrite="yes"
>

 Adobe

Get help faster and easier

New user?