Development environment: Windows8.0 X64 bit eclipse3.2
Version number: xpdfbin-win-3.04 xpdf-chinese-simplified.tar.gz
Download path: ftp://ftp.foolabs.com/pub/xpdf/
Operation Steps:
Download Xpdf and Chinese fonts and unzip them separately.
Build xpdf root directory d:\xpdf,
(1) and copy all files under the Xpdfbin-win-3.04\bin64 directory to d:\xpdf.
(2) Copy the entire Xpdf-chinese-simplified folder to D:\xpdf.
Copy the SAMPLE-XPDFRC file under the Xpdfbin-win-3.04\doc path to d:\xpdf, and rename it to XPDFRC.
(1) Modify the file XPDFRC line 73rd, open the textencoding UTF-8 Note, specify the encoding as UTF-8,
(2) Add the Textpagebreaks no parameter below, meaning that no line breaks are added to the two pages of the PDF document.
(3) At the end of this document, add the following content, the declaration of the text body file
#-----Begin Chinese Simplified Support package (2011-sep-02) Cidtounicode adobe-gb1 d:/xpdf/xpdf-chinese-simplified/ Adobe-gb1.cidtounicodeunicodemap ISO-2022-CN D:/xpdf/xpdf-chinese-simplified/iso-2022-cn.unicodemapunicodemap EUC-CN D:/xpdf/xpdf-chinese-simplified/euc-cn.unicodemapunicodemap GBK d:/xpdf/xpdf-chinese-simplified/ Gbk.unicodemapcmapdir ADOBE-GB1 D:/xpdf/xpdf-chinese-simplified/cmaptounicodedir D:/xpdf/xpdf-chinese-simplified/ CMAP#DISPLAYCIDFONTTT adobe-gb1 D:/xpdf/xpdf-chinese-simplified/cmap/gkai00mp.ttf #fontFileCC adobe-gb1/usr/..../ gkai00mp.ttf#-----End Chinese Simplified support package
Experiment Code
@Testpublic void Xpdfparser () {try {cmd = ' d:\\xpdf\\pdftotext.exe-enc UTF-8-Q d:\\datadir\\web Data Mining overview. PDF D: \\datadir\\pdftxtdir\\Web Data Mining Overview. txt "; Runtime.getruntime (). exec (CMD); } catch (IOException e) {e.printstacktrace (); } }
The above code is not complete, mainly is the Xpdf path setting may have the problem, in addition is the Chinese font file path setting must be correct, otherwise the exported TXT file does not have the content.If there is no clear place, or find a problem, you can reply to me, thank you!
XPDF3.04 extracting Chinese text from a PDF