Re: Printer friendly ASP.Net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
.



Relevant Pages

  • Re: Header and Footer with RichTextBox Control
    ... I send the footer and header to RTB when it is prining but I ... Dim margin As Single, printControl As Boolean ... pageHigh = .ScaleY(.Height, vbTwips, vbInches) ...
    (microsoft.public.vb.general.discussion)
  • Re: Header and Footer with RichTextBox Control
    ... I send the footer and header to RTB when it is prining but I ... In that case the RTB will print its contents within that area of the page and you will know exactly what the minimum top and bottom margins of the printed pages will be. ... If the above is approximately what you are currently doing then all you need to do is print the header and the footer within the specified top and bottom margins, normally with the "nearest to the edge" vertical position of the header or footer text about half of the margin size from the edge of the page. ...
    (microsoft.public.vb.general.discussion)
  • Re: Creating document template with unique requirements
    ... "Template Challenge" wrote in message ... > 1 has a 2" top margin with no header, and the footer ... > margin with a header that reads "Quarterly News Release" ...
    (microsoft.public.word.formatting.longdocs)
  • Re: paper-size
    ... margin as much as is required to accommodate the header and footer. ... read the printer driver, or the printer driver is wrong. ...
    (microsoft.public.mac.office.word)
  • Re: 2 column layout
    ... header, two columns and a footer. ... There are some issues caused by the margins of the and elements in the header and footer, but removing the margins and adding padding to their parent elements can fix that: http://users.telenet.be/sacn/tmp/v3/ Only in IE6 the top padding of the footer is too large now. ...
    (comp.infosystems.www.authoring.stylesheets)