Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 09, 2013 09:29 PM by anantDD2007
Member
8 Points
67 Posts
Jan 03, 2013 06:48 PM|LINK
Hi,
I've documents (word, pdf) stored in asp.net website root directory, and the path of those documents are stored in db.
I'm showing the links of the document as hyperlink in datagrid, now when a user clicks on the link the document must be printed in the client system.
Can any one suggest me how to achieve this?
122 Points
21 Posts
Jan 03, 2013 07:15 PM|LINK
You can achive this using below code. You have to add a javascript function. And call this function on click event of the link.
function PrintFile(FilePath)
{
var fileObject = window.open(FilePath); fileObject.print();
Please mark this as answer if helps.
Thanks,
Anant
Jan 04, 2013 05:15 PM|LINK
Thanks for your reply.
I sent the FilePath as "Documents/filename.pdf", but it does not do anything. How shuould i sent the file path format? As it is @ client side.
Thanks & regards,
Anand
Jan 04, 2013 07:45 PM|LINK
Providing file path as "Documents/filename.pdf" would not be give you the exact file path. You have to provide the relative path.
Try providing like "~/Documents/filename.pdf".
I hope this would work.
Please mark this as answer if it helps.
Jan 04, 2013 08:23 PM|LINK
I even tried that, but nothing happens.
Jan 09, 2013 09:29 PM|LINK
Try using Server.MapPath method. Make sure you are providing correct path.
http://msdn.microsoft.com/en-us/library/ms524632(v=vs.90).aspx
This method maps the relative/absolute path to the physical path.
Anand Reddy
Member
8 Points
67 Posts
How to Print documents in client system
Jan 03, 2013 06:48 PM|LINK
Hi,
I've documents (word, pdf) stored in asp.net website root directory, and the path of those documents are stored in db.
I'm showing the links of the document as hyperlink in datagrid, now when a user clicks on the link the document must be printed in the client system.
Can any one suggest me how to achieve this?
anantDD2007
Member
122 Points
21 Posts
Re: How to Print documents in client system
Jan 03, 2013 07:15 PM|LINK
Hi,
You can achive this using below code. You have to add a javascript function. And call this function on click event of the link.
{}Please mark this as answer if helps.
Thanks,
Anant
Anand Reddy
Member
8 Points
67 Posts
Re: How to Print documents in client system
Jan 04, 2013 05:15 PM|LINK
Hi,
Thanks for your reply.
I sent the FilePath as "Documents/filename.pdf", but it does not do anything.
How shuould i sent the file path format?
As it is @ client side.
Thanks & regards,
Anand
anantDD2007
Member
122 Points
21 Posts
Re: How to Print documents in client system
Jan 04, 2013 07:45 PM|LINK
Hi,
Providing file path as "Documents/filename.pdf" would not be give you the exact file path. You have to provide the relative path.
Try providing like "~/Documents/filename.pdf".
I hope this would work.
Please mark this as answer if it helps.
Thanks,
Anant
Anand Reddy
Member
8 Points
67 Posts
Re: How to Print documents in client system
Jan 04, 2013 08:23 PM|LINK
Hi,
I even tried that, but nothing happens.
anantDD2007
Member
122 Points
21 Posts
Re: How to Print documents in client system
Jan 09, 2013 09:29 PM|LINK
Hi,
Try using Server.MapPath method. Make sure you are providing correct path.
http://msdn.microsoft.com/en-us/library/ms524632(v=vs.90).aspx
This method maps the relative/absolute path to the physical path.
Please mark this as answer if it helps.
Thanks,
Anant