?
Solved

Print file from browser

Posted on 2008-11-18
6
Medium Priority
?
584 Views
Last Modified: 2012-05-05
Hi

I'm trying to print a file from a  browser.
I have the path to the file. Ex http://myfile.com/test.txt

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

Regards

Birger

0
Comment
Question by:Birger1000
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:wassa_r
ID: 22992348
You can open up the print control through javascript, using window.print(); Not sure if this is what you're looking for.
0
 

Author Comment

by:Birger1000
ID: 22992376
I'm not trying to print the browser window, but a file that is on another server.

Ex

The user is on this page mypage.com/index.aspx and pushed a link on the page and then I want this file to print - myfileserver.com/test.txt

Hope this explais the problem.

Regards
Birger
0
 
LVL 3

Expert Comment

by:wassa_r
ID: 22992416
You can't print external files like that, not even on the same server.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Birger1000
ID: 23002339
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
0
 
LVL 2

Expert Comment

by:x0040h
ID: 23026213
Try these solution http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=243 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.
0
 

Accepted Solution

by:
Birger1000 earned 0 total points
ID: 23083963
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
javascript
 
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

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

      Install BugTracker on Windows 2008 server Step 1:  Install windows 2008 server 32 bit OS and configure IIS. Step 2:  Install SQL server ( SQL server 2005 or SQL server 2005 Express edition. The installer for 2008  version isn’t very f…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question