php读取pdf文件乱码_使用php读取pdf文件

Hi,

I have a bulk of pdf documents. I want to read that using php script. I searched a lot, but everyone is about creating pdf files. Here I dont want to create pdf file but I want to read it. Is there any way to read it php?

-Arun

解决方案

You can easily read the contents of a PDF file using a command-line utility like Pdftotext which you can call through exec.

This is an example of what i mean, actually using system

system("pdftotext your.pdf /tmp/txtfile.txt");

$text = file_get_contents("/tmp/txtfile.txt");

EDIT

didn't know about the dash syntax - this is even better:

$content = shell_exec('pdftotext your.pdf -');

This does require pdftotext to be installed on your server though. On a CentOS server this would be:

yum install xpdf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值