0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

暗号化されたファイルの結合時のエラー対処法(pdfunite)

Posted at

はじめに

pdfunite を使用してpdfファイルの結合を行う時に、下記のエラーに遭遇しました。

発生したエラーメッセージ

Unimplemented Feature: Could not merge encrypted files ('sample.pdf')

事象

  • オリジナルファイルはpdfseparateを使用したpdfファイルの分割したもの
  • Finder からのプレビューは問題ないにも関わらず上記のエラーメッセージが表示される

理由

どうやら暗号化されているのが理由なようですが主な原因は以下の通りでした。

macOSのプレビュー

  • Apple独自のPDFレンダリングエンジンを使用
  • 軽微な暗号化や制限を自動的に迂回する場合がある

pdfunite(Poppler)

  • セキュリティ制限により厳密な暗号化チェックを実行
  • 暗号化されたファイルを厳格に拒否

pdfファイルの確認

pdfinfoでチェック

pdfinfo sample-1.pdf
...
Pages:           1
Encrypted:       yes (print:yes copy:yes change:no addNotes:no algorithm:AES-256)
Page size:       612 x 792 pts (letter)
Page rot:        0
...

Encrypted: yes (print:yes copy:yes change:no addNotes:no algorithm:AES-256)

qpdfによる詳細チェック

pdfinfoでは暗号化ファイルの詳細まで確認できないのでqpdfを使用して暗号化ファイルの詳細を確認します。

qpdf --show-encryption sample-1.pdf
...
R = 6
P = -1324
User password =
Supplied password is user password
extract for accessibility: allowed
...

User password = を確認するとパスワードは設定されていないようです。続いて以下のコマンドで暗号化を解除します。

qpdf --decrypt --password="" sample-1.pdf sample-1-decrypted.pdf

これで暗号化が解除されました。
残りのファイルも同様の手順で暗号化を解除した上でpdfuniteで結合を試したところ成功しました。

分割前のオリジナルpdfファイルの暗号化を解除してあげてからpdfuniteで結合してあげると良さそうです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?