Adding a "Print this"/"PDF this" button to a page area (e.g. a table)?

 I am writing a Business Card request application for our purchasing department, so employees can order a business card online and after supervisor and HR have approved, purchasing department can purchase the card. The application contains of a preview business card, which is basically generated by getting the employees data from the SqlDataSource and then output an HTML table with company logo and the employee information on the correct place.

Our purchasing department is using this preview as a reference for our printing partner. So until now they print out the whole page with all layout/webdesign which actually does not belong to the business card preview.

So how can I make a specific page area, e.g. here the table, to have a button which then prints out (or better: PDF) only this part?

0
jl2424
4/23/2009 7:49:35 AM
asp.net.client-side 24353 articles. 1 followers. Follow

6 Replies
721 Views

Similar Articles

[PageSpeed] 54

you can write ad-hoc printing logic by using PrintDocument class in C#.

 

hope this helps..

thank you,

-nm reddy


***Hope this helps you***
thank you,
-nm reddy
0
nmreddy83
4/23/2009 9:56:01 AM

 Thanks for your answer, but I do not know how to use that class specifically for printing out a part of the HTML document which is generated by ASP.NET So do you have any concrete examples how to achieve that, or maybe something more simple, like JavaScript to open a part of the HTML in a new window which then can be printed out?

0
jl2424
4/23/2009 12:45:30 PM

First of all, there is no PrintDocument class for web applications. You've only got the window.print() JavaScript function unless you purchase a third party tool.

For PDF, you'd need to purchase to a third party component. That is not built in.

For HTML, basically you need to define a stylesheet:

<style type="text/css" media="screen">
.noPrint
{
 display: inline;
}
</style>
<style type="text/css" media="print">
.noPrint
{
 display: none;
}
</style>

Then set up your content:

<div class="noPrint" >Stuff not to print here</div>
<div>Stuff to print here</div>
<div class="noPrint" >More stuff not to print<br /><input type="button"value="Print" onclick="window.print();"></div>

NC...

0
NC01
4/23/2009 3:34:54 PM
0
mudassarkhan
4/23/2009 3:48:41 PM

 This concept is failing when i m trying to print the dynamic html which is generated using jQuery and jTemplates.In my situation i m using my client side grid i have placed that grid inside a asp.net panel control.The problem is by this approach only static data is being populated not the dynamically loaded data which was populated when the template was rendered after a web method call.

Here is my client side grid

 http://www.smallworkarounds.com/jQNetGrid/jQNetGridHome.aspx

Mudassarkhan can you plz explain what to do in this situation

Many Thanks


Mark as Answer if the reply helps you
Visit me at my blog
Small Workarounds
0
ash143gupta
4/23/2009 8:27:09 PM

ash143gupta:
This concept is failing when i m trying to print the dynamic html which is generated using jQuery and jTemplates.In my situation i m using my client side grid i have placed that grid inside a asp.net panel control.The problem is by this approach only static data is being populated not the dynamically loaded data which was populated when the template was rendered after a web method call.

Definately it will since your Grid is client side and the methods for printing a pdf are server side.

Also client side changes are not retained across postbacks

 


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
5/4/2009 4:23:58 PM
Reply:

Similar Artilces:

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD 9.0.0.580. Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <chip@pobox.com> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

"Print Preview" and "Edit Page" buttons
Name: S.K. Product: Firefox Summary: "Print Preview" and "Edit Page" buttons Comments: You must provide "Print Preview" and "Edit Page With..." buttons. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1 ...

quotes, quotes, quotes...
I am getting this error and I know what is causing it, but I have no idea how to fix it, any help would be great. The script steps through the /var/log/messages file on a linux server and puts The entries into a mysql database. However when it gets to the 'hlt' line in the messages file it just barfs. The single quotes are freaking it out. I know about quotes but not how to use in this situation. Thanks, Paul Error: May 27 17:53:00 localhost kernel: Checking 'hlt' instruction... OK. <----- doesn't like this in the messages file DBD::mysql::st exec...

Printing options for "txt" Emails: No "print selection", "print pages X to Y" ??
Hi. NTS told me, that for TEXT only emails it is not possible, to get the same "print..." dialog, as it's available for HTML formatted email: - Printing selected text - Printing a page range I was advised, to place an enhancement request (done). It's hard to believe, that there really isn't some work around to print just parts of TEXT emails, or a page range?? Regards, Rudi. Rudolf, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem...

same "+" toolbar button for "open new tab" and "page Zoom"
How do I find which "toolbar customize" button icon has been put by which add-on, or was it built into basic ff? I am finding exactly same, identical "+" toolbar button for "open new tab" and also for "page Zoom". I got them from "customize" icon set. Whom to tell to make each button icon slight different. Are these built into ff, or some add-on might have put it. Thanks. -- Rawat On 9/29/2012 1:12 PM, V S Rawat gmoz wrote: > How do I find which "toolbar customize" button icon has been put by > which add...

Get "Mail"/"Get "News" / "Write"/"Post" buttons?
If the "Get Mail" button text changed to "Get News", and "Write" changed to "Post" when TB's in the news-reading mode, it would save me and probably others from constantly forgetting to make the change before proceeding. :-) Or is there an extension to do this which I don't know about? Thanks! Bob Bob P wrote: > If the "Get Mail" button text changed to "Get News", and "Write" > changed to "Post" when TB's in the news-reading mode, it would save me > and probably others...

"-" not "_"
I wrote a SQL statement in the data tab. I wrote a bunch of alaises as example ' word-type ' but when I hit the layout tab it converts the "-" to "_". So now my field name is ' word_type '. Is there any way to prevent this? CardGunner Don' use a hypen ( - ).  It isn't a valid character for column names.   See http://searchsqlserver.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid87_gci1188931,00.html   Here's an excerpt about column names: Letters as defined in the Unicode Standard 2.0 Decimal numbers from either B...

replace the "." with a ","
Oi.... I need to build a small programm in ASP.NET and chose to use C# for it.Now i got everything working but there's one little problem.the first textbox is a double. I need to make it so that when someone enters a "." then it gets replaced by a ","any ideas?Ghan  string blah = "4.2.2.2";blah = blah.Replace(".", ",");Ryan Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

double quote
hello there...  i tried everything of think but not working the way i wanted to be... not sure what i'm missing...i'm generating a <span> in code behind and then using in javascript.... here is what i'm doing code behind: int i=0string _keywordID = "keyword";string _name = row["visit_info_nm"].ToString().Trim(); String _getElementByID = String.Format("<span id='{0}' OnClick = \"document.getElementById('{1}').value='{2}';\">{3}</span><br>", i, _keywordID, _name, _name); here is what it generate : <span id='1' OnClick = \"document.getElementById('keyword')...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resu...

"Me" is better than "You"
Yes I know, strings are frozen. But let me talk about it, I really can't get through the idea of a PC talkin to me. I consider my PC as an extension of myself, not a dumb companion who addresses Me as You. Yes there are times when I get angry with Him while I work and get wrong calculations etc.., but it really is my fault, Me using wrong istructions and eventually wanting to find someone else to blame, but it's Me. And yes, I consider Thunderbird my mail program, reading my mail on my PC as Me. So I personally like to have Me in the header bar as a compact address ...

"To" and "From" missing
When I print emails, the words "To" and "From" are blank, even though the "To" name and "From name (addresser, addressee) do show up. This is not a problem for other users on my system. Suggestions In mailbox right click, view. On the message window, right click and choose print options. Make sure print header is checked. -- Barry Merchant NSC Volunteer SysOp *** no email unless requested please!! *** > In mailbox right click, view. On the message window, right click and > choose print options. Make sure prin...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

Web resources about - Adding a "Print this"/"PDF this" button to a page area (e.g. a table)? - asp.net.client-side

Resources last updated: 12/17/2015 5:54:36 PM