GUJUm0deL, This is precisely what I would like to avoid...I am trying to force the pdf file to print in the background whenever the user selects either File/print, the print button in the toolbar or a printer icon in the web page.
Can you be more accurate about the problem?? Typicaly when the PDF is clicked, Acrobat reads the file and opens it in the browser, and from there you click the print icon on the acrobat toolbar and the pdf is printed...
Forget the Nobel Peace prize, I just want to take over the world!!
GUJUm0deL,
The problem is this: I am putting together an instructions CD for some device. The user will navigate through the pages at will but in the event that they require a printout of a particuliar procedure (ie;tables, flowcharts steps), the formatting of the printed page gets messed up if printed from Internet Explorer.
That where the pdf files come into action because I made certain that the pdf files would print exactly as they should (paper size and orientation, page break etc.)
As much as it is possible and for all the above reasons, I want IE to always print the pdf file instead of the html version; the user may select File/Print from IE menu, the Print button in IE toolbar and I have added a printer icon on the page that should initiate the print process.
By going through the FAQs and Forums, this should work:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<link rel="alternate" media="print" href="document_name.pdf">
<script language="Javascript">
<!--
function printpdf() {
browserVersion = parseInt ( navigator.appVersion)
if (browserVersion >= 4) window.print ()
}
// -->
</script>
<title>Title</title>
</head>
I have put an image on the page that looks like a printer and that should initiate the printing process.
The code behind the image looks like this:
href="javascriptrintpdf ()"><img src="../images/Pics/printr01.gif"
alt="Print Adobe Acrobat version of this page" style="border: medium none" WIDTH="33"
HEIGHT="29">
The only things that gets printed are the IE headers (containing the title of the html page + page numbering)and footers (containing the actual path of the PDF file + date), not the actual PDF file. Both HTML and PDF files are located in the same directory and the PDF file prints fine if I right-click on it and select "print" from the source directory.
Hmm, I see your problem and from my P.O.V. there's only one solution: when the user clicks the pdf link on the html page, open the PDF in a new browser window, strip the new browser window of its toolbar that way only the acrobat toolbar appears and the user has to click that print icon to print...
Not sure if this is the way you'd want to do it, I can also suggest posting this topic question the Acrobat forum here, maybe one of the guru's there has a simpler solution: forum223
Forget the Nobel Peace prize, I just want to take over the world!!
The code in teal opens the new window with no toolbar so the user has no access to the browser Print function, they can only print via the acrobat toolbar...
The code in green opens the new window in a specified width and height, play around with this to get the desired height and width...if all the new window's have a different window height and width, then do this:
function openwindow(file,name,prefs) {
var page1 = window.open(file,name,prefs);
}
And anywhere you want to call the function, do this:
<a href="javascriptpenwindow('
I took me a while but I found a file that I downloaded long time ago. It's a PDF file that once I opened goes directly to the printer.
Here's the trick. You have to create the pdf file with Acrobat full Version not the Reader.
You can use the HTML code supplied before on previous postings to open the page and load the PDF. From that point on let this trick take care of the printing.
In Acrobat go to Document> Set Page Action > On Page Open > Add Action and Select Javascript from the list presented.
Once you open the edit window paste this code
this.print(false, 1, 3,true)
My document has 3 pages I guess the 1-3 is just to define what pages you want to print.
The first parameter deals with the Print Dialog box ( wich by the way you don't even see when opening the PDF file).
The Last parameter I couldn't figure out. Try to look for Javascript Reference for PDF documents.
Hope that helps a little bit or at least gives you a new idea.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.