😀

PDFのメタ情報を確認する

2024/10/14に公開

Mac ターミナル上でいろいろ試したけど以下2つがよさげ。

❯ mdls kyojyusya_shoumei_02_input.pdf
kMDItemAuthors                     = (
    "Microsoft\U00ae Word 2013"
)
kMDItemContentCreationDate         = 2024-10-14 02:33:30 +0000
kMDItemContentCreationDate_Ranking = 2024-10-14 00:00:00 +0000
kMDItemContentModificationDate     = 2024-10-14 02:33:30 +0000
kMDItemContentType                 = "com.adobe.pdf"
kMDItemContentTypeTree             = (
    "com.adobe.pdf",
    "public.data",
    "public.item",
    "public.composite-content",
    "public.content"
)
kMDItemCreator                     = "Microsoft® Word 2013"
kMDItemDateAdded                   = 2024-10-14 02:33:32 +0000
kMDItemDisplayName                 = "kyojyusya_shoumei_02_input.pdf"
kMDItemDocumentIdentifier          = 0
kMDItemEncodingApplications        = (
    "Microsoft\U00ae Word 2013"
)
kMDItemFSContentChangeDate         = 2024-10-14 02:33:30 +0000
kMDItemFSCreationDate              = 2024-10-14 02:33:30 +0000
kMDItemFSCreatorCode               = ""
kMDItemFSFinderFlags               = 0
kMDItemFSHasCustomIcon             = (null)
kMDItemFSInvisible                 = 0
kMDItemFSIsExtensionHidden         = 0
kMDItemFSIsStationery              = (null)
kMDItemFSLabel                     = 0
kMDItemFSName                      = "kyojyusya_shoumei_02_input.pdf"
kMDItemFSNodeCount                 = (null)
kMDItemFSOwnerGroupID              = 20
kMDItemFSOwnerUserID               = 501
kMDItemFSSize                      = 200465
kMDItemFSTypeCode                  = ""
kMDItemInterestingDate_Ranking     = 2024-10-14 00:00:00 +0000
kMDItemKind                        = "PDF document"
kMDItemLogicalSize                 = 200465
kMDItemNumberOfPages               = 1
kMDItemPhysicalSize                = 200704
kMDItemSecurityMethod              = "Password Encrypted"
kMDItemVersion                     = "1.6"
kMDItemWhereFroms                  = (
    "https://www.nta.go.jp/taxes/shiraberu/taxanswer/osirase/data/pdf/kyojyusya_shoumei_02_input.pdf",
    "https://www.nta.go.jp/taxes/shiraberu/taxanswer/osirase/data/pdf/kyojyusya_shoumei_02_input.pdf"
)

❯ mdls -h
mdls: unrecognized option `-h'

usage: mdls [-s][-attr attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path
list the values of one or all the attributes of the specified file
  -attr        -n : fetch specific attribute
  -raw         -r : don't print attribute names before values
  -nullMarker  -m : substitute this string for null attributes in raw mode
  -plist       -p : output attributes in XML format to file. Use - to write to stdout
                option -plist is incompatible with options -raw, -nullMarker, and -attr
  -sdb         -s : implies -attr _kMDItemSDBInfoexample:  mdls  ~/Pictures/Birthday.jpg
example:  mdls  -attr Keyword ~/Pictures/Birthday.jpg

❯ file $(which mdls)
/usr/bin/mdls: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/mdls (for architecture x86_64):	Mach-O 64-bit executable x86_64
/usr/bin/mdls (for architecture arm64e):	Mach-O 64-bit executable arm64e
❯ exiftool kyojyusya_shoumei_02_input.pdf
ExifTool Version Number         : 12.76
File Name                       : kyojyusya_shoumei_02_input.pdf
Directory                       : .
File Size                       : 200 kB
File Modification Date/Time     : 2024:10:14 11:33:30+09:00
File Access Date/Time           : 2024:10:14 11:33:35+09:00
File Inode Change Date/Time     : 2024:10:14 11:33:32+09:00
File Permissions                : -rw-r--r--
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : No
Encryption                      : Standard V4.4 (128-bit)
User Access                     : Print, Copy, Fill forms, Extract, Print high-res
Author                          : 国税庁
Create Date                     : 2020:06:12 21:14:44+09:00
Modify Date                     : 2022:05:18 15:50:42+09:00
Has XFA                         : No
Language                        : ja-JP
Tagged PDF                      : Yes
XMP Toolkit                     : Adobe XMP Core 7.1-c000 79.425dc87, 2021/10/27-16:20:32
Creator Tool                    : Microsoft® Word 2013
Metadata Date                   : 2022:05:18 15:50:42+09:00
Producer                        : Microsoft® Word 2013
Format                          : application/pdf
Creator                         : 国税庁
Title                           :
Document ID                     : uuid:c30810bd-8edc-4077-b378-faba454e5a54
Instance ID                     : uuid:712104bd-d9af-41db-adca-dfb689630bbb
State                           : 1
Version                         : 1.1
Page Count                      : 1

❯ exiftool -h | wc -l
    2790

❯ exiftool -h | head
NAME
    exiftool - Read and write meta information in files

SYNOPSIS
  Reading
    exiftool [*OPTIONS*] [-*TAG*...] [--*TAG*...] *FILE*...

  Writing
    exiftool [*OPTIONS*] -*TAG*[+-<]=[*VALUE*]... *FILE*...

❯ brew info exiftool
==> exiftool: stable 12.76 (bottled)
Perl lib for reading and writing EXIF metadata
https://exiftool.org
Installed
/opt/homebrew/Cellar/exiftool/12.76 (607 files, 25.5MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-08-30 at 20:18:44
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/e/exiftool.rb
License: Artistic-1.0-Perl OR GPL-1.0-or-later
==> Analytics
install: 3,080 (30 days), 9,334 (90 days), 56,280 (365 days)
install-on-request: 2,830 (30 days), 8,700 (90 days), 52,552 (365 days)
build-error: 0 (30 days)

🤔 参考

https://android.benigumo.com/20241013/mac-pdf/

https://shogo82148.github.io/blog/2023/12/11/2023-12-11-introduce-exiftool/

Discussion