Skip to content

Instantly share code, notes, and snippets.

@tokestermw
Last active May 7, 2018 09:26
Show Gist options
  • Save tokestermw/111dcdc46ad1c8eac663bd7378490ca5 to your computer and use it in GitHub Desktop.
Save tokestermw/111dcdc46ad1c8eac663bd7378490ca5 to your computer and use it in GitHub Desktop.
Make pdftotext compatible with Japanese text on Mac OS.
# -- set up repos
brew install Caskroom/cask/xquartz
# -- install xpdf
brew install xpdf
# -- download japanese package
wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-japanese.tar.gz
# -- open
tar -xzvf xpdf-japanese.tar.gz
# -- make required directory
mkdir /usr/local/share/xpdf
mkdir /usr/local/share/xpdf/japanese
# -- copy over the japanese files
cp -r xpdf-japanese/ /usr/local/share/xpdf/japanese
# -- check location of xpdf
brew ls xpdf
# -- copy over contents of add-to-xpdfrc to xpdfrc
cat xpdf-japanese/add-to-xpdfrc >> /usr/local/Cellar/xpdf/3.04_1/etc/xpdfrc
# -- now test with a pdf with Japanese
pdftotext random.pdf random.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment