Page 1 of 1

Print option prints only as screen size. help me

Posted: Wed Dec 05, 2007 2:55 am
by avmohankumar
I have implemented the print option. But I am getting the output result that exceeds the page.

I mean here, to see the entire page we have to use horizontal scroll then only we view all data. the print option will take output only the screen size. how can I print all the data as per original output.

whether we have option to print all in a single page or only we get print as the screen shows.

suggest me please,

Posted: Wed Dec 05, 2007 3:05 am
by s.dot
I'm thinking your data has line breaks in it that are not recognized because browsers ignore them.

If this is the case you can either:

1) Use the <pre> tag.

Code: Select all

<pre>your text here</pre>
or 2) use the php nl2br() function

Code: Select all

echo nl2br($yourText);
If that's not the case, then you have extremely long character sequences, in which case wordwrap() would work for you.

Posted: Wed Dec 05, 2007 3:35 am
by avmohankumar
Now I tested with the <pre> tag. But it is not gives display as whole table.

or else how we set the print page to Landscape.

Posted: Wed Dec 05, 2007 6:24 am
by onion2k
Printing from a web page is a horrible mess. There are a few CSS properties that are useful, but you'll always have very little control over the output. As far as I know there's no way to make a page to print as landscape.

I prefer to use a PDF instead when the user clicks a print button - FPDF is a great library for generating PDF files in PHP, and you have loads of control over the output.