...

View Full Version : Print all all html-files in a folder using a Java Script?



bellybob
06-02-2006, 01:37 PM
Hi

I'm new to this forum, and have close to no skills in javascripting.

I'm an editor for my works monthly newsletter (web based). And of course some of our employees want to read it on paper. :confused:

The thing I'm after is a javascript which makes it possible for me to place a "print all pages"-button on my newsletter. I'm thinking of using a SSI for this button.

For each issue I store all the html-files in one folder, and my though is therefore: is it possible to write a javascript that prints all the html-files in one batch (one click)? If possible, will it print the files in random order? javascript = print all html-files in folder X

If not possible, how could i set up a javascript that prints multiple defined (named) html-files by just one click? Can I then control the printing order?

I've tried to search the formums and googled around, but haven't found a solution that suits my needs.

Can someone help me?

Thanks and regard!
Bellybob

A1ien51
06-02-2006, 04:28 PM
JavaScript has no IO capabilities. That means it can not read/write files from the server or client.

Eric

Beagle
06-02-2006, 05:12 PM
That's not really what he needs. He needs to figure out if he can force the browser to print a document. If so, then how could he write a script, with a hard-coded set of urls, that would print page after page after page of different pages, all from within a single page.

I don't know that it can be done, but his answer doesn't involve file I/O as I understand it.

Oakendin
06-02-2006, 06:18 PM
Taking into account that JavaScript doesn't have IO capabilities and that Beagle believes bellybob just wants to print stuff out. I've created a pretty remedial JS and HTML solution.

On a HTML page, you can run a function that'll pop up all the pages with an additional query string param (print=true). On the pages that it pops up, you include a function to search the url for the param and see if it should print. If so, run the window.print() function.

I've included 4 files. Named with the testX.thml convention. 1-3 have text and the query string detection functionality. 4 has the option to "print all" pages. I've include the zip file.

Maybe this will give you ideas for a better solution.

bellybob
06-03-2006, 05:00 PM
Thx a lot Oakendin, I'll have a closer look at it on thursday, when i'm back at work.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum