lovasoa/ophir
最新稳定版本:0.1
Composer 安装命令:
composer require lovasoa/ophir
包简介
Convert ODT (OpenDocument) files to HTML
README 文档
README
PHP script that converts ODT to HTML
ophir.php is a lightweight script that parses an open document file and outputs a simple HTML file, with very few tags (contrarily to most other tools that do the same thing).
Features
Currently, the script can convert the following:
- bold (
<strong>tag) - italic (
<i>tag) - underline (
<u>tag) - quotations (
<blockquote>tag) - images (using data URIs)
- links
- headings (h1, h2, ...)
- lists (ul and li)
- tables (table tr and td)
- annotations
- footnotes.
Ophir.php can also ignore or remove some tags on demand. This can be useful if you want to extract only unformatted text from a document, or if you don't want tables, footnotes or annotations in the resulting HTML, or if the application that generated the ODT file produced unnecessary formatting informations ...
Limitations
Everything that is not mentioned in the feature section is not supported.
How to use this script
This script requires libzip and XMLReader, that are usually installed by default with php5. If you meet these requirements, just put ophir.php on your server, and use it like that:
require("ophir.php"); $OPHIR_CONF["footnote"] = 0; //Do not import footnotes $OPHIR_CONF["annotation"] = 0; //Do not import annotations $OPHIR_CONF["list"] = 1; //Import lists, but prints them as simple text (no ul or li tags will be generated) $OPHIR_CONF["link"] = 1; //Import links, but prints them as simple text (only extract text from the links) /*Available parameters are: "header", "quote", "list", "table", "footnote", "link", "image", "note", and "annotation" */ echo odt2html("/path/to/file.odt");
License
Ophir.php is under LGPLv3. You can use it in both your free and proprietary software projects, but if you change some of the code, you have to share your improvements. Full license informations available at http://www.gnu.org/licenses/lgpl.html.
Other scripts
This script was coded in one afternoon to answer to my personal needs. More professional tools, with more features, that produce uglier HTML files are available:
-
https://github.com/lovasoa/ophir_odt_import A drupal 7 module I created that uses ophir.php to import ODT files to Drupal.
-
http://odt2xhtml.eu.org/ (in PHP)
-
http://www.artofsolving.com/opensource/jodconverter (in java)
-
http://www.openoffice.org/udk/python/python-bridge.html (in Python)
lovasoa/ophir 适用场景与选型建议
lovasoa/ophir 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 173 次下载、GitHub Stars 达 18, 最近一次更新时间为 2014 年 05 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lovasoa/ophir 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lovasoa/ophir 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 173
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-05-13