Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Printer friendly ASP.Net

Reply
Thread Tools

Printer friendly ASP.Net

 
 
karlman
Guest
Posts: n/a
 
      09-26-2007
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.

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.

Are there other methods of printing precise forms from a web page?

Thanks
Karl

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      09-26-2007
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
 
Reply With Quote
 
 
 
 
David R. Longnecker
Guest
Posts: n/a
 
      09-26-2007
Karl-

> Are there other methods of printing precise forms from a web page?


Exact typography is really difficult, in my opinion, on the web due to resolutions,
differences in fonts, printers, and other uncontrollable elements. PDF is
about the only way to get it EXACTLY like you like.

The approach I took for one site that had various printable components (but
that they wanted rearranged when printed) was to enclose everything in DIV
tags (each "information section") and then programatically pull them back
using JavaScript in a new "Print Page" window.

I blogged the implementation back in January at http://tiredblogger.wordpress.com/20...ates/#more-272.
The example points to Microsoft CMS, but any rendered content would work
the same.

For simple style manipulation, you can use CSS's built in media types (http://www.w3.org/TR/REC-CSS2/media.html)
and control fonts, spacing, etc. of elements.

HTH.

-dl

--
David R. Longnecker
http://blog.tiredstudent.com

> 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.
>
> 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.
>
> Are there other methods of printing precise forms from a web page?
>
> Thanks
> Kar



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printer Friendly Bob Johnson ASP .Net 3 07-22-2004 06:27 PM
Help displaying printer friendly DataGrid in new window. Ray ASP .Net 2 12-19-2003 06:49 PM
how to make asp:textbox printer-friendly? Valera Simonov ASP .Net 1 10-19-2003 10:51 AM
Printer Friendly pat Microsoft Certification 1 09-17-2003 02:56 PM
implementing a Printer Friendly .aspx Page John Klucker ASP .Net 1 08-15-2003 10:54 PM



Advertisments