Print option prints only as screen size. help me

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
avmohankumar
Forum Newbie
Posts: 14
Joined: Fri Jun 08, 2007 7:20 am

Print option prints only as screen size. help me

Post 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,
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
avmohankumar
Forum Newbie
Posts: 14
Joined: Fri Jun 08, 2007 7:20 am

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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.
Post Reply