Need help with page formatting for printer.
Moderator: General Moderators
-
Jack.Straw
- Forum Newbie
- Posts: 11
- Joined: Thu Nov 30, 2006 11:12 am
Need help with page formatting for printer.
Hi. I've put together an application for work that reads excel files and then displays them as html forms. Users can then edit the form and click a 'print' button which loads a printable table displaying formatted results. This all works quite well, except.. page breaks.
The table on the 'print' page will have an unpredictable number of rows, and each row has an unpredictable number of carriage returns. How could i get my program to close the table at the end of page 1 and start again on page 2? The table is created within a loop. Is there any way to tell where the end of a printable page is so that i can make this thing work?
The table on the 'print' page will have an unpredictable number of rows, and each row has an unpredictable number of carriage returns. How could i get my program to close the table at the end of page 1 and start again on page 2? The table is created within a loop. Is there any way to tell where the end of a printable page is so that i can make this thing work?
-
Jack.Straw
- Forum Newbie
- Posts: 11
- Joined: Thu Nov 30, 2006 11:12 am
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Oh, I was not trying to imply that you should have suggested it.
Au contraire, I was glad you didn't.
Some time ago someone led me into that pitfall and I fiddled with it for several days until it was finally pointed out to me that not one single browser in the universe (at that time) supported it. I was a bit annoyed. I went the PDF route, as I recall.
But it will be a nice feature when it does get support, as it is clean and straightforward.
Does any browser support it at this point?
Au contraire, I was glad you didn't.
Some time ago someone led me into that pitfall and I fiddled with it for several days until it was finally pointed out to me that not one single browser in the universe (at that time) supported it. I was a bit annoyed. I went the PDF route, as I recall.
But it will be a nice feature when it does get support, as it is clean and straightforward.
Does any browser support it at this point?
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
-
Jack.Straw
- Forum Newbie
- Posts: 11
- Joined: Thu Nov 30, 2006 11:12 am
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ok, i've done some research on creating pdf files with PHP. That's great!
However...
I face the same problem with the pdf file as I do with regular html. How do i know when my table has reached the end of the page? To be clear on what my program is doing, please see this example:Code: Select all
<table>
<tr>
<?PHP
for ($i=0; $i<count($rows); $i++) {
if (END OF PAGE) {
echo "</tr></table>";
StartNewPage();
echo "<table><tr>";
}
echo "<td>$rows[$i]</td>";
}
?>
</tr>
</table>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
Jack.Straw
- Forum Newbie
- Posts: 11
- Joined: Thu Nov 30, 2006 11:12 am
I understand, but the root of the problem to begin with is that i never know exactly how much information going to be in any given field (it's mostly user input). Placing the first row would be no problem, but where do i start the 2nd? How do i know when it's time to start a new page? I guess i could count the characters in each string.. hmmKieran Huggins wrote:remember: you're making a PDF, not HTML - you should be placing individual elements at x & y co-ordinates relative to a corner of the page.
So a table would become nothing but a series of "cells" of content.
-
Jack.Straw
- Forum Newbie
- Posts: 11
- Joined: Thu Nov 30, 2006 11:12 am