Other Stuff

Google Docs

I'm using Google Docs for almost everything document related. Couldn't figure out how to use the spreadsheet with a background image, though.

Now I'm exporting the spreadsheet to OpenDocument (ODS). To make this work, you have to make sure not to 'wrap' any text. There's a “Wrap text” icon in the tool bar which show the wrap-status for any cell in your spreadsheet. But you can also just select them all and toggle the 'wrap' button to make sure it's not activated. Also, be very careful with ctrl-enter: this will also created undesired white space in the target ODS document.

Then I open the document with OpenOffice (LibreOffice) and export it from there as pdf. Now I'm ready to add the background image, with this little script:

#!/bin/bash

usageQuit()
{
  echo "Usage: $0 -f original_pdf_file"
  exit 1
}
 
# $# contains number of arguments
if [ $# -eq 0 ] 
then
	usageQuit # no arguments
fi
 
args=`getopt f: $*`
# $? contains exit status or return code of last command
if [ $? != 0 ]
then
	usageQuit # not the right arguments
fi
 
set -- $args
if [ $? != 0 ]
then
	usageQuit # not the right arguments or options
fi
 
for i
do
  case "$i" in
        -f) shift; PDF_FILE=$1; shift;;     
  esac
done

BACKGROUND="background.pdf"

pdftk ${PDF_FILE} background ${BACKGROUND} output out.pdf
mv out.pdf ${PDF_FILE}

This is how you call the script (make sure it's executable):

./invoicing.sh -f big-invoice.pdf

And that's it, now your page filling background.pdf will get merged with big-invoice.pdf and stored under the latter name.


Personal Tools