You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

---
title: Combine multiple PDF files
summary:
date: 2024-10-26T20:27:05+02:00
# lastmod: 2024-08-18T14:20:52+0000
categories:
- computerstuff
tags:
- command-line
- openbsd
- freebsd
- linux
- draft_post
# showBreadcrumbs: true
# showDate: false
# showReadingTime: false
# showWordCount: false
# showPagination: false
# feed_exclude: true
# site_exclude: true
# some help
#
# highlighting with highlights
#
# use table, as inline creates a padding around
# and it pushes the text more to the right side (end of screen)
#
# ~~~html {linenos=table,hl_lines="3-6"}
# ~~~html {linenos=inline,hl_lines="1,3-6"}
draft: true
---
I sometimes want to combine two or three PDF files into one (to print them
two pages on a sheet, mostly).
I did this recently and here I write it down again so I can find it again
(I will forget this until the next time I need it again):
```console
$ gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf file1.pdf file2.pdf file3.pdf ...
```
Found on [Stack Overflow](https://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf/2507825#2507825).
I also found another solution (further down at the link above) usable, but it produces much bigger files:
```console
$ qpdf --empty --pages *.pdf -- out.pdf
```