Batch Print OpenOffice.org Documents

The following instructions are for KDE only. Sorry, GNOME users. Also, I'm using Debian, but I'll try to include information about other Linux distros as well.

Add a printer to OpenOffice.org

Before beginning, you first need to add to OpenOffice.org the printer to which you're going to send batch print jobs. If you've already added a printer to OOo, then you can skip ahead. If you haven't, or if you've only added kprinter, then you need to perform these steps. You should have an icon somewhere on your K menu that allows you to open OpenOffice.org Printer Administration, but if you don't, run the following at the command line:

oopadmin

This should open the OpenOffice Printer Administration window. Press the New Printer button.

Select Add a printer, and press Next.

If you can find a driver for your printer, go ahead and choose it. If you can't, just choose Generic Printer. Either way, make your choice, and press Next.

I had a listing at this point of all command line options for all the various printers for which I have entries. Choose the one you want, and it should be automatically filled in at the top of the window. In my case, I chose lpr -P "hplj6l", and then pressed Next.

Enter a name for your printer. Don't use spaces or any "funny" characters. I called mine hplj6l ('cause it's an HP LaserJet 6L). Press Finish.

Create the KDE servicemenu to batch print

If you want to create the batch print menu just for you, then you need to place the following file in your hidden kde directory, which is found in your home directory at .kde (note the dot). If you want to make the batch print menu available to all users of your machine, then you need to place the file at /usr/share/apps/konqueror/servicemenus. In my case, I'm the only user of my machine, so I'm placing it in my home directory, at:

/home/rsgranne/.kde/share/apps/konqueror/servicemenus

Run the folllowing command, which will create the necessary file in the above directory (change the username to yours):

touch /home/granneman/.kde/share/apps/konqueror/servicemenus/batchPrintOOo.desktop

Now, using your favorite text editor, open batchPrintOOo.desktop, and add the following lines:

[Desktop Entry]
ServiceTypes=application/msword,application/vnd.sun.xml.writer
Actions=batchPrint
[Desktop Action batchPrint]
Name=Batch Print OOo Documents
Icon=openoffice
Exec=openoffice -pt "hplj6l" %U

To work on your system, you'll need to change the hplj6l in the last line above to the name of the printer you entered. If you don't have a KDE icon named "openoffice", then an icon may not show up in a moment when you right-click and try to batch print, but that's not a big deal.

If you're using SUSE, the last line should instead be:

Exec=/usr/X11R6/bin/OOo-writer -pt "hplj6l" %U

Test your new KDE servicemenu

Create two OOo documents, titled "test1.sxw" and "test2.sxw". In test1.sxw, enter the following text: test 1. In text2.sxw, enter this: test 2. Save both documents on your desktop.

Select both documents, and right-click on one of them. Select the Actions menu, and you should see a new option: "Batch Print OOo Documents". Choose it, and in a few seconds your printer should spit out two documents, test1.sxw and text2.sxw. Congrats! You've created a KDE servicemenu that enables you to batch print OOo text documents.

What's next?

If you want to create another servicemenu enabling you to batch print OOo Impress documents (presentations), it's pretty easy. Just create a new servicemenu file, perhaps with the name of batchPrintOOoImpress.desktop, and change the ServiceTypes entry in the servicemenu file to the MIME types for Excel and Impress documents.

You can do the same thing for Excel and OOo Calc documents (spreadsheets).

You can do this for other files that you might like to batch print, like ASCII text files or Web pages.

For further help, see the sources listed below.

Sources

"Is there a way to print a batch of files without opening each of them in OOo?" from The OpenOffice.org Unofficial FAQ
http://www.bytebot.net/openoffice/faq.html#Misc0

Creating Konqueror Service Menus
http://developer.kde.org/documentation/tutorials/dot/servicemenus.html

WebSanity Top Secret