Skip to main content
Inspiring
October 30, 2020
Question

PDF creation with multiple pages

  • October 30, 2020
  • 0 replies
  • 197 views

I need to generate an invoice pdf. This invoice can have 1 to hundreds of items and each item description is different. One item can take up 1 line and another could be 9 lines. So, using a mod value based on the number of items doesn't solve the pagebreak issue. If just say show 5 records per page, these 5 records can barely take up space on a page or can take  up more than 1 page. 

 

I'm using CF 2018. 

I use cfdocument that generate a pdf from HTML/CSS formatted page. Right now counting characters item description gets me closer to what I need it's still doesn't work 100% of the time. 

This is my code estimate the number of lines used by item description:

<cfset ProductDescriptionNumberOfLines = ceiling(Evaluate(len(Description)/33)) >
then pagebreak is based on that. 
 
Here's an old post seems to be asking for the same solution:
    This topic has been closed for replies.