PDF タイトルを exiftool で CLI 上で変更する方法

PDF タイトルを exiftool で変更する方法をご紹介します。

ExifTool

exiftool インストール

macOS でのインストール方法

brew install exiftool

PDF 情報を exiftool で確認

exiftool -lang ja /path/to/filename.pdf という感じで

$ exiftool -lang ja sample.pdf 
ExifToolバージョン                   : 11.30
ファイル名                           : sample.pdf
ファイルの場所                         : .
ファイルのサイズ                        : 417 kB
更新日時                            : 2019:04:06 19:59:47+09:00
File Access Date/Time           : 2019:04:16 23:20:46+09:00
File Inode Change Date/Time     : 2019:04:16 23:20:46+09:00
File Permissions                : rw-r--r--
ファイルタイプ                         : PDF
File Type Extension             : pdf
MIMEタイプ                         : application/pdf
Linearized                      : No
Page Count                      : 1
PDF Version                     : 1.4
タイトル                            : 記事用サンプルファイル
作者                              : Tadashi Shigeoka
サブジェクト                          : 
Producer                        : macOS バージョン10.14.4(ビルド18E226) Quartz PDFContext
製作者                             : Word
デジタルデータ作成日時                     : 2019:04:06 08:58:24Z
ファイル作成日時                        : 2019:04:06 08:58:24Z
$ exiftool -lang en sample.pdf
ExifTool Version Number         : 11.30
File Name                       : sample.pdf
Directory                       : .
File Size                       : 417 kB
File Modification Date/Time     : 2019:04:06 19:59:47+09:00
File Access Date/Time           : 2019:04:16 23:23:04+09:00
File Inode Change Date/Time     : 2019:04:16 23:20:46+09:00
File Permissions                : rw-r--r--
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
Linearized                      : No
Page Count                      : 1
PDF Version                     : 1.4
Title                           : 記事用サンプルファイル
Author                          : Tadashi Shigeoka
Subject                         : 
Producer                        : macOS バージョン10.14.4(ビルド18E226) Quartz PDFContext
Creator                         : Word
Create Date                     : 2019:04:06 08:58:24Z
Modify Date                     : 2019:04:06 08:58:24Z

exiftool -Title で PDF タイトル変更

PDF Title 変更方法

PDF Title (タイトル) を変更する方法は、以下のように exiftool -Title コマンドで実現できます。

exiftool -Title="New Title" /path/to/filename.pdf

PDF Title 変更後の確認

$ exiftool -lang en sample.pdf
ExifTool Version Number         : 11.30
File Name                       : sample.pdf
Directory                       : .
File Size                       : 417 kB
File Modification Date/Time     : 2019:04:06 19:59:47+09:00
File Access Date/Time           : 2019:04:16 23:23:04+09:00
File Inode Change Date/Time     : 2019:04:16 23:20:46+09:00
File Permissions                : rw-r--r--
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
Linearized                      : No
Page Count                      : 1
PDF Version                     : 1.4
Title                           : New Title
Author                          : Tadashi Shigeoka
Subject                         : 
Producer                        : macOS バージョン10.14.4(ビルド18E226) Quartz PDFContext
Creator                         : Word
Create Date                     : 2019:04:06 08:58:24Z
Modify Date                     : 2019:04:06 08:58:24Z

以上、PDF Title を exiftool で CLI 上から変更したい、現場からお送りしました。

参考情報