Help with printing mulitple documents in js...!

Reply

Join Date: Jan 2005
Posts: 4
Reputation: koa1aboi is an unknown quantity at this point 
Solved Threads: 0
koa1aboi koa1aboi is offline Offline
Newbie Poster

Help with printing mulitple documents in js...!

 
0
  #1
Feb 16th, 2005
can somebody help me with this... i need a javacript code to print multiple documents when a print button is pressed. I posted 20 documents on my site and i just wanted to have a print button underneath the links of all the documents so the viewers can just print all the documents in a press of a button. I just dont want them to open those documents and print them one by one. Coz all the documents are basically have to be printed anyway. Thanks a lot!!!

i have this code but this code opens up a dialog box for each new window and is annoying. i just need one print dialog box for ALL the pages


function print(url,name)
{
var win=window.open(url,name,"width=100,height=100");
win.opener.focus()
win.print();
}

function printAll()
{
print("about:blank","win1") \\about blank is a sample url
print("about:blank","win2")
print("about:blank","win3")
print("about:blank","win4")
print("about:blank","win5")
print("about:blank","win6")
print("about:blank","win7")
print("about:blank","win8")
}

<form>
<input name="Print" onClick="printAll(); return false" type="button" value="Print">
</form>
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Help with printing mulitple documents in js...!

 
0
  #2
Mar 11th, 2005
Sorry. Welcome to the world of the browser. The user is God of this world. Meaning, that you can't script an automated print. That would be "hijacking" control away from the user. The JavaScript "print" method sends a request to the browser. The browser responds by opening the Print Dialog for the user. The user can decide if/where/how they want to print.

Now, there is a rather convoluted work-around. I coded a system for a financial firm that did automated document/form processing. Users would browse to a PDF form, fill it out, and the server would process/validate the information, store in a database, and return the PDF to the user with corrected data. It would then automatically print, silently, to the default printer.

The key is to use a PDF. Embed a PDF JavaScript into the PDF. While the browser object model doesn't have a silent print method, the Acrobat/PDF object model DOES.

That only addresses part of your problem, in that it's still a document-at-a-time.

Perhaps a totally different approach. Provide a zip file with all documents, that the user can download to the desktop and do with what they choose.
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 4
Reputation: koa1aboi is an unknown quantity at this point 
Solved Threads: 0
koa1aboi koa1aboi is offline Offline
Newbie Poster

Re: Help with printing mulitple documents in js...!

 
0
  #3
Mar 11th, 2005
Thanks a lot for the info tgreer. I see what your saying. Actually i thought about zipping them too into a file. but the reason i didnt do it is because most of the users that will gain access to my site are senior citizens and maybe most of them arent familiar with zip files. While most of the links are office docs, i converted them into a pdf file so all they have to do is open the pdf and print it.looks like its doing pretty good.now my job is to arrange them in order which is like 50 pages. but hey, it works...thanks again mayn for the reply.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 5773 | Replies: 2
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC