Print file from browser


I'm trying to print a file from a  browser.
I have the path to the file. Ex

What i what to achive is that the user can push a button/link and the browser will send the file to the users printer.
I would prefer if it just pics the default printer but the print window is also acceptable.

The files can be of all type(doc,txt,ptt,pdf).
I'm using the .net 1.1

I've don't really have any ideers how to make this work so I'm open for any sugestions



Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can open up the print control through javascript, using window.print(); Not sure if this is what you're looking for.
Birger1000Author Commented:
I'm not trying to print the browser window, but a file that is on another server.


The user is on this page and pushed a link on the page and then I want this file to print -

Hope this explais the problem.

You can't print external files like that, not even on the same server.
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

Birger1000Author Commented:
I've just discoved that the files that need to be printet is only pdf files.
Will this improve my chances of printer in the way I descibed above
Try these solution It's not work for me, but maybe it will works for you. If you have an opportunity to setup printer on you application server I can send to you c# server code to print from server side scripts.
Birger1000Author Commented:
I'm just found a solution..
It's not all that good but it gets the job done

I'm adding the requied pdf as object on the page and then fires a javascript that prints all the object

Thanks for all the support
function printDocument() {
      var i = 0;
      while (document.getElementById('pdf' + i))
            alert("count " + i);
            document.getElementById('pdf' + i++).printWithDialog();
      //setTimeout("window.close()", 5000);
Response.Write("<OBJECT id = ""pdf"+ count.ToString  +""" name=""pdf"+ count.ToString  +""" CLASSID=""clsid:CA8A9780-280D-11CF-A24D-444553540000"" WIDTH=""364"" HEIGHT=""290""><PARAM NAME='SRC' VALUE="+ item.Value  +"></OBJECT>")  
          Dim y as string = "<script language='JavaScript'>printDocument();</script>"
          Me.RegisterClientScriptBlock("clientscript", y)

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Applications

From novice to tech pro — start learning today.