[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Combine PDF files



On Wed, Sep 24, 2025 at 11:15:46 +0200, Toni Mas Soler wrote:
> Maybe the most simple option, but it works for me when I want
> concatenate PDF's:
> 
> gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$OUTPUTFILE.pdf
> $FILE_IN1.pdf $FILE_IN3.pdf

Just for the record, the words that contain $ should all be double-quoted.
This will matter if any of the variables have whitespace or glob
characters in them.

    gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="$OUTPUTFILE.pdf" \
    "$FILE_IN1.pdf" "$FILE_IN3.pdf"

Of course, if this isn't actually an alias/function/script, and you're
typing the actual filenames using tab completion instead of variable
expansions, then you don't want or need to add quote marks, because the
tab completion will add backslashes in front of all the spaces for you.


Reply to: