Ghostscript merge of pdf's is causing orientation to flip
I'm using a similar method as this SO question: How to merge two postscript files together?
On the merged PDF, every couple pages are flipped upside down. I haven't seen it mentioned anywhere else about this symptom. Merging a single troublesome pdf still has the orientation upside down.
@echo off
REM FILE: merge.bat
call :merge 1 155 out.pdf
pause
goto :eof
REM MERGE PDFs
REM @param # of first file in sequence
REM @param # of last file in sequence
REM @param new file of merged pdf
goto :eof
:merge
SET START=%1
SET END=%2
SET OUT=%3
echo START=%START%
echo END=%END%
echo OUT=%OUT%
echo.
SET CMD="c:\Program Files\gs\gs9.01\bin\gswin32c.exe"
SET INPUT_DIR=c:\input
SET CMD_ARGS=args.bat
echo Generating args file...
(echo.|set /p="-dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=%OUT% ") > %CMD_ARGS%
for /L %%G IN (%START%,1,%END%) do (
(echo.|set /p=" "%INPUT_DIR%\%%G.pdf" ") >> %CMD_ARGS%
)
echo. >> %CMD_ARGS%
del %OUT%
if exist %OUT% goto :error
echo Executing command...
%CMD% @%CMD_ARGS%
del %CMD_ARGS%
echo Done.
if not exist %OUT% goto :error
goto :eof
:error
echo Error processing command.
goto :eof