Author |
Topic |
|
brujo
Average Member
USA
602 Posts |
Posted - 09 March 2004 : 14:08:35
|
is there a script that will allow a user to print a file - say from my server without opening it first....
I know the PrintWindow function - but I that is not what I want....
I want user just to click a linnk or button and this will bring up the usual printer options box - and then they hit ok - it will print a PDF file from my server.... (without opening the PDF on their screen)
Any ideas ?
brujo
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
|
brujo
Average Member
USA
602 Posts |
Posted - 09 March 2004 : 15:50:33
|
quote: Originally posted by Classicmotorcycling
Brujo,
Have a look here: http://www.automatedofficesystems.com/products/activescr/personal/faq/print/default.htm
The code they have is able to print a text/htm but I am not sure on the pdf.. It gives you a start anyway.
Cheers Dave - but I can't seem to find the script you are referring to.
Have you used this before ?
I did find one script that prints hidden content....
function printHidden(url) { document.body.insertAdjacentHTML("beforeEnd", "<iframe name=printHiddenFrame width=0 height=0></iframe>"); var doc = printHiddenFrame.document; doc.open(); doc.write("<body onload=\"parent.onprintHiddenFrame()\">"); doc.write("<iframe name=printMe width=0 height=0 src=\"" + url + "\"></iframe>"); doc.write("</body>"); doc.close(); }
but I couldn't get that to work.....
BTW - it needn't be a PDF - it could be a txt or doc too.
Appreciate it.
brujo |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 09 March 2004 : 15:53:50
|
I don't think it would be possible for a PDF as they need user interaction in order to print. What i've done before with html files that need to be printed is use the javascript window.open to open the page and set the window.open left attribute to 3000 (so it's not visible). The page would have code inside to print then close, eg window.print; window.close. |
The UK MkIVs Forum |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 09 March 2004 : 15:57:58
|
This is just a guess, haven't tried it
function printHidden(url) { window.open(url, "printWindow", "left=3000"); window.printWindow.print(); window.printWindow.close(); }
just a guess, I don't know if the last 2 statements are possible, worth a try though
|
The UK MkIVs Forum |
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 09 March 2004 : 20:55:18
|
Brujo,
It is from the link down the bottom that is "download additional script samples"quote: Originally posted by brujo
Cheers Dave - but I can't seem to find the script you are referring to.
Samp3.htm is the one that you need to look at. But like David Rhodes said, with PDF it requires user interaction. Text or html, no issues. See what you come up with...
|
Cheers, David Greening |
|
|
|
Topic |
|