Page 1 of 1

need help with page breaks

Posted: Thu Feb 02, 2006 8:49 pm
by zangief
im using fopen functions right now coz we need reports to be in txt format. In this report, we need to go to another page once we got 30 rows of the table we're calling. Problem is, i dont know how to call a page break using fwrite. All i know is carriage return (\r) and newline (\n).

Is there a command for page breaks?

Thanks for the help in advance.

Posted: Thu Feb 02, 2006 8:55 pm
by John Cartwright
The only way I know of making a page break is the css attribute .. do a quick search on google "page break css"

I could be completely off here though..

Posted: Thu Feb 02, 2006 9:28 pm
by zangief
i tried what you told me to do. but unfortunately for me, html codes cant be implemented in text files so i cant use class or <div>

Posted: Thu Feb 02, 2006 9:32 pm
by John Cartwright
any particular reason why you can't load the text file into php and output in html or other format??

Posted: Thu Feb 02, 2006 10:00 pm
by josh
Do you mean you want the lines to be grouped into separate text files, 30 lines per text file? This does not make sense - "call a page break in fwrite"

Posted: Thu Feb 02, 2006 10:27 pm
by feyd
there is a page break character in text files: 0x0C (12 in decimal) which is the Form Feed control character.

Posted: Thu Feb 02, 2006 10:38 pm
by shoebappa
Hrm, after some research, you can appearently use the unicode \u000C, which I think represents a form feed.

http://forum.java.sun.com/thread.jspa?t ... ID=2117010

Notepad doesn't use this, but WordPad does. Use chr(12) to output the form feed.

Code: Select all

<?php

	echo "Page 1";
	echo chr(12);
	echo "Page 2";
	echo chr(12);
	echo "Page 3";

?>
If you wrote it to a txt file and opened it in WordPad it should print it on three pages. Copying the source of the output of that into WordPad works as well.

No clue what other text editors would do.

Posted: Thu Feb 02, 2006 10:59 pm
by zangief
Jcart wrote:any particular reason why you can't load the text file into php and output in html or other format??
actually, im calling data from the mySQL database and put those data into a text file. so its mySQL->PHP->text file.

thanks for some idea, ill try those right now, see what works.

Posted: Thu Feb 02, 2006 11:15 pm
by John Cartwright
feyd wrote:there is a page break character in text files: 0x0C (12 in decimal) which is the Form Feed control character.
/me learned something new :P