Loading [Contrib]/a11y/accessibility-menu.js
メインコンテンツに移動

poppler

使い方

添付ファイルを取り出すpdfdetatch

使用例

$ pdfdetatch -list my.pdf
1 embedded files
1: /Users/...../animation.png
$ pdfdetach -save 1 my.pdf -o my.png

フォントを調べるpdffonts

使用例

$ pdffonts my.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
WNIIQH+HaranoAjiGothic-Medium        CID Type 0C       Identity-H       yes yes yes    465  0
TDHEJQ+LMSans17-Regular              Type 1            Custom           yes yes no     466  0
SKVZPG+LMSans8-Regular               Type 1            Custom           yes yes no     472  0
DVBIGN+MSAM7                         Type 1            Builtin          yes yes no     473  0
LNGCVG+HaranoAjiMincho-Regular       CID Type 0C       Identity-H       yes yes yes    474  0
BLAYRS+LMRoman10-Bold                Type 1            Custom           yes yes no     512  0
...

情報を調べるpdfinfo

使用例

$ pdfinfo my.pdf
Title:          
Subject:        
Keywords:       
Author:         
Creator:        LaTeX with hyperref
Producer:       macOS バージョン11.5.2(ビルド20G95) Quartz PDFContext, AppendMode 1.1
CreationDate:   Sat Jan 30 15:41:10 2021 JST
ModDate:        Sat Sep  4 11:07:55 2021 JST
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          138
Encrypted:      no
Page size:      595.276 x 841.89 pts (A4)
Page rot:       0
File size:      51399028 bytes
Optimized:      no
PDF version:    1.5

ページを取り出すpdfseparate

使用例. 5ページ目から10ページ目を1枚づつ取り出す

$ pdfseparate -f 5 -l 10 fd1-R5.pdf out%d.pdf

ページを合併pdfunite

使用例. 6ページを一つのPDFに

$ pdfunite out5.pdf out6.pdf out7.pdf out8.pdf out9.pdf out10.pdf out5-10.pdf

インストール

M1-Macであれば,普通にこれと,ええっとこれもね.Intel? まあ下と同じようにビルドできるのでは

ビルド

普通通り

git clone https://gitlab.freedesktop.org/poppler/poppler.git
cd poppler
mkdir build
cmake ..

おや.OpenJPEGとかいうのが必要だそうだ.

cd ../..
git clone https://github.com/uclouvain/openjpeg.git
cd openjpeg
mkdir build
cmake ..
make
fswatch -x /usr/local > files.txt &
sudo make install
kill %1
fswatch_analyze.sh -c _binary files.txt
lipo -info _binary/usr/local/lib/libopenjp2.dylib
Non-fat file: _binary/usr/local/lib/libopenjp2.dylib is architecture: arm64
# つまり M1-Mac 専用ですね.
pkgbuild --identifier openjpeg --root _binary openjpeg-osx11.5-arm64.pkg
cd ../..

では再度やってみる.

cd poppler
mkdir build
cmake ..
make

おやおや

/bin/sh: clang-format: command not found
[ 49%] Built target poppler-qt5_autogen
/Users/sugimoto/Documents/Source/Free/poppler/qt5/src/poppler-annotation.h:97:5: note: 'findChildElement' has been explicitly marked deprecated here
・・・

なにやらQt5に文句があるらしい.そったらもん,オイラは使わねえだ.

cd poppler
mkdir build
cmake .. -D ENABLE_QT5=OFF
make
fswatch -x /usr/local > files.txt &
sudo make install
kill %1
fswatch_analyze.sh -c _binary files.txt
lipo -info _binary/usr/local/bin/pdfinfo
Non-fat file: _binary/usr/local/bin/pdfinfo is architecture: arm64  <--- まあM1-Mac専用ですよね
pkgbuild --identifier poppler --root _binary poppler-osx11.5-arm64.pkg

というわけですね.

File attachments
添付 サイズ
poppler-osx11.5-arm64.pkg 1.37 MB