二.安裝 現在,下載完畢了吧,我們可以進行安裝了。 " /> 国产1769一七六九视频在线,5580免费午夜福利院,一个人在线观看免费高清视频在线观看

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

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
如果不需要讀取中文的話,到這里就可以結束了,如果需要,那我們繼續往后
[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的使用,轉載需保留來源!

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

主站蜘蛛池模板: 强奷乱码中文字幕熟女免费 | 一区二区三区毛AAAA片特级 | 久久99r66热这里有精品 | yellow视频免费观看高清在线 | 九九99亚洲精品久久久久 | 亚洲 制服 欧美 中文字幕 | 黄色a三级三级三级免费看 黄色a三级免费看 | 国产在线高清视频无码 | 麻豆国产精品AV色拍综合 | 亚洲AV怡红院影院怡春院 | J午夜精品久久久久久毛片 jzz大全18 | 久久国产乱子伦精品免费不卡 | 欧美激情一区二区三区四区 | 亚洲精品午睡沙发系列 | 乳欲性高清在线 | 暖暖视频 免费 高清 日本8 | 亚洲激情一区 | 把她带到密室调教性奴 | 精品国产一区二区三区久久影院 | 精品美女国产互换人妻 | 热思思 | 精品无码国产污污污免费网站2 | 牛牛自拍国产免费视频 | 国产精品嫩草影院一区二区三区 | 天堂Av亚洲欧美日韩国产综合 | 99国产视频 | 久亚洲AV无码专区A片 | 久久re热在线视频精69 | 伊人久久综合影院首页 | 亚洲国产欧美日韩在线一区 | 日韩中文无线码在线视频 | 幻女FREE性俄罗斯学生 | 邪恶肉肉全彩色无遮盖 | 果冻传媒2021一二三在线观看 | 成在线人免费 | 光溜溜的美女直播软件 | 动漫美女性侵 | 久久黄色精品视频 | 97色伦在色在线播放 | 欧美牲交A欧美牲交VDO | 快播理伦片 |