Batch File to Convert Multiple PDFs to TIFF on Windows

Unlike my previous batch files, this one does not require Cygwin or Bash, this makes it more accessible, but slightly less powerful.

This post contains a Windows .bat file that allows a selection of PDFs to be drug onto it. The batch script will convert the PDFs to .tif files. The script below converts the PDFs to 300 DPI multi-page group4 TIFFs. With information from previously posted scripts, it can be easily modified for other output. To run this script it is required to install Ghostscript for windows, and to adjust the command to the correct version (this script used Ghostscript v9.05 on 32-bit Windows.


echo off
:Loop
IF [%1]==[] GOTO Continue
     "C:\Program Files\gs\gs9.05\bin\gswin32c.exe" -dBATCH -sDEVICE=tiffg4 -dNOPAUSE -r300x300 -sOutputFile=%1.tif %1
     SHIFT
GOTO Loop
:Continue


This script can be typed (or copy pasted) into notepad, and saved as filename.bat. To use it simply drag a collection of PDFs from your local computer onto the .bat file and wait. The limit is approximately 80 files at a time (Windows XP and newer), or 20 (older versions of Windows).

The script works as follows:
line 1) turns off a lot of unhelpful screen display
2) labels the line “Loop”
3) checks if there is currently and argument in position (these will be the full path and name of the PDFs drug onto the batch), if position 1 is empty, it goes to the “Continue” label
4) runs a Ghostscript command on position 1 (see previous posts for more explanation of the options), the part in quotes must be adjusted to find gswin for your specific install
5) drops position 1, pulling position 2 into it (the next PDF)
6) goes to the “Loop” label
7) labels the line “Continue”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>