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?

More than 1 year has passed since last update.

JustPDF5[作成]をWindows Power Automate Desk Topで使う

Posted at

環境 windows11pro 64bit /Windows Power Automate 2.28
結論
Windows Power Automate DesktopでJustPdf5CmdCreator.exe実行できた
pdfにするための画像ファイルの名前が長いと、JustPDFの仕様の500ページに到達する前に失敗する。
GUIのJustPDF5[作成]は、UIオートメーションでも制御は可能ですが、JustPdf5CmdCreator.exeの方が、使い勝手が良く、速い。

1.JustPDF5の仕様
JustPDF5を標準でインストールすると、"C:\Program Files (x86)\JustSystems\JustPdf5\Creator\JustPdf5CmdCreator.exe"
として、「JustPdf5CmdCreator.exe」がインストールされます。
これが、コマンドライン入力を担います。コマンドライン入力に関し、マニュアルに記載はなく、ヘルプに出てくるだけです。
当該ヘルプに、複数のpng-filesを1つのPDFにする場合は
JustPdf5CmdCreator.exe◇/combine◇"ファイルパス1"◇"ファイルパス2"◇・・・◇/out◇"出力先フォルダー"
とコマンドを実行するとなっています。
◇は、半角スペース。◇と""とPath区切り記号(/)を、厳格に守ることでコマンドライン入力を受け付けます。
これ重要、◇と""とPath区切り記号(/)を、厳格に守る。
combineは、PDF形式以外の、たとえばpng_fileをPDF形式にしてから、結合させるという便利なものです。

2.Windows Power Automate DesktopでJustPdf5CmdCreator.exeを実行する考え方
Windows Power Automate Desktopは、外部スクリプトとしてCMDを許しているのでここで実施。また、CMD内に、変数の書き込みを許しています。

2.Windows Power Automate DesktopでJustPdf5CmdCreator.exeの実行例
ファイル構成
Sドライブで実施
S:/03_PDFs_by_justPDF5 #作成したPDF-fileを保存するフォルダ
S:/04_main_work/test# test用のpngファイルを保存しているフォルダ。*連番.pngなります。
JustPdf5CmdCreator.exeは、windows11の詳細設定でPathを記憶させておきます。
image.png
step1は、pdfにする元画像の取得です。
image.png

step2は、%pngFiles%をリスト形式から、一分に結合します。区切り文字を" "にすることが重要。
image.png

step3はCMD部分でcoreです。
image.png

コマンドは
JustPdf5CmdCreator.exe /combine "%JoinedText%" /out "S:\03_PDFs_by_justPDF5" /imagecomp 1
%JoinedText%の両脇の"が大事。最後の/imagecomp 1はpdf圧縮の程度で、数字の1は、JustPDF本体(GUI版)で設定します。

3.Windows Power Automate Desktop(CMD)でJustPdf5CmdCreator.exeを実行した場合の制限事項
pdfにしたい元fileの名前の文字数が、
JustPDF本体の制限500ページを到達する前に失敗します。およそ、7000文字程度で諦めました。Windows Power Automate Desktopでbasenameを簡単に取得して、かつ、連結するのは面倒なので、Windows Power Automate Desktop(CMD)でJustPdf5CmdCreator.exeを実行する場合は、フォルダ名とファイル名を簡便にしてrenameし、pdf作成後、名前を元に戻すテクニックが必要となります。仮にsドライブのaフォルダに???.pngとして元データとを置くと、コマンドラインに必要な文字数は、「"S:\a???.png"◇」
◇は、半角スペースで文字数は、15文字で460ページくらいは、出来る計算となります(実際は失敗中。)

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?