hihi,

is there a way to rid of the page header (usually it's the page title and url) and the page footer (usually it's the page number and date) without having user to change from the web browser's the page setup ?

Can this be done using javascript or just html meta tags?

Also we control the contents of what is printed from a web page without having to redirect the page? Example, I have three paragraphs on a web page and I don't want the middle paragraph to be printed.

thanks

Recommended Answers

All 15 Replies

hi,

thanks for your reference given but i still can't get it rite. i tested by including this in a cascading style sheet.

@page {
@top-left{
font-family: Helvetica, Arial, sans-serif;
font-size: 18pt;
font-weight: bolder;
content: "XHTML-Print: A Proposal --- August 25, 2000";
}
}
by right, this should print out "XHTML-Print: A Proposal --- August 25, 2000" on the top left of the page right. but it doesn't. This is just testing. Anyway, my problem is I want to get rid of the header and footer without having to change it using the page setup of the browser. by the way, i'm using mozilla browser.

please help.

anyone have any idea whether we can eliminate the headers and footers with PHP ? or any other languages ?

The headers and footers are put there by your printing subsystem, not by the page or the browser. What that means is, this particular attribute is in the hands of the user. Much like screen resolution or brower width. I always find it irritating when programmers try to override my perceived control.

hi tgreer,

thanks for your time and info so far. sorry, if anything i asked irritated you.
I've got further questions though. If lets say i'm doing a web application (using PHP) in a closed environment, when a user submit a form for example, the info is sent to the server. On the server, the necessary processing is done and the content is sent by the server to the right printer to print. How do I get about to do this?

In this case can the page to print be processed automatically without the header and footer before being sent to printer ?

Don't misunderstand me, your POST didn't irritate me at all.

Your server can print to a printer attached to the server. You can't force something to print on the users printer.

The headers and footers are put there by the operating system's printing subsystem. It's not something you can control with a scripting language.

ok tgreer. i get the point with the header and footer now.

any tips on how i can select which printer to print on the server using scripting language or any other related languages?

You're posting this in the JavaScript/DHTML forum. To control the printer on the server, you would have to use a server-side language. Which server-side language do you know?

initially, i had hoped this could be done with javascript, so i posted the question here. Anyway, I did post a similar question in the PHP forum at this link http://www.daniweb.com/techtalkforums/thread15881.html .

I know ASP and PHP but on this assignment I have to use PHP. So, ... PHP it is.

yuh i checked on this page a couple of times. it says the function are only available on Windows 9.x, ME, NT4 and 2000. They have been added in PHP 4.0.4.

I'm using Win XP. Anyway, I did tried using the steps given, add the line extension=php_printer.dll; in the php.ini file, downloaded a php_printer.dll file into the extension folder. When i tried testing the printer_open() function, i get the error; Fatal error: Call to undefined function: printer_open() . I might have followed the steps incorrectly (downloaded the wrong file for php_printer.dll, copied into the wrong folder or missing another step).

Someone posted a thread that it is possible to use the function on win xp at at the bottom of the page but did not elaborate on how to do it. The thread was posted back in March 2004

The printing is done by the client machine . Just configure it by
file > page setup on your browser and select your choice

I received the info I needed...and of course, it was just so simple..I just hadn't looked at the "Print" info given when clicking on the "Print Preview". Dah?? I get in a hurry and don't read the Instructions, sound familiar??

Just use the media="print" on a css to hide those.

Like this:

<style type="text\css" media="print">
#myFooter, #myHeader
{
    display: none;
}
</style>

you can create own code . its possible. i have done already. but window.print() is not hide with css

commented: Stop necroposting -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.