Does a PHP library exist to work with PRC/.mobi files?

怎甘沉沦 提交于 2019-12-06 10:26:16

问题


I'm writing a WordPress plugin to create an eBook from a selected category in most major eBook formats. I would like to support MobiPocket since that's the format used by the Kindle but I'm not sure how to go about it. From what I've read .mobi files are actually Palm Resource Databases (PRC) but I haven't been able to find a PHP class to work with these.

I thought about using exec along with KindleGen but that would be undesirable as it would complicate initial setup. I've also thought about hosting a web service somewhere and using XML-RPC to accomplish this but that also complicates things.

My question is: is there a PHP class/library (PHP-only preferred) that can work with PRC or even better, a class that specialises in creating MobiPocket ebooks? (needs to be open source since I'm releasing under the GPL)

I've tried searching but haven't been able to find anything.


回答1:


I don't know whether you're still looking for this PHP library, but just in case: https://github.com/raiju/phpMobi. This is a library that creates mobi files from html files.

It's should still be seen as an experimental version, but it should work without a problem for basic document with a few images.




回答2:


Unfortunately not; however, the binary compiled format is an open specification available at: http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen

The only direct way of transforming the uncompiled format is using the native XML functionality of PHP to create them and then invoking a compiler with exec, which I understand you don't want to do. If you go with this route, the link above also has details about this XML format.




回答3:


You might want to try the mobiperl tools,

https://dev.mobileread.com/trac/mobiperl/wiki

Please note I haven't tested them yet. But they have been around since at least 2007 so they should work well by now. google "Mobiperl - Perl tools for handling MobiPocket files" to find a thread on mobileread board discussing it. As a new poster I can't put 2 hyperlinks into my reply.




回答4:


Another tool I have recently found (but not yet tested), is: http://www.phpclasses.org/package/8173-PHP-Generate-Kindle-ebook-file-in-mobi-format.html#files

It is based upon KindleGen, and looks pretty straight forward to implement.



来源:https://stackoverflow.com/questions/2242548/does-a-php-library-exist-to-work-with-prc-mobi-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!