![]() |
Printer friendly ASP.Net
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 |
Re: Printer friendly ASP.Net
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 |
Re: Printer friendly ASP.Net
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 |
| All times are GMT. The time now is 01:24 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.