Created
September 17, 2021 12:02
-
-
Save Qix-/75bbf665969acbf596c65df62f597359 to your computer and use it in GitHub Desktop.
Drop this into a .bat somewhere and you can then drag+drop one ore more images onto it to create a multi-page PDF document.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if %1.==. goto No1 | |
bash -xc "a=(); for i in $(seq $#);do a+=(\"$(wslpath \"${!i}\")\"); done; convert \"${a[@]}\" -auto-orient \"output$(suffix() { local v=$(cat); if ! [ $v -eq 0 ]; then printf ' (%%s)' $v ; fi ; } ; find . -name 'output*.pdf' "|" grep -E '^\./output( \([0-9]+\))?\.pdf$' "|" wc -l "|" suffix ).pdf\"" -- %* | |
goto End | |
:No1 | |
echo No documents dropped onto script; terminating. | |
pause | |
:End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires ImageMagick's
convert
utility.If you're getting security errors from
convert
, run this once:sudo sed -i_bak 's/rights="none" pattern="PDF"/rights="read | write" pattern="PDF"/' /etc/ImageMagick-6/policy.xml