Register
It is currently Thu Nov 27, 2014 12:20 pm

Printing MS Office documents from the command line


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Wed Jul 25, 2007 1:09 pm   

Joined: Wed Jul 25, 2007 11:45 am
Posts: 11
Some simple functions which allow you to print office documents (Excel and Word documents) without having to open OOo :)

Code:
#!/bin/bash
# Runs with bash/zsh/sh (tested with bash/zsh).
SELF=`basename $0`

# What we are determines what we do :)
if [ "$SELF" = "print_doc" ] ; then
  FUNC=print_word
elif [ "$SELF" = "print_excel" ] ; then
  FUNC=print_excel
fi

print_word() {
  antiword -f -a a4 "$1" | a2ps -
}

print_excel() {
  xlhtml "$1" | a2ps -1 -
}

# Fix for LANG settings which are not supported..
LANG_OLD=$LANG
unset LANG

for i in "$@" ; do
  $FUNC "$i"
done

# And back to the old values
export LANG=$LANG_OLD


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP