开发者

How to read pdf, ppt, xl, doc files content into a string in php/python [closed]

开发者 https://www.devze.com 2022-12-27 00:48 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_运维百科

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

Pls suggest me any inbuilt command or package?


well, it shouldn't be too hard to find something from the net. Here's one for Python called pyPDF. Check PyPi also for such modules. As for reading doc,ppt,xls files, one way is to use COM.


The content as in "binary" or the actual text?

To read the file as "binary" in php: http://php.net/manual/en/function.file.php

In python: http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files

Actually reading the contents of the file is a lot more difficult and requires additonall libraries. For instance have a look at this question on SO (Python): python convert microsoft office docs to plain text on linux


Try this:

$data = fopen('myfile.png', 'rb'); // read in binary mode.

if ($data) {
  header('Content-Type: image/png');
  fpassthru($data);
}

You should change content-type accordingly.

0

精彩评论

暂无评论...
验证码 换一张
取 消