print target javascript

Is there anyway to access the print target function from IE (eg print_target("http://www.x.com/file.doc") for example so that when a user clicks on an item they are offered the ability to print it?
fox_stattonAsked:
Who is Participating?
 
Michel PlungjanIT ExpertCommented:
Nope.

PDF is a tricky thing. It SHOULD work, but it seems IE does not hand over the print to acrobat.

Did you try it with the files online, because there is also the matter of the headers being sent
0
 
Michel PlungjanIT ExpertCommented:
Huh? What is a print_target?
0
 
fox_stattonAuthor Commented:
Sorry,
You know in IE when your right click on a link it gives you the option to print target
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Michel PlungjanIT ExpertCommented:
Yeeees? And when do you want to access that, how and why?

Do you mean this?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <title>print using link rel=alternate</title>
<link rel="alternate" href="test1.txt" media="print">
<script>
/* Print alternate prints using link
   Copyright (c) 2003-2006 Michel Plungjan "javascripts at planet.nl" */
obj = document.getElementsByTagName('LINK');  
function changePrint(url) {
   if (url) obj[0].href=url;
   window.print();
   return false;
}

</script>
</head>

<body>
<a href="test1.txt"
onClick="return changePrint('test1.txt')">print test1.txt</a><br>

<a href="test2.html"
onClick="return changePrint('test2.html')">print test2.html</a>

<div id="msgDiv"></div>
<script>
   t="";
   for (i in obj[0]) t+= '\n'+i+':'+obj[0][i]
   document.getElementById('msgDiv').innerHTML='<pre>'+t+'</pre>'

</script>
</body>
</html>


0
 
fox_stattonAuthor Commented:
Hi,
Yes that seems to work with normal files (like html pages etc), but it doesnt work with PDFs, any ideas?


Thanks
0
 
fox_stattonAuthor Commented:
yup, I was trying it with files on a webserver (but the html page was on my local machine)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.