arx Posted October 21, 2008 Share Posted October 21, 2008 I'm looking to know whether or not I can/should use PHP to do the following: Run an eBook library - simply associating eBook .txt files with tags and being able to use these tags in a search bar to call up the .txt AND Display the .txt: in X word chunks (so it displays 500 words on the site, then when prompted displays the next 500 etc), in a customizable font, with a page number (first 500 words - first page, second five hundred words - second page etc). What I'm doing, if you need to imagine it, is making an actual online book to display these eBooks in. I need to keep them in .txt format because it's obviously the easiest to work with/smallest. If you don't think PHP is the best language for the job, please suggest another Quote Link to comment Share on other sites More sharing options...
alexweber15 Posted October 23, 2008 Share Posted October 23, 2008 im just going to go ahead and assume that you own and scanned all these ebooks you mentioned for the sake of avoiding controversy... and who's to say you didn't in the first place right? just an observation: you said you chose .txt because its smaller and easier to work with. smaller? yes; easier to work with? not necessarily. in fact it might actually be more difficult! and out of curiosity: do you have these ebooks in txt format already or are you planning to convert from pdf (or chm) to txt????? anyhow here's why working with PDF is easier: - first off your books are already separated into pages. so no extra work necessary! - i assume you have pdf files to begin with (if not then this whole answer is irrelevant and for that i apologize) - there's more than one good PHP library out there to manipulate PDF files, so I'd say PHP is the best solution. (i swear the bias is purely incidental...) ok enough bs here's how to do it: The best was PDFLib but it only works with PHP4 and is now paid, so these are the alternatives: PHP PDF Classes FPDF Haru PDF Class (extension) cPDF CezPDF ("easy cPDF") File_PDF A Nice Tutorial For Windows Sorry halfway through this post i realized that the best library has sold out (which coincidentally is the one the tutorial uses) and most PDF extensions seem to have halted development or been moved to the PEAR package. I recommend taking a look at FPDF and Haru PDF in that order and hopefully along with the tutorial you'll be able to put it together... I sincerely meant for this post to be more helpful but I hope it at least points you in the right direction) WAIT!!!!! just as i was finishing off this post i decided to check my phpinfo() and whaddya know! pdf PDF Support enabled PDFlib GmbH Version 5.0.3 PECL Version 2.1.4 (this coming from a standard XAMPP install on Windows) so i guess you DO have access to PDFLib in the end (or maybe its just a trial or something) and either way the PECL extension is preinstalled too, so maybe there is hope! anyway normally i'd try and start you off with some code but its almost 8am and ive been up all night planning a project, working on another and catching up on reading and whatnot and I gotta be at work in an hour...lol anyway good luck and post back im sure youll get it working! (and dont fear the PDF!!! .txt is so.... notepad... Quote Link to comment Share on other sites More sharing options...
elias Posted June 10, 2009 Share Posted June 10, 2009 Hi Alex I know this is a little old now, but I have been searching this forum and the web for this sort of thing for ages, and there is still no clear solution. Most of the suggestions you make are to convert text/html INTO pdf, but not the other way around. Have you manipulated pdf files as you suggest? If so, I would be *really* interested to know how you've done it, as I cant find any way of doing it to date. Cheers elias Quote Link to comment Share on other sites More sharing options...
alexweber15 Posted June 10, 2009 Share Posted June 10, 2009 hey wow you really dug this one from outta the grave eh! lemme catch up and ill reply in a bit! Quote Link to comment Share on other sites More sharing options...
elias Posted June 10, 2009 Share Posted June 10, 2009 HI Alex Yes, from teh "wayback machine", but there is so little on this topic, that your post seemed the most promising... To put you in the picture, what I am trying to do is analyse Sporting Results Data that is issued in PDF format after every competition - see attached: InfantilFemenina_FS_Scores.pdf I have copy/pasted it into a TXT document - see attached: InfantilFemenina_FS_Scores.txt I can do this every time, just create a text file and the parse through this one, and that is my current line of attack, but generally, my rule of thumb is "if it can be done manually, it should be possible to automate it", but how? :-) Anyhow, I look forward to your reply, in the meantime, I shall start on the still necessary job of parsing through the data. Cheers and TIA Elias [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.