Viewing Pages documents in Linux

Fri 10 Sept 10

As part of my job I end up viewing a lot of documents created in Pages[1] and on my Linux box that is a pain. It turns out though that Pages documents are just zip archives containing an XML file which is the actual document, a PDF preview of the rendered document and a few other files. As all I need to do is to view the document the PDF does me fine.

I did the manual process of unzipping the file and viewing it a few times then wrote this simple script to do it for me, it basically creates a temporary directory with a unique name in /tmp then extracts the PDF to that directory and finally opens the file in my PDF viewer.

#!/usr/bin/env bash
tmp_dir=`mktemp -d`
 
unzip -q "$1" -d $tmp_dir QuickLook/Preview.pdf
evince $tmp_dir/QuickLook/Preview.pdf &

Download disp_pages.

I don't know how up-to-date the PDF is, I assume that it is re-created every time the document is saved but I haven't checked that out. So far it has always been accurate for me and until it stops being I'll be happy working like this.

[1] Pages is the worst word processing package I've ever used, it might be OK for doing DTP work in but as a word processor it blows.