Read PDF’s Locally on the Iphone With Safari. No More Emails or URI Hacks
Read PDF’s Locally on the Iphone With Safari. No More Emails or URI Hacks
Essentially you can browse your entire iphone filesystem using this method but I just want to read PDF files as easily as possible.
I’ve been trying recently to find a proper PDF reader for the iphone that doesn’t really screw up the formatting or require very manual conversions and it seems that safari’s built in pdf reader is better than stanza and other readers.
Because safari on the iphone is not able to view files that are local on the device we need to do some quick work to make safari on the iphone read local files.
For this to work you will need to be able to access the iphone file system from a personal computer somehow. Check out how to get SCP on the iphone working.
First you will need to install the lighttpd program from cydia. It was under the networking section. Lighttpd is a tiny webserver for the iphone or ipod touch.
Once you’ve got lighttpd installed you will need to connect your iphone to your pc and open up SCP or a program similar over either wifi or through USB.
The version of lighttpd that I got from cydia didn’t have a default configuration file. So I created a file called lighttpd.conf which is extremely simple.
I chose not to put anything specific in the file because I never plan on accessing this iphone webserver from anywhere other than localhost.
server.document-root = “/var/www/”
server.port = 80
mimetype.assign = (
“.html” => “text/html”,
“.txt” => “text/plain”,
“.jpg” => “image/jpeg”,
“.png” => “image/png”
)
dir-listing.activate = “enable”
To check that your syntax is ok, log into the iphone with ssh or use a terminal app locally on the iphone and locate the lighttpd.conf file. I put mine in /etc.
Type this at the iphone prompt.
lighttpd -t -f lighttpd.conf
You should get “Syntax OK” after typing that into your iphone.
To start lighttpd:
lighttpd -D -f lighttpd.conf
Your document root on the iphone is now /var/www (if you used my configuration file) so start putting pdfs in there and you’ll now be able to read all those pirated ebooks that have been just sitting there taking up hard drive space for so long.
When you point safari to http://127.0.0.1/ you will now see a list of the pdfs (or whatever else you want to put in there).