Page 1 of 1

Page break, for printing.

Posted: Thu Apr 17, 2003 12:33 pm
by penguinboy
This isn't necessarily a problem with php... :)
Well, I'm taking output from a database and forcing the user to download it as a word.doc, so they can print it without the header and footer from the browser.
But the problem is... the query is saved as one file
(its quicker than saving 100 files :) )
And I need page breaks for ever new record....
Inserting page breaks manually is not an option, but I've yet to find any way to make a page break.

So if anyone can help I'd appreciate it.

-thank, pb

Posted: Thu Apr 17, 2003 1:16 pm
by volka
This isn't necessarily a problem with php...
right, therefor it's moved to Miscellaneous
How do you create the word-document? (MS-Word?)

Posted: Thu Apr 17, 2003 1:24 pm
by penguinboy
The code is written in php.

Code: Select all

<?php
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Disposition:attachment;filename=report.doc");
header("Content-Description: OnlineOK Generated Data");
header("Content-Type/Content-Disposition:application/msword");


$x=0;
while($x<=$_POST[var_count])
{
$sql = mysql_query("SELECT * blah blah blah ") or die (mysql_error());
$row=mysql_fetch_array($sql);
echo " $allthetext";
<<<<I need a page break right here.>>>>
$x++;
}
?>
[/quote]

Posted: Thu Apr 17, 2003 2:01 pm
by volka
So you're writing a plain text file only marked as msword-doc by the content-header.
try chr(12) as form feed character

btw: I had to install a converter (from the office cd) before word imported my test document.

Posted: Thu Apr 17, 2003 2:27 pm
by penguinboy
Thank you.
That is exactly what I needed.

Posted: Thu Apr 24, 2003 4:32 pm
by []InTeR[]
This same function only in HTML is:

Code: Select all

<div style="page-break-before: always">contentofpage</div>