二.安裝 現在,下載完畢了吧,我們可以進行安裝了。 " /> 免费啪啪社区免费啪啪手机版,国产精品久久久亚洲,国产精品欧美日韩

一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

PHP讀取PDF內容配合Xpdf的使用

一.下載
首先,我們先把資料下下來先。
如果不需要轉中文的話,只需要下載它就可以:xpdf-bin-linux-3.03.tar,如果需要轉中文,那你就還需要它了:xpdf-chinese-simplified.tar

二.安裝
現在,下載完畢了吧,我們可以進行安裝了。
[root@localhost ~]# mkdir -p /lcf/upan
[root@localhost ~]# mkdir -p /lcf/cdrom
[root@localhost ~]# mkdir -p /lcf/xpdf
[root@localhost ~]# cd /lcf/upan/
[root@localhost upan]# cp xpdf/* ../xpdf/ (下載的文件放入/lcf/xpdf目錄)
[root@localhost upan]# cd ../xpdf/
[root@localhost xpdf]# tar -zxvf xpdfbin-linux-3.03.tar.gz
[root@localhost xpdf]# cd xpdfbin-linux-3.03
[root@localhost xpdfbin-linux-3.03]# cat INSTALL
[root@localhost xpdfbin-linux-3.03]# cd bin32/
[root@localhost bin32]# cp ./* /usr/local/bin/
[root@localhost bin32]# cd ../doc/
[root@localhost doc]# mkdir -p /usr/local/man/man1
[root@localhost doc]# mkdir -p /usr/local/man/man5
[root@localhost doc]# cp *.1 /usr/local/man/man1
[root@localhost doc]# cp *.5 /usr/local/man/man5
如果不需要讀取中文的話,到這里就可以結束了,如果需要,那我們繼續(xù)往后
[root@localhost doc]# cp sample-xpdfrc /usr/local/etc/xpdfrc
[root@localhost xpdf]# cd /lcf/xpdf
[root@localhost xpdf]# tar -zxvf xpdf-chinese-simplified.tar.gz
[root@localhost xpdf]# cd xpdf-chinese-simplified
[root@localhost xpdf]# mkdir -p/usr/local/share/xpdf/chinese-simplified
[root@localhost xpdf]# cd xpdf-chinese-simplified/
[root@localhost xpdf-chinese-simplified]# cp Adobe-GB1.cidToUnicode ISO-2022-CN.unicodeMap EUC-CN.unicodeMap GBK.unicodeMap CMAP /usr/local/share/xpdf/chinese-simplified/
把chinese-simplified里面文件add-to-xpdfrc 的內容復制到/usr/local/etc/xpdfrc文件中。記得里面的路徑要正確。(注意,這里面的簡體中文包包括以下三種格式:ISO-2022-CN,EUC-CN,GBK ,看清楚哦,不支持UTF-8,可以先轉為GBK,然后進行轉義)

三.功能實現
至此,所有的配置完畢,我們要開始使用它了。
如果是簡單的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 <pre> and </pre> and prepends the
meta headers.
-enc encoding-name

php技術PHP讀取PDF內容配合Xpdf的使用,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 色呦呦网站入口 | 在线国产福利 | 青草国产在线观看 | 精品久久久噜噜噜久久7 | 香蕉成人啪国产精品视频综合网 | 天天做天天爱天天爽天天综合 | 久久大香伊蕉在人线国产昨爱 | 精品午夜久久福利大片免费 | 夜色55夜色66亚洲精品网站 | 女的毛片毛片毛毛片毛毛毛毛片 | 99精品大香线蕉线伊人久久久 | 韩国一级永久免费观看网址 | 综合激情网五月 | 国内精品91最新在线观看 | 美女免费精品高清毛片在线视 | 国产女人视频免费观看 | 亚洲免费久久 | 亚洲狠狠狠一区二区三区 | 91白丝制服被啪到喷水在线 | 久久久一区二区三区 | 视频一区二区国产 | 国产高清精品一级毛片 | 国产精品亚洲国产三区 | 91亚洲国产系列精品第56页 | 色老板在线影院 | 四虎永久免费网站免费观看 | 99re这里只有精品66 | 涩综合| 国产永久免费视频 | 亚洲天堂黄色 | 国产对白在线播放九色 | 亚洲欧美手机在线观看 | 91一个人的在线观看www | 国内精品久久久久久野外 | 福利片欧美| 亚洲狠狠97婷婷综合久久久久 | 精品欧美一区二区三区在线观看 | 久久人人青草97香蕉 | 一区二区三区免费视频网站 | 手机在线黄色网址 | 国产精选第一页 |