This topic is locked
[SOLVED]

 page break after record

9/13/2006 12:28:03 PM
PHPRunner General questions
T
thesofa author

Hi

I am printing some records out from the database with a printer friendly page.

My current setup is a vertical layout of 6 fields with 2 records per row.

How can I make sure that the records are not split over 2 pages?

I still want to use as little paper as possible, but the first page looks fine in the preview, the next page does not have the page heading on it so the records wrap over the page.

All suggestions very gratefully acccepted.

Cheers
After looking at this more closely, If I can force the page break after 4 records in each of the 2 columns, that would do the trick!

Cheers

T
thesofa author 9/15/2006

has anyone any idea how to do this please

I have had to "massage" the settings for the TR value in the output file, each time I rebuild I have to remember to change it again, then when I swap printer, it all goes wrong again!

No wonder I am bald.

<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=11082&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

J
Jane 9/15/2006

Hello,
it's impossible to change printer-friendly page and insert page break in it because there is no such thing as the page break in HTML.

kujox 9/15/2006

Put this in where you need the page break
echo "<p style=\"page-break-before: always\">\n";
I use it in the printer friendly page as each record is displayed on a single page.

T
thesofa author 9/15/2006

Put this in where you need the page break

echo "<p style=\"page-break-before: always\">\n";
I use it in the printer friendly page as each record is displayed on a single page.



Thanks for that, but i need to have a printed page of 5 rows with 2 records set vertically in each row, then the page must break.

I have faffed around abnd got it to be vaguely stable for about 20 pages, but one line in the record going into word wrap and it is borked!

I have wondered about setting up a counter and using modulus arithmatic to determine when I have 10 records from the array, but then I would have to write custom printer code.

kujox 9/16/2006

In the printer friendly page there's a loop loopRs it looks like this already has the record counter $iNumberOfRows that you need for the 10 records. Just put your layout for each record in a function called from here.
Another idea could be to use CSS to give each of the 10 records a class ranging from 1 to 10 which would place it in the correct position on the page with $iNumberOfRows holding the class number. You could also make the text size slightly smaller which should help on the wrap round problem.

T
thesofa author 9/17/2006

Cracked it at last, or sort of

look in XXX_print.php for these lines

<?php $iNumberOfRows = $iNumberOfRows + 1; ?>

</td></tr></table>



and add after the last line

<?php

$aa=$iNumberOfRows % 8;

if ($aa==7)

echo "<p style=\"page-break-after: always\">\n";

?>



so the whole part looks like this

<?php $iNumberOfRows = $iNumberOfRows + 1; ?>

</td></tr></table>

<?php

$aa=$iNumberOfRows % 8;

if ($aa==7)

echo "<p style=\"page-break-after: always\">\n";

?>



It is not too pretty, but it allows me 8 records per pageand no more split records.

I do get some of the borders from the nested tables running over, but i can live with that until I find how to kill them.

Goodnight.

jwoker 11/27/2006

Is there a solution for this with 3.1? I'm sure this " echo "<p style=\"page-break-before: always\">\n"; " is still the critical code but I need help figuring out where to put it. I looked for $iNumberOfRows in the _print.php file but couldn't find it.
I need the page break after every record so it won't be as complicated as the solution above.
Thanks

L
larsonsc 12/9/2006

I too need to know where to add this string of code in 3.1. I am building a rather complicated report, and being able to control the page breaks is going to be very valuable if I am going to be able to make this a one-click generated report.
Has anyone been able to figure out hwo to make this owrk in 3.1 yet?

T
thesofa author 12/9/2006

The way I found out where to put the break was to paste a line like

echo "wibblebum";

into the generated php page at variuos places to see where it came in the page.

Just try it on a copy of the page and see what happens.

L
larsonsc 12/9/2006

I got this to work tonight by entering the following code where I wanted the break:

<P style="PAGE-BREAK-AFTER: always"></P>


In the Visual Editor, click over to the code view from the page you need to edit, and slap that line in where ever you want the break. Worked very well actually.
--Shawn

W
wpatters1229 12/12/2007

In the new code there is nothing generated where you can place the page break.
There is some code where they talk about page size which could have an affect of saying if the page is so big do a page break. I am not a programmer and therefore do not have a clue if there is a way to do this.
I just want to have a page break after two rows of data. It should be easy for someone who writes this stuff.
Please help....This should be a feature in the program!

Admin 12/13/2007

Bill,
publish your project on Demo account and send a link to it to support@xlinesoft.com

I'll help you to implement the page breaking.