如果不需要读取中文的话,到这里就可以结束了,如果需要,那我们继续往后
把chinese-simplified里面文件add-to-xpdfrc 的内容复制到/usr/local/etc/xpdfrc文件中。记得里面的路径要正确。(注意,这里面的简体中文包包括以下三种格式:iso-2022-cn,euc-cn,gbk ,看清楚哦,不支持utf-8,可以先转为gbk,然后进行转义)
PHP 网络编程技术与实例(曹衍龙)
查看详情
PHP网络编程技术详解由浅入深,全面、系统地介绍了PHP开发技术,并提供了大量实例,供读者实战演练。另外,笔者专门为本书录制了相应的配套教学视频,以帮助读者更好地学习本书内容。这些视频和书中的实例源代码一起收录于配书光盘中。本书共分4篇。第1篇是PHP准备篇,介绍了PHP的优势、开发环境及安装;第2篇是PHP基础篇,介绍了PHP中的常量与变量、运算符与表达式、流程控制以及函数;第3篇是进阶篇,介绍
386
三、功能实现 至此,所有的配置完毕,我们要开始使用它了。 如果是简单的PDF读取,那么直接用下面的语句就OK了。 $content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -'); 如果需要转中文,如此这般,加上参数。 $content = shell_exec('/usr/local/bin/pdftotext -layout -enc GBK '.$filename.' -'); 当然,加了参数之后依然是不影响英文的转换的,所以,放心使用吧。需要注意的是,这里转出来的是GBK编码的哦,现在网站很多用的是UTF-8,想要不显示乱码的话,需要再次转义一下哦。 $content = mb_convert_encoding($content, 'UTF-8','GBK'); 读取出来的内容,可以再写代码自行处理。 pdftotext的主要参数: OPTIONS Many of the following options can be set with configuration file com- mands. These are listed in square brackets with the description of the corresponding command line option. -f number Specifies the first page to convert. -l number Specifies the last page to convert. -layout Maintain (as best as possible) the original physical layout of the text. The default is to 'undo' physical layout (columns, hyphenation, etc.) and output the text in reading order. -fixed number Assume fixed-pitch (or tabular) text, with the specified charac- ter width (in points). This forces physical layout mode. -raw Keep the text in content stream order. This is a hack which often "undoes" column formatting, etc. Use of raw mode is no longer recommended. -htmlmeta Generate a simple HTML file, including the meta information. This simply wraps the text in and 登录后复制 |
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号