print friendly pages

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
User avatar
noguru
Forum Commoner
Posts: 61
Joined: Thu Jun 06, 2002 4:03 am
Location: Just north of the City Of Gold, Land of Milk and Honey

print friendly pages

Post by noguru »

Hi

I need to design a template page which will lie in a specific directory on the server. All developers in our section will then just send their page to this template as a parameter in an <a> tag, such as this:

Code: Select all

<a href="http://path on server/print_template.php?page=http://path to your page/yourpage.php" target="_blank">
The template page must then convert the page into a print friendly page that will fit nicely on the screen and if printed does not overflow. I want this template to be used by anyone as a simpler quicker means to display a print friendly page, without them having to copy and change all their existing pages which they want to be printable. This way they will need only one line of code on their page instead of having to design a whole new copy of that page.

Thanks
swush
Forum Newbie
Posts: 2
Joined: Fri Oct 18, 2002 7:55 am

re: print friendly pages

Post by swush »

hi,

i might get you wrong but i think you're choosing the wrong way. instead of sending the whole html-page to the template-script, you should transform the content to the normal page or to the printer-friendly one. This of course means you'd have to apply a template to all pages. But thats the only way i know to solve such problems effectivly.
User avatar
noguru
Forum Commoner
Posts: 61
Joined: Thu Jun 06, 2002 4:03 am
Location: Just north of the City Of Gold, Land of Milk and Honey

Post by noguru »

What I actually meant was even if the page is too wide to fit onto an A4 page when printed, the browser must somehow know to automatically fit the page onto an A4 page, even if it means that the browser must reduce the size of the contents of the page in order to fit. The reason is our clients might want to print some of the pages, but then the page gets cut off at the right-hand side. It is impossible to redesign all of our pages at this stage, so I thought it would be the easiest way to just send the whole page to somewhere where it can somehow be forced to be printed as A4. But I don't really know how I should do it.
User avatar
Crashin
Forum Contributor
Posts: 223
Joined: Mon May 06, 2002 3:42 pm
Location: Colorado

Post by Crashin »

I'm not sure how the pages to be printed are being built, but I had a similar issue with knowledgebase entries that needed to be printable. I built the knowledgebase pages using data from a database, and just built a printable version using the same data. But, if you're talking about various, pre-formatted pages you could try loading the page in a new window that's sized to your specifications without any menus, images, or other junk that would foul up the printing.
User avatar
noguru
Forum Commoner
Posts: 61
Joined: Thu Jun 06, 2002 4:03 am
Location: Just north of the City Of Gold, Land of Milk and Honey

Post by noguru »

I already tried that and it was still cutting off some of the text on the right-hand side.
Post Reply