| | |
Help with printing mulitple documents in js...!
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2005
Posts: 4
Reputation:
Solved Threads: 0
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>
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>
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
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.
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.
•
•
Join Date: Jan 2005
Posts: 4
Reputation:
Solved Threads: 0
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.
![]() |
Similar Threads
- printer colour problem (USB Devices and other Peripherals)
- remove the path when printing (Java)
- Help in printing mulitple documents using print button (Java)
- issue with documents spooling 2-3 times the size they actually are... (Windows NT / 2000 / XP)
- Burner Drive, Printing, PDFs (Apple Hardware)
Other Threads in the HTML and CSS Forum
- Previous Thread: Frames question - using FP03
- Next Thread: How to create a web page with scrolling menus to specific entries
Views: 5773 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for HTML and CSS
2002 appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity create css deleted design development displayimageinsteadofflash dreamweaver drupal emailmarketing epilepsy explorer firefox flash font fonts form format frontpage google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft missing mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization perl pnginie6 positioning problem scroll seo shopping studio swf swf. templates textcolor theme timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7 wordpress xml xsl






