PHP¶ÁÈ¡PDFÄÚÈÝ£¨LINUXÏÂXPDFµÄÅäÖúÍʹÓã©
Ê×ÏÈ£¬ÎÒÃÇÏÈ°Ñ×ÊÁÏÏÂÏÂÀ´ÏÈ¡£ÏÂÔصØÖ·ÔÚÕâÀhttp://www.foolabs.com/xpdf/download.html
Èç¹û²»ÐèҪתÖÐÎĵĻ°£¬Ö»ÐèÒªÏÂÔØËü¾Í¿ÉÒÔ£º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
.' -');
µ±È»£¬¼ÓÁ˲ÎÊýÖ®ºóÒÀÈ»ÊDz»Ó°ÏìÓ¢ÎĵÄת»»µÄ£¬ËùÒÔ£¬·ÅÐÄʹÓðɡ£ÐèҪעÒâµÄÊÇ£¬ÕâÀïת³öÀ´µÄÊÇ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
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ