LoginSignup
1
1

More than 1 year has passed since last update.

やっとPowerShellとpdfuniteでフォルダ内のPDFを全て結合できた。

Posted at

目的

  • フォルダ以内にある全てのPDFを一つのpdfに結合する。
  • フリーソフトの使用。
  • ファイル指定にワイルドカードを使用する。

環境

  • OS: Windows11 home (version 21H2 OSビルド 22000.856 )
  • Terminal: Windows Terminal (version 1.14.2282.0)
  • Shell: PowerShell (version 7.2.6)
  • 使用ソフト popplerのpdfunite (version 22.04.0)
    • pdfuniteはCUIのフリーソフトです。
    • scoopでpopplerをinstall した。

使用想定

フォルダ内の全てのPDFを*.pdfで指定し、一つにまとめたPDFを同一フォルダ内にoutput.pdfで出力する。

成功例

PowerShellでは以下の 4つは成功し、一つになったoutput.pdfが作成された。

pdfunite (ls *.pdf) output.pdf

pdfunite (dir *.pdf) ouput.pdf

pdfunite (Get-ChildItem *.pdf) output.pdf

pdfunite (Get-Item *.pdf) output.pdf

失敗例

pdfunite *.pdf output.pdf

I/O Error: Couldn't open file '*.pdf': No error.
Syntax Error: Could not merge damaged documents ('*.pdf')

cmd.exeでは以下も試したが、駄目でした。

pdfunite (dir /w *.pdf) output.pdf

I/O Error: Couldn't open file '(dir': No error.
Syntax Error: Could not merge damaged documents ('(dir')

感想

  • これで簡単にPDFを結合できる。
  • なぜかWindowsでは()が大事なようだ。
  • cmd.exeでは成功する方法はわかりません。
1
1
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
1
1