二.安裝 現(xiàn)在,下載完畢了吧,我們可以進(jìn)行安裝了。 " /> 五月激情综合,中文字幕 在线观看,夜夜av

中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

PHP讀取PDF內(nèi)容配合Xpdf的使用

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

二.安裝
現(xiàn)在,下載完畢了吧,我們可以進(jìn)行安裝了。
[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
如果不需要讀取中文的話,到這里就可以結(jié)束了,如果需要,那我們繼續(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 的內(nèi)容復(fù)制到/usr/local/etc/xpdfrc文件中。記得里面的路徑要正確。(注意,這里面的簡(jiǎn)體中文包包括以下三種格式:ISO-2022-CN,EUC-CN,GBK ,看清楚哦,不支持UTF-8,可以先轉(zhuǎn)為GBK,然后進(jìn)行轉(zhuǎn)義)

三.功能實(shí)現(xiàn)
至此,所有的配置完畢,我們要開(kāi)始使用它了。
如果是簡(jiǎn)單的PDF讀取,那么直接用下面的語(yǔ)句就OK了。
$content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -');
如果需要轉(zhuǎn)中文,如此這般,加上參數(shù)。
$content = shell_exec('/usr/local/bin/pdftotext -layout -enc GBK '.$filename.' -');
當(dāng)然,加了參數(shù)之后依然是不影響英文的轉(zhuǎn)換的,所以,放心使用吧。需要注意的是,這里轉(zhuǎn)出來(lái)的是GBK編碼的哦,現(xiàn)在網(wǎng)站很多用的是UTF-8,想要不顯示亂碼的話,需要再次轉(zhuǎn)義一下哦。
$content = mb_convert_encoding($content, 'UTF-8','GBK');
至此,就大功告成了。讀取出來(lái)的內(nèi)容,你想如何使用,再寫(xiě)代碼處理吧。
最后加一下pdftotext 的參數(shù)說(shuō)明給大家。

主要參數(shù)如下:
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技術(shù)PHP讀取PDF內(nèi)容配合Xpdf的使用,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 成人av久久| 九九热视频这里只有精品 | 成人在线免费电影 | 久久精品国产亚洲一区二区三区 | 日韩在线免费播放 | 日本在线网站 | 国产福利久久 | 成人免费观看男女羞羞视频 | 天天干夜夜 | 亚洲一区中文字幕 | www.婷婷| 丝袜 亚洲 欧美 日韩 综合 | 国产在线看片 | 国产成都精品91一区二区三 | 欧美涩 | 狠狠插天天干 | 九九热在线免费视频 | 91精品国产自产在线老师啪 | 伊人色综合久久天天五月婷 | 九九久久国产 | 精品国产一区二区三区久久久蜜月 | 99re免费 | 91精品国产92 | 91九色视频| 国产精品久久久久久久久久久免费看 | 国产美女永久免费无遮挡 | 一区二区三区四区在线 | 久草在线 | 视频一区在线观看 | 亚洲精品久久久久久国产精华液 | 99热.com | 成人国产一区二区三区精品麻豆 | 午夜精品久久久久久久久久久久 | 欧美日韩久 | 国产在线一区二区三区 | 色性av | 欧美寡妇偷汉性猛交 | 国产精品一区二区视频 | 欧美日韩亚洲国产 | 日韩成人在线播放 | 久久精品中文字幕 |