XPDF3.04 extracting Chinese text from a PDF

Source: Internet
Author: User

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:

  1. Download Xpdf and Chinese fonts and unzip them separately.

  2. 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.

  3. 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

  4. #-----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
  5. Experiment Code

  6. @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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.