Skip to content

Instantly share code, notes, and snippets.

@DuckHunter213
Last active March 9, 2021 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DuckHunter213/c0ee0255aa4074d1a2345de5227a68aa to your computer and use it in GitHub Desktop.
Save DuckHunter213/c0ee0255aa4074d1a2345de5227a68aa to your computer and use it in GitHub Desktop.
ghostscript add multiples images to pdf on windows
<# ghostscript to add multiple images to pdf #>
<# put gs.exe in the variable system #>
<#search path of the follow lib#>
$path_library = "C:\Program Files\gs\gs9.53.3\lib\viewjpeg.ps"
$filename = "Glosario.pdf"
$path_to_images = "F:\path_to_folder"
$filter = "*.jpg"
$all_images = ""
$images = Get-ChildItem -Path $path_to_images -Filter $filter | Select-Object -ExpandProperty Name
foreach ($image in $images) {
$all_images = $all_images + "(" + $image + ") viewJPEG showpage "
}
gs -dNOSAFER -sDEVICE=pdfwrite -o $filename $path_library -c $all_images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment