はじめに
PDF結合をコマンドでできるというのを見たので、試してみようかなと思い実際にやってみた。
環境
Windows 10 Professional
WSL2 - (Ubuntu22.04 LTS)
pdfunite version 22.02.0
pdfuniteのインストール
$ sudo apt-get install poppler-utils
↓インストール実行
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
fontconfig-config fonts-dejavu-core libcairo2 libdeflate0 libfontconfig1 libfreetype6 libjbig0 libjpeg-turbo8
libjpeg8 liblcms2-2 libnspr4 libnss3 libopenjp2-7 libpixman-1-0 libpoppler118 libtiff5 libwebp7 libxcb-render0
libxcb-shm0 libxrender1 poppler-data
Suggested packages:
liblcms2-utils ghostscript fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic
fonts-arphic-ukai fonts-arphic-uming fonts-nanum
The following NEW packages will be installed:
fontconfig-config fonts-dejavu-core libcairo2 libdeflate0 libfontconfig1 libfreetype6 libjbig0 libjpeg-turbo8
libjpeg8 liblcms2-2 libnspr4 libnss3 libopenjp2-7 libpixman-1-0 libpoppler118 libtiff5 libwebp7 libxcb-render0
libxcb-shm0 libxrender1 poppler-data poppler-utils
0 upgraded, 22 newly installed, 0 to remove and 0 not upgraded.
Need to get 8299 kB of archives.
After this operation, 31.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
0% [Working]
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 poppler-data all 0.4.11-1 [2171 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 fonts-dejavu-core all 2.37-2build1 [1041 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy/main amd64 fontconfig-config all 2.13.1-4.2ubuntu5 [29.1 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libfreetype6 amd64 2.11.1+dfsg-1ubuntu0.1 [389 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 libfontconfig1 amd64 2.13.1-4.2ubuntu5 [131 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpixman-1-0 amd64 0.40.0-1ubuntu0.22.04.1 [264 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 libxcb-render0 amd64 1.14-3ubuntu3 [16.4 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy/main amd64 libxcb-shm0 amd64 1.14-3ubuntu3 [5780 B]
Get:9 http://archive.ubuntu.com/ubuntu jammy/main amd64 libxrender1 amd64 1:0.9.10-1build4 [19.7 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 libcairo2 amd64 1.16.0-5ubuntu2 [628 kB]
Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 libdeflate0 amd64 1.10-2 [70.9 kB]
Get:12 http://archive.ubuntu.com/ubuntu jammy/main amd64 libjpeg-turbo8 amd64 2.1.2-0ubuntu1 [134 kB]
Get:13 http://archive.ubuntu.com/ubuntu jammy/main amd64 libjpeg8 amd64 8c-2ubuntu10 [2264 B]
Get:14 http://archive.ubuntu.com/ubuntu jammy/main amd64 liblcms2-2 amd64 2.12~rc1-2build2 [159 kB]
Get:15 http://archive.ubuntu.com/ubuntu jammy/main amd64 libnspr4 amd64 2:4.32-3build1 [119 kB]
Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnss3 amd64 2:3.68.2-0ubuntu1.1 [1280 kB]
Get:17 http://archive.ubuntu.com/ubuntu jammy/main amd64 libopenjp2-7 amd64 2.4.0-6 [158 kB]
Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libjbig0 amd64 2.1-3.1ubuntu0.22.04.1 [29.2 kB]
Get:19 http://archive.ubuntu.com/ubuntu jammy/main amd64 libwebp7 amd64 1.2.2-2 [206 kB]
Get:20 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libtiff5 amd64 4.3.0-6ubuntu0.3 [183 kB]
Get:21 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpoppler118 amd64 22.02.0-2ubuntu0.1 [1077 kB]
Get:22 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 poppler-utils amd64 22.02.0-2ubuntu0.1 [186 kB]
Fetched 8299 kB in 11s (733 kB/s)
Selecting previously unselected package poppler-data.
(Reading database ... 24130 files and directories currently installed.)
Preparing to unpack .../00-poppler-data_0.4.11-1_all.deb ...
Unpacking poppler-data (0.4.11-1) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../01-fonts-dejavu-core_2.37-2build1_all.deb ...
Unpacking fonts-dejavu-core (2.37-2build1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../02-fontconfig-config_2.13.1-4.2ubuntu5_all.deb ...
Unpacking fontconfig-config (2.13.1-4.2ubuntu5) ...
Selecting previously unselected package libfreetype6:amd64.
Preparing to unpack .../03-libfreetype6_2.11.1+dfsg-1ubuntu0.1_amd64.deb ...
Unpacking libfreetype6:amd64 (2.11.1+dfsg-1ubuntu0.1) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../04-libfontconfig1_2.13.1-4.2ubuntu5_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.13.1-4.2ubuntu5) ...
Selecting previously unselected package libpixman-1-0:amd64.
Preparing to unpack .../05-libpixman-1-0_0.40.0-1ubuntu0.22.04.1_amd64.deb ...
Unpacking libpixman-1-0:amd64 (0.40.0-1ubuntu0.22.04.1) ...
Selecting previously unselected package libxcb-render0:amd64.
Preparing to unpack .../06-libxcb-render0_1.14-3ubuntu3_amd64.deb ...
Unpacking libxcb-render0:amd64 (1.14-3ubuntu3) ...
Selecting previously unselected package libxcb-shm0:amd64.
Preparing to unpack .../07-libxcb-shm0_1.14-3ubuntu3_amd64.deb ...
Unpacking libxcb-shm0:amd64 (1.14-3ubuntu3) ...
Selecting previously unselected package libxrender1:amd64.
Preparing to unpack .../08-libxrender1_1%3a0.9.10-1build4_amd64.deb ...
Unpacking libxrender1:amd64 (1:0.9.10-1build4) ...
Selecting previously unselected package libcairo2:amd64.
Preparing to unpack .../09-libcairo2_1.16.0-5ubuntu2_amd64.deb ...
Unpacking libcairo2:amd64 (1.16.0-5ubuntu2) ...
Selecting previously unselected package libdeflate0:amd64.
Preparing to unpack .../10-libdeflate0_1.10-2_amd64.deb ...
Unpacking libdeflate0:amd64 (1.10-2) ...
Selecting previously unselected package libjpeg-turbo8:amd64.
Preparing to unpack .../11-libjpeg-turbo8_2.1.2-0ubuntu1_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (2.1.2-0ubuntu1) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../12-libjpeg8_8c-2ubuntu10_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu10) ...
Selecting previously unselected package liblcms2-2:amd64.
Preparing to unpack .../13-liblcms2-2_2.12~rc1-2build2_amd64.deb ...
Unpacking liblcms2-2:amd64 (2.12~rc1-2build2) ...
Selecting previously unselected package libnspr4:amd64.
Preparing to unpack .../14-libnspr4_2%3a4.32-3build1_amd64.deb ...
Unpacking libnspr4:amd64 (2:4.32-3build1) ...
Selecting previously unselected package libnss3:amd64.
Preparing to unpack .../15-libnss3_2%3a3.68.2-0ubuntu1.1_amd64.deb ...
Unpacking libnss3:amd64 (2:3.68.2-0ubuntu1.1) ...
Selecting previously unselected package libopenjp2-7:amd64.
Preparing to unpack .../16-libopenjp2-7_2.4.0-6_amd64.deb ...
Unpacking libopenjp2-7:amd64 (2.4.0-6) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../17-libjbig0_2.1-3.1ubuntu0.22.04.1_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1ubuntu0.22.04.1) ...
Selecting previously unselected package libwebp7:amd64.
Preparing to unpack .../18-libwebp7_1.2.2-2_amd64.deb ...
Unpacking libwebp7:amd64 (1.2.2-2) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../19-libtiff5_4.3.0-6ubuntu0.3_amd64.deb ...
Unpacking libtiff5:amd64 (4.3.0-6ubuntu0.3) ...
Selecting previously unselected package libpoppler118:amd64.
Preparing to unpack .../20-libpoppler118_22.02.0-2ubuntu0.1_amd64.deb ...
Unpacking libpoppler118:amd64 (22.02.0-2ubuntu0.1) ...
Selecting previously unselected package poppler-utils.
Preparing to unpack .../21-poppler-utils_22.02.0-2ubuntu0.1_amd64.deb ...
Unpacking poppler-utils (22.02.0-2ubuntu0.1) ...
Setting up liblcms2-2:amd64 (2.12~rc1-2build2) ...
Setting up libpixman-1-0:amd64 (0.40.0-1ubuntu0.22.04.1) ...
Setting up libxrender1:amd64 (1:0.9.10-1build4) ...
Setting up libxcb-render0:amd64 (1.14-3ubuntu3) ...
Setting up libdeflate0:amd64 (1.10-2) ...
Setting up libxcb-shm0:amd64 (1.14-3ubuntu3) ...
Setting up libjbig0:amd64 (2.1-3.1ubuntu0.22.04.1) ...
Setting up poppler-data (0.4.11-1) ...
Setting up libfreetype6:amd64 (2.11.1+dfsg-1ubuntu0.1) ...
Setting up libnspr4:amd64 (2:4.32-3build1) ...
Setting up fonts-dejavu-core (2.37-2build1) ...
Setting up libjpeg-turbo8:amd64 (2.1.2-0ubuntu1) ...
Setting up libwebp7:amd64 (1.2.2-2) ...
Setting up libopenjp2-7:amd64 (2.4.0-6) ...
Setting up libjpeg8:amd64 (8c-2ubuntu10) ...
Setting up fontconfig-config (2.13.1-4.2ubuntu5) ...
Setting up libnss3:amd64 (2:3.68.2-0ubuntu1.1) ...
Setting up libtiff5:amd64 (4.3.0-6ubuntu0.3) ...
Setting up libfontconfig1:amd64 (2.13.1-4.2ubuntu5) ...
Setting up libcairo2:amd64 (1.16.0-5ubuntu2) ...
Setting up libpoppler118:amd64 (22.02.0-2ubuntu0.1) ...
Setting up poppler-utils (22.02.0-2ubuntu0.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
/sbin/ldconfig.real: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link
pdfuniteコマンドを使って結合をする
pdfunite [入力ファイル]... [出力ファイル]
例:
pdfunite 1.pdf 2.pdf output.pdf
PDF結合がこれでできる。
※入力するPDFファイルはいくつでも設定できる。
最後に出力するPDFのファイル名を設定すればよい。
気になったこと
※iLovePDFだけPDF結合した成果物がPHPのダウンロードする際に破損してしまう場合があった。
なので、おそらくどこかが違うのだがpdfuniteではどうなるか確認してみる。
というわけで、iLovePDF, smallPDF, pdfuniteのコマンドでのそれぞれの結合した際のバイナリを一応比較する。
iLovePDF iLovePDF_1_2_merged
smallPDF pdfunite_1_2_merged
pdfunite pdfunite_1_2_merged
各ファイルのサイズ
比較
URL
- iLovePDF - https://www.ilovepdf.com/ja/merge_pdf
- smallPDF - https://smallpdf.com/jp/merge-pdf
参考サイト様
【 pdfunite 】コマンド――複数のPDFファイルを結合する - @IT
https://atmarkit.itmedia.co.jp/ait/articles/1902/22/news041.htmlWindows10でpdfuniteによるpdf結合
https://takake-blog.com/windows10pdfunite/
おわりに
いつも iLovePDF
, smallPDF
で作成していたが、コマンドでできるのでこれを使っていこうと思う。