1. hartsteins's Avatar
    I have been looking for an ebook reader that recognizes PDF ebooks. Books.app doesn't seem to and I can't get mobilepreview to see them either. As a workaround I'm using apache and safari.

    Basically, install apache from installer.app
    It will make a folder called Library/Webserver/documents
    Put folder of PDF ebooks in there.
    Point safari to 127.0.0.1/(your folder name)/
    You get a directory listing of folder contents.
    Click on any PDF and it will open in safari complete with zooming, rotation capabilities, graphics & page numbers...etc
    Wonky but it works.

    I would rather use a designated PDF reader so if anyone knows of one please let me know.

    Additionally - if anyone knows of another way for Safari to read local files, that would work too.

    Greg
    Last edited by hartsteins; 2007-09-09 at 12:36 AM. Reason: addition
    2007-09-08 09:04 PM
  2. brettt's Avatar
    could you use that method to store web apps locally? because that would be amazing....
    2007-09-09 12:48 AM
  3. thinkfast's Avatar
    Many Thanks.

    Your Apache webserver idea also solves my need to view images at a higher res than the standard photo viewer on the itouch supports, and in regard to brett's question, it appears to be able to fully function as a webserver. Anyone else see the potential here?! For my needs I can see building my own web-based (but hosted on the ipod touch itself) photo management system that is totally customized to my own liking. Amazing indeed.

    Mel
    2007-11-09 02:39 AM
  4. DeathPrawn's Avatar
    Given the resource constraints of the iPhone, I would think that lighttpd is a better choice. I configured mine with a custom PHP directory listing script and corresponding CSS sheet to look more standardized.
    Attached Thumbnails apache and safari as PDF ebook reader-img_9000.png  
    2007-11-09 07:34 AM
  5. thinkfast's Avatar
    Looks nice. Would you mind sharing the code?

    Mel

    Just tried the lighttpd. It is much better performing. Thanks. I was having trouble with large pdf's freezing for up to a minute before, problem gone.

    Mel
    Last edited by thinkfast; 2007-11-09 at 06:24 PM. Reason: Automerged Doublepost
    2007-11-09 06:24 PM
  6. DeathPrawn's Avatar
    I've attached the PHP, CSS, and image files. Throw 'em all into a folder called .dirlist at the root of the site folder - you can change it, but be sure to change all references in the PHP, CSS, and lighttpd.conf files.

    You also need to make the following changes to your lighttpd.conf (this is assuming you already have both directory listing and PHP set up properly):
    - add "mod_indexfile" to the list of server modules, separated by a comma
    - add the line 'index-file.names = ( "/.dirlist/dir-generator.php" )' (change if you want to keep it somewhere else).

    load/unload lighttpd, and it should work!
    Attached Files
    Last edited by DeathPrawn; 2007-11-10 at 03:43 AM.
    2007-11-09 07:37 PM
  7. HelioPause's Avatar
    Is there maybe an...easier way...of reading PDF's on the iPhone?
    2007-11-09 10:37 PM
  8. DaveiPhone's Avatar
    DeathPrawn, thanks much for posting that! This is a slick solution and works great, although as a newbie to lighttpd and PHP, it took a little bit for me to figure out how to make it work.

    Even though this shows off my extreme ignorance, maybe others will benefit by my explaining the steps that slowed me down:

    First, I had to figure out that PHP was a separate installation! Yes, I said I'm a newbie. When you install PHP, you get this message: "Please add /opt/iphone/bin/ to your $PATH", but it did actually did that automatically.

    Next I needed to locate the lighttpd.conf file so I could modify it. It's here:
    /usr/local/etc/lighttpd.conf

    In addition to the changes you noted, I also had to add in cgi.assign array, this to the end : , ".php" => "/opt/iphone/bin/php-cgi"

    After that (and following all DeathPrawn's instructions), it worked like a treat!

    All hail DeathPrawn!! Really nice, thanks again.
    2007-11-10 01:18 AM
  9. bobjames's Avatar
    I install apache and then open to safari and type in the web address where I get a message from apache saying software successfully installed.

    I then use mobile finder to navigate to library but there is no WebServer folder and I can't find any file called index.html

    Am i supposed to create the webserver and documents folders manually?

    any help appreciated

    No worries figure it out but safari doesn't seem to be able to open all PDFs, sometimes it just gives a grey page.
    Last edited by bobjames; 2007-11-17 at 03:18 PM. Reason: Automerged Doublepost
    2007-11-17 03:18 PM
  10. ilianto's Avatar
    Guys, I tried this lighttpd way but I don't know what to key in Safari window in order to go to that view DeathPrawn posted. Can u try and do a step by step little guide as I might have put a line at the wrong place in lighttpd.conf.

    Also is there a way not to have space problems when uploading pdf boooks?

    Thanx in advance...
    2007-11-17 11:28 PM
  11. drnrat's Avatar
    it works great .... it's so much easier to read a pdf/txt in safari than in any pdf readear or books ... large files one fast, you can play with landscape and portrait ....

    one single problem: maybe you guys can help me!?

    when in offline mode, i can't use safari! ... i get the "safari can't open the page because it can't find the server." message ....

    but these files are local files ....

    is there a trick that can be done?!

    Thanx!
    2008-01-29 04:53 PM
  12. Eurisko's Avatar
    could you use that method to store web apps locally? because that would be amazing....
    Yes, I've been doing that for while. You can store entire websites locally and access them via Safari. I mainly store games, and information sites.

    Books.app only reads Txt and HTML. If you want a PDF Reader you can get one through the installer. It's called PDFViewer, available through Conceited's Installer Repository.
    Get "iPod & iTunes for Dummies", it'll change your life.
    2008-01-29 05:15 PM
  13. drnrat's Avatar
    "when in offline mode, i can't use safari! ... i get the "safari can't open the page because it can't find the server." message ....

    but these files are local files ....

    is there a trick that can be done?!"

    i found the problem .... http://localhost works when edge, wifi are active ... but not in offline mode ....127.0.0.1 works all the time ....
    2008-01-29 06:24 PM
  14. drnrat's Avatar
    "when in offline mode, i can't use safari! ... i get the "safari can't open the page because it can't find the server." message ....

    but these files are local files ....

    is there a trick that can be done?!"

    i found the problem .... http://localhost works when edge, wifi are active ... but not in offline mode ....127.0.0.1 works all the time ....
    2008-01-29 06:25 PM
  15. 4nic8tor's Avatar
    Ok, I have everything setup as per the instructions here. When I go to 127.0.0.1 I just get a 'Hello Web' iPod. When I go to 127.0.0.1/.dirlist/ I can see the contents of the folder and if I try 127.0.0.1/.dirlist/dir-generator.php it says Errorrr. I can put PDFs into a folder called PDF inside of .dirlist/ and I can view them in Safari as intended but I am not getting the benefit of the .php and .css style sheet. What am I doing wrong?
    Last edited by 4nic8tor; 2008-02-03 at 12:13 AM.
    2008-02-03 12:06 AM
  16. drnrat's Avatar
    i had to play with some paths in httpd.conf to make it work!

    question: how can i hack the http address of the pdf i'm reading to make it open at a certain page?
    thanx!
    2008-02-03 04:56 PM
  17. -V-O-Y-A-G-E-R-'s Avatar
    I modified .conf file as advised, but I still see the default lighttpd index page. How come? If I try to navigate manually to .dirlist, I get 404 error.

    What could go wrong?
    Later I'll attach my .conf file..it might be my bad editting.
    2008-02-07 01:01 PM
  18. -V-O-Y-A-G-E-R-'s Avatar
    As promissed...

    Yesterday I upgraded to 1.1.3.

    Installed PHP and lighttpd, can access "hello web" index page.

    Created .dirlist folder and unpacked dirlist.zip content inside.

    Also modified lighttpd.conf as guided, but I guess that I did a bad job.

    Code:
    server.document-root = "/private/var/root/Sites/"
    # server.port = 80 # Default
    #server.bind = "127.0.0.1" # Default: All
    server.modules = ( "mod_cgi","mod_indexfile" )
    server.tag = "iPhone lighttpd"
    
    #server.pid-file            = "/var/run/lighttpd.pid"
    
    accesslog.filename = "/var/log/lighttpd/access.log"
    server.errorlog = "/var/log/lighttpd/error.log"
    
    index-file.names = ( "index.php", "index.py", "index.pl", "index.cgi", "index.html", "default.html", "/.dirlist/dir-generator.php" )
    url.access-deny = ( "~", ".inc" )
    static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".cgi", ".py" )
    
    cgi.assign = ( ".pl"  => "/usr/bin/perl", ".py" => "/usr/bin/python", ".rb" => "/usr/local/bin/ruby", ".cgi" => "", ".sh" => "", ".php" => "/opt/iphone/bin/php-cgi" )
    
    mimetype.assign             = (
    	".pdf"          =>      "application/pdf",
    	".sig"          =>      "application/pgp-signature",
    	".spl"          =>      "application/futuresplash",
    	".class"        =>      "application/octet-stream",
    	".ps"           =>      "application/postscript",
    	".torrent"      =>      "application/x-bittorrent",
    	".dvi"          =>      "application/x-dvi",
    	".gz"           =>      "application/x-gzip",
    	".pac"          =>      "application/x-ns-proxy-autoconfig",
    	".swf"          =>      "application/x-shockwave-flash",
    	".tar.gz"       =>      "application/x-tgz",
    	".tgz"          =>      "application/x-tgz",
    	".tar"          =>      "application/x-tar",
    	".zip"          =>      "application/zip",
    	".mp3"          =>      "audio/mpeg",
    	".m3u"          =>      "audio/x-mpegurl",
    	".wma"          =>      "audio/x-ms-wma",
    	".wax"          =>      "audio/x-ms-wax",
    	".ogg"          =>      "application/ogg",
    	".wav"          =>      "audio/x-wav",
    	".gif"          =>      "image/gif",
    	".jpg"          =>      "image/jpeg",
    	".jpeg"         =>      "image/jpeg",
    	".png"          =>      "image/png",
    	".xbm"          =>      "image/x-xbitmap",
    	".xpm"          =>      "image/x-xpixmap",
    	".xwd"          =>      "image/x-xwindowdump",
    	".css"          =>      "text/css",
    	".html"         =>      "text/html",
    	".htm"          =>      "text/html",
    	".js"           =>      "text/javascript",
    	".asc"          =>      "text/plain",
    	".c"            =>      "text/plain",
    	".cpp"          =>      "text/plain",
    	".log"          =>      "text/plain",
    	".conf"         =>      "text/plain",
    	".text"         =>      "text/plain",
    	".txt"          =>      "text/plain",
    	".dtd"          =>      "text/xml",
    	".xml"          =>      "text/xml",
    	".mpeg"         =>      "video/mpeg",
    	".mpg"          =>      "video/mpeg",
    	".mov"          =>      "video/quicktime",
    	".qt"           =>      "video/quicktime",
    	".avi"          =>      "video/x-msvideo",
    	".asf"          =>      "video/x-ms-asf",
    	".asx"          =>      "video/x-ms-asf",
    	".wmv"          =>      "video/x-ms-wmv",
    	".bz2"          =>      "application/x-bzip",
    	".tbz"          =>      "application/x-bzip-compressed-tar",
    	".tar.bz2"      =>      "application/x-bzip-compressed-tar",
    	# default mime type
    	""              =>      "application/octet-stream",
    )
    Now I can navigate to ie. .pdf file I placed in root/Sites, but where it should be in order to have it listed (browse and click) and not to have to type it's name in addressbar?

    Thanks
    2008-02-20 11:59 PM
  19. -V-O-Y-A-G-E-R-'s Avatar
    Today I returned to this, read forum bit more and found some other useful tips

    Ie, http://www.modmyi.com/forums/showpos...5&postcount=15

    dir-listing.activate = "enable"
    +
    "mod_dirlisting"

    I've also renamed .dirlist folder to .dirlist, as it was named :2dirlist for some reason (as Finder cannot add dot in the name, I used DiskOrder to rename dirlist to .dirlist, and then copied that folder to iPhone, but it's name got converted ) and reloaded 127.0.0.1 page and there it was..in its full colors

    I've opened a new thread with all modifications in one place.

    PDF/CHM/DOC/XLS/photo viewer - all-in-one Safari/Lighttpd based (complete instruct.)

    Resulting look...

    Last edited by -V-O-Y-A-G-E-R-; 2008-03-06 at 12:56 PM. Reason: Automerged Doublepost
    2008-03-06 12:56 PM
LINK TO POST COPIED TO CLIPBOARD