Skip to main content
montefuscom
Participant
August 11, 2016
Question

When does a page break occur - cfdocument?

  • August 11, 2016
  • 1 reply
  • 681 views

I am looking to see if there is a solution out there using Coldfusion 11:

If a pdf document is created with cfdocument tag, is there a way to tell if/when a page break occurs while the pdf is being created? ...  Keeping in mind the content of the document varies...??  I am not aware of a way to accomplish this so any info would be greatly appreciated...

Thanks

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
August 12, 2016

You could do something like this. Place the cfdocumentitem tag at the top.

<cfset pagecount = 0>

<cfdocument format="PDF">

<cfdocumentitem type= "header">

<cfif cfdocument.currentpagenumber GT pagecount>

     Start of new page: <cfoutput>#cfdocument.currentpagenumber#</cfoutput>

     <cfset pagecount = pagecount+1>

</cfif>

  </cfdocumentitem>

</cfdocument>