Re: Printer friendly ASP.Net
- From: Göran Andersson <guffa@xxxxxxxxx>
- Date: Wed, 26 Sep 2007 18:25:39 +0200
karlman wrote:
I am in need of printing a detailed form from an ASP.Net page. I am
using ASP.Net 2.0 with VB.Net.
My intent is to create an ASP.Net page that only contains the
information I want printed which includes tables, text, and pictures.
I seem to be able to form the page I want well enough but printing is
another matter.
You can use the @media command i css to create css classes separately for screen and print.
Example:
body { margin: 0; background: #fff; font-size: 10pt; }
@media screen {
body { padding: 20px; }
}
@media print {
body { padding: 0; }
}
How can I control the margins so I can print closer to the edge? I
also want to prevent the header and footer from printing? I imagine it
would take some client side scripting.
You can reduce the margin and padding specifically for print, as in my example, but the browser also adds margin outside that area, as well as the header and footer. The user can reduce that margin and remove the header and footer in the browser settings, but you can't affect them using either css or Javascript.
Are there other methods of printing precise forms from a web page?
You could use a PDF component to draw the contents of the page in a PDF document that you send to the client, which the user then can print. I used this approach for a customer when they needed to print 3" x 5" labels on a label printer.
--
Göran Andersson
_____
http://www.guffa.com
.
- References:
- Printer friendly ASP.Net
- From: karlman
- Printer friendly ASP.Net
- Prev by Date: Re: Variables to use in more than one sub
- Next by Date: Validation Controls, Override/append Client Side Functionality
- Previous by thread: Printer friendly ASP.Net
- Next by thread: Re: Printer friendly ASP.Net
- Index(es):
Relevant Pages
|