在PHP中将高质量的PDF转换为Word? [英] High-quality PDF to Word conversion in PHP?

查看:176
本文介绍了在PHP中将高质量的PDF转换为Word?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP中将PDF文档转换为Microsoft Word格式的最佳方法是什么?这可以是PHP脚本,也可以是(Linux)可执行文件(使用proc_open()).它只需要相对较快并生成高质量的Word文档(97/2000/2003格式)即可.

What's the best way of converting PDF docs to Microsoft Word format in PHP? This can be either as a PHP script or calling a (Linux) executable (with proc_open()). It just needs to be relatively fast and produce quality Word documents (in 97/2000/2003 format).

商业软件还可以.

推荐答案

要阅读 PDF 文件,您需要安装

To read PDF files, you will need to install the XPDF package, which includes "pdftotext." Once you have XPDF/pdftotext installed, you run the following PHP statement to get the PDF text:

content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -');

获取内容后,下载 PHPDOCX 社区版本,请尝试这样.

After getting the content, Download PHPDOCX Community version, try like this.

<?php
require_once '../../classes/CreateDocx.inc';

$docx = new CreateDocx();
$textInfo = $content;

$paramsTextInfo = array(
    'val' => 1,
    'i' => 'single',
    'sz' => 8
);

$docx->addText($textInfo, $paramsTextInfo);

$docx->createDocx('report.docx');
?>

这篇关于在PHP中将高质量的PDF转换为Word?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆