Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


PDF creation - page break issue on table

New Here ,
Aug 28, 2012 Aug 28, 2012

Copy link to clipboard

Copied

I'm trying to generate PDF from a database.

I display my data in tables that can be 2 or 3 rows or sometimes 100 rows and multiple sheets.  Problem is, the tables often break mid row.   Which would be fine, but then on the next page, the table is 'open' with no top border.

I have tried two methods so far:

1. CFDocument creating PDF.  I am having a difficult time with the lack of normal CSS control.  I can't seem to get it to look right.

2.  Create a normal page, then print to PDF.  I like this method, because I have a lot more control on the look of the tables.

Both of these methods result in the pagination issue.

So, my question is:

1.  Is there a solution to either of these on the pagination?

2.  Is there another method that I am unaware of?

I thank you in advance for your consideration.

Views

1.8K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 28, 2012 Aug 28, 2012

Copy link to clipboard

Copied

Here is what it looks like:

This is actually another option I tried - flashpaper then print to PDF.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 29, 2012 Aug 29, 2012

Copy link to clipboard

Copied

Hi Dan,

If I understand what you are trying to accomplish, try the example code below:

The example assumes there are 30 total records and you want to display only 10 per page. You will need to add additional <cfif>(s) to accommodate what you to believe to be the maximum number of records to be.

Hope this helps you out.

Leonard B

===== Example Code =====

<!--- Insert header content here --->

>> Will display first 10 records on page 1

<cfoutput query="rsRecords" startrow="1" maxrows="10">

#NumberFormat(currentrow,00)# - #BillName#<br />

</cfoutput>

>> Will display second set of 10 records on page 2

<cfif rsRecords.RecordCount gt 10>

<cfdocumentitem type="pagebreak" />

    <!--- Insert header content here --->

    <cfoutput query="rsRecords" startrow="11" maxrows="10">

    #NumberFormat(currentrow,00)# - #BillName#<br />

    </cfoutput>

</cfif>

>> Will display third set of 10 records on page 3

<cfif rsRecords.RecordCount gt 20>

<cfdocumentitem type="pagebreak" />

    <!--- Insert header content here --->

    <cfoutput query="rsRecords" startrow="21" maxrows="10">

    #NumberFormat(currentrow,00)# - #BillName#<br />

    </cfoutput>

</cfif>

Below will display current page number and total page number along with date and time printed

<!--- Footer section for each generated page --->

<cfdocumentitem type="footer">

Page <cfoutput>#cfdocument.currentpagenumber#</cfoutput> of <cfoutput>#cfdocument.totalpagecount#</cfoutput> &mdash; Printed <cfoutput>#DateFormat(CreateODBCDate(now()),"mm/dd/yy")# at #TimeFormat(CreateODBCTime(now()),"h:mm:ss tt")#</cfoutput>

</cfdocumentitem>

</cfdocument>

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 13, 2012 Sep 13, 2012

Copy link to clipboard

Copied

LATEST

Thanks Leonard.

I do this programming on the side, if boss understood how important this will be, he'd give me more time.   Anyhow, I am getting back now to tackle this issue.

The problem with this solution is that I don't know how big each of the items are going to be.   They may be 4 lines as I have shown, but in cases they will be 20 lines.

I think my solution will be to have a temp variable to hold the item number after the page break.  THat is the user will create the doc, and then decide he wants a page break after item #7.  He will then click #7 and rerun.  Then click #23, and so on until he is done.  Bit awkward but it will do the trick.  

Wish there was some way I could measure where on the PDF sheet I was at all times.  Then when I'm near the bottom I can <cfif> something to put in a page break.   hmmmm.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines