Using iPad as .pdf-viewer in Airplane Mode

The following script generates a very simple site with index.html file and the site.manifest file from a directory with .pdf-files.

The generated site enables Offline-storage mode which lets iPad access cached content, even when in Airplane Mode.

apache needs an “AddType text/cache-manifest manifest” to serve the correct Content-Type header. lighttpd is already configured to serve correct headers.

You can test it here!

Refer to this article for background.

#!/bin/bash
MANIFEST=site.manifest
INDEX=index.html
VERSION=$(date)

echo "CACHE MANIFEST" > $MANIFEST
echo "#version $VERSION" >> $MANIFEST
echo "$INDEX" >> $MANIFEST

echo "<!DOCTYPE html>" > $INDEX
echo "<html lang='en' manifest='$MANIFEST'>" >> $INDEX
echo "<meta charset='utf-8'>" >> $INDEX
echo "<center><h2>" >> $INDEX

for pdf in *.pdf ; do
  echo "<a href='$pdf'>$pdf</a><br><br>" >> $INDEX
  echo "$pdf" >> $MANIFEST
done
Written by SirPing
Later article
about