print target javascript

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

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
Michel PlungjanIT ExpertCommented:
Huh? What is a print_target?
fox_stattonAuthor Commented:
You know in IE when your right click on a link it gives you the option to print target
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">

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


<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>
   for (i in obj[0]) t+= '\n'+i+':'+obj[0][i]


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

fox_stattonAuthor Commented:
yup, I was trying it with files on a webserver (but the html page was on my local machine)
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.