Skip to main content
montefuscom
Participant
Aug 11, 2016 7:54 PM UTC
Question

When does a page break occur - cfdocument?

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 is closed to new replies. Start a new post to keep the conversation going.

1 reply

BKBK
Community Expert
Community Expert
Aug 12, 2016 5:03 AM UTC

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>

Translate