How would I go about inserting a page break to occur within a repeat region for printing?

I have a recordset pulling 222 records to be displayed. They want to be able to print each record on a page, so I would have to put the page break code in the repeat region.

Does anyone have any advice or code to get this page break working?

Recommended Answers

All 5 Replies

Member Avatar for Rhyan

First, please clarify what is your task exactly. Are you going to output code as HTML or PDF?

If you are going to output code as HTML, you better do the following.
Create a css file and include it as this.

<link href="../main.css" rel="stylesheet" type="text/css" media="print" />

In that css put the following code

.single_record{
 page-break-after: always;
}

Then what you need to do is add to your php output something like this

echo '<p class="single_record">Your result here</p>';

Note that print css definition, although said to be supported by all major browsers may produce different output.

If this does not work, please post oyour results.

I would prefer to output this to PDF.

In a nutshell, our client has a four page document to mail to over 220 candidates. He had me set up a page to dynamically display the name, address, and other basic information for the candidates for the first page only. I created the document, put in the dynamic text and have a repeat region around everything. This is so that he can print each first page as a separate document.

I need to have a page break that will break at the same point so that each prints the exact same. I can work out the kinks later, but getting this page break working is imperative.

Member Avatar for Rhyan

Well...unfortunately I have never experimented with PDF creation in php. I suppose the php_end_page function is what you need.
I cannot help on this matter, sorry!

Well its very old thread but here is a solution

<html>
<head>
<style>
@page { size 8.5in 11in; margin: 2cm }
div.page { page-break-after: always }
</style>
</head>
<body>
<div class="page">
<?php 
echo "Page 1";
?>
</div>
<div class="page">
<?php
echo "Page 2";
?>
</div>
</body>
</html>

thanks, its old but it always help when you need it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.