Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 printing without opening page
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

brujo
Average Member

USA
602 Posts

Posted - 09 March 2004 :  14:08:35  Show Profile  Visit brujo's Homepage
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

Posted - 09 March 2004 :  14:37:59  Show Profile
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,

David Greening
Go to Top of Page

brujo
Average Member

USA
602 Posts

Posted - 09 March 2004 :  15:50:33  Show Profile  Visit brujo's Homepage
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
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 09 March 2004 :  15:53:50  Show Profile
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
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 09 March 2004 :  15:57:58  Show Profile
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
Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 09 March 2004 :  20:55:18  Show Profile
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.42 seconds. Powered By: Snitz Forums 2000 Version 3.4.07