I have an ASP.NET project using VB.NET 2003.
Is it possible to get the browser to print the current page but skip the print dialog and default to landscape?
I have been presuming that this will need to be done client side, but is that true?
Printable View
I have an ASP.NET project using VB.NET 2003.
Is it possible to get the browser to print the current page but skip the print dialog and default to landscape?
I have been presuming that this will need to be done client side, but is that true?
Not unless you plan on using an ActiveX control on your page that can control the printer.
So how do I do it?
ActiveX is not the way to go unless the Web page is being saved to someone's local hard disk.
I'm very interested on this thread.
So, Lord_Rat, how would you do it? And why the ActiveX is not the way to go?
Thanks
HoraShadow
ActiveX is malicious and not something that most educated users (and newer browsers) trust. In effect, this new ActiveX you create will reach only, say, 20% of the users that access that page.
The other option is to use a reporting control that can render the tables/content in PDF format and then (possibly) specify orientation from there. Options for this are MS SQL SERVER REPORTING SERVICES and Crystal Reports.
PDF is a good option, yes.
For now I guess the best option is just to make it to where the user can print however they want and it wont be messed up by that.
Eventually, the CSS 2.0 specification will finalize and browsers will support it. When that happens, printing control is part of the specification.
Oh, I see. That makes a lot of sense.
So, how do you guys normaly print? you make the file PDF and print it? Does the client need the adobe reader installed for it to work and print?
Is there any other better way to print than using javascript document.print() ?
What would be the "elegant" way of printing?
Do I create another thread for my questions, or here is fine?
Thanks
HoraShadow
Here is fine and you have to ask what your target audience is and whether you have the programming finesse to program a PDF version of whatever they want to print.
How I handle it is to mark certain elements of the page as not-printing and leave the rest up to the user. I just make sure as a designer that the page can be printed reasonably using the defaults from the printer setup.
If it is imperative that a special form of printing be used, then include instructions on how to set up the page in a non-printing box.
If you want me to demonstrate how to make something show on a web page but not the printed output, say so and I will give you code.
Yes please, if you could, it would be very appreciated!
Thanks
HoraShadow
In the HEAD section, add:
<STYLE type="text/css">
.noPrint, *.noPrint, .noPrint * {printing: no}
</STYLE>
Then, place all of your content that should not print inside a DIV with a class of noPrint, like so:
<DIV class="noPrint">
This will show on the Web page, but will not print out.
</DIV>
Hey, that's very cool!
It will come very handy.
Thanks!
HoraShadow
Yeppers! I find that using that lets me make a page that is both Web-friendly and print-friendly about 90% of the time.
The rest of the time, who cares? =)