I have a range of PDF files 1.pdf, 2.pdf, etc. that I would like to merge into one file, with all the PDFs tiled on one page.

Currently, I have tried pdftk to merge these files, but they are put on separate pages:

pdftk 1.pdf 2.pdf ... cat output merged.pdf

Is there a way to, instead, tile the individual PDF files into one master page on merged.pdf?


10 Answers 10


I do not know if pdftk can do this, but pdfjam can. It can be installed on debian or derivates with sudo apt install texlive-extra-utils. Then you can do:

pdfjam Page1.pdf Page2.pdf --nup 2x1 --landscape --outfile Page1+2.pdf

It puts 2 pages on one page side by side. With --nup 1x2 --no-landscapeyou can put two pages on one page on top of each other.

  • If you wanted no auto-scaling of pages (mine stretches output to fill a4 by default), use --noautoscale true Mar 12, 2018 at 14:14

Not sure what you mean by tiled on one page. I was looking for a way to merge multiple PDFs on one page - on top of another. This can be done with pdftk like this:

pdftk foreground.pdf background background.pdf output merged.pdf

  • 3
    Absolutely not an answer to the question. The adjective tiled is defined as "arrange without overlap". Aug 25, 2021 at 2:09
  • @ChristianHerenz it's not the reason why the answer is not good. It could be a step to the solution. But turns out that it does nothing other than concatenating the pages. Feb 8 at 10:33

The pdfLaTeX based pdfnup might work for you. If you have lots of pdf-files you may need to make a long pipe of pdfjam or run it several times.

There is also pdfnup in python.


This script will tile the pdf pages for you. Change the slice to what you need per page.


latexhead = <<'EOF'
latextail = <<'EOF'

pages = %x[pdfinfo #{ARGV[0]}].split(/\n/).select{|x| x=~ /Pages:/}[0].split(/\s+/)[1].to_i
puts latexhead
s = (1..pages).each_slice(4).to_a
s.each do |a|
  puts "\\begin{figure}"
  a.each do |p|
    puts "\\includegraphics[page=#{p},scale=0.4,width=.5\\textwidth]{#{ARGV[0]}}"
  puts "\\end{figure}"
puts latextail

you can use montage from ImageMagick

$ montage *.pdf merged.pdf

see also http://www.imagemagick.org/script/montage.php

  • 17
    ImageMagick montage will not handle vectorized images and fonts properly. As a result, the output from the montage command might look blurry. See also the explanation here: superuser.com/a/479767/149568 Feb 20, 2013 at 13:00
  • 3
    This does NOT answer the question, which is asking about pdftk
    – Zimba
    Sep 28, 2019 at 12:14

If filenames are in "system specific" order, then pdftk *.pdf cat output merged.pdf should work just fine.

Here is what I mean by "system specific" order.

I've got 3 files on my Ubuntu 11.04: 1.pdf, 2.pdf, 10.pdf
Files are merged in order: 10.pdf 1.pdf 2.pdf (ls -l returned the same order as in merged file)

Safest naming convention: 0001.pdf, 0002.pdf, etc.

  • 3
    As I stated, this command creates a multi-page PDF. As stated in my question, I am looking for the method of using pdftk to make a one-page PDF that contains input PDFs as tiles. Dec 11, 2011 at 9:35
  • Combine my answer with @micke's. I haven't checked whether pdfnup can take name with wildcard (*.pdf) as argument, but you can use pdf generated by pdftk. Check pdfnup or pdfjam with --nup option.
    – szemek
    Dec 11, 2011 at 16:49
  • Unless you quote them, wildcards like * are expanded by the shell you're using. pdfnup doesn't ever see *.pdf, instead it sees a list of every file in the working directory with filenames ending in .pdf.
    – evilsoup
    Aug 27, 2013 at 16:11

If you've got a large number of PDFs in one folderstructure, and you've got a TeX-Installation, this script puts all the PDFs recursivly into one large file:

# pdfdir OUTPUT_FILE
# produces one big PDF file of all PDF files in .
if [ $# -ne 1 ] || [ -z "$1" ]; then
  echo "Syntax: pdfdir OUTPUT_FILE"
  exit 1
FILE="$(echo "$1"|sed -e 's/\.\(pdf\|tex\)$//')"
for F in "$FILE" "$FILE.tex" "$FILE.pdf" "$FILE.aux" "$FILE.log" ; do
  if [ -e "$F" ]; then
    echo "$F exists already."
    exit 2
cat >"$FILE.tex" <<EOF
# helper functions
exist_pdf_files () {
  [ $(find -L "$1" -name \*.pdf -o -name \*.PDF -type f 2>/dev/null|wc -l) -eq 0 ] && return 1
  return 0
list_directories () {
  find -L "$1" -maxdepth 1 -mindepth 1 -type d 2>/dev/null | sort
list_pdf_files () {
  # version with " around filenames:
  #find -L "$1" -maxdepth 1 -mindepth 1 -name \*.pdf -o -name \*.PDF -type f 2>/dev/null | sort | \
  #  sed -e 's/^/\\includepdf[pages=-]{"/; s/$/"}%/'
  # version without " around filenames:
  find -L "$1" -maxdepth 1 -mindepth 1 -name \*.pdf -o -name \*.PDF -type f 2>/dev/null | sort | \
    sed -e 's/^/\\includepdf[pages=-]{/; s/$/}%/'
tex_headline () {
    echo "$1" | sed -e 's/_/\\_/g'
# current folder (lefel 0):
list_pdf_files . >>"$FILE.tex"
# Bearbeite Ebene 1:
list_directories . | while read -r DIR1; do
  # Are there PDFs in folders below that level?
  exist_pdf_files "$DIR1" || continue
  # Yes ...
  tex_headline "\section{${DIR1##*/}}%"
  # those:
  list_pdf_files "$DIR1"
  # Level 2:
  list_directories "$DIR1" | while read -r DIR2; do
    exist_pdf_files "$DIR2" || continue
    tex_headline "\subsection{${DIR2##*/}}%"
    list_pdf_files "$DIR2"
    # Level 3:
    list_directories "$DIR2" | while read -r DIR3; do
      exist_pdf_files "$DIR3" || continue
      tex_headline "\subsubsection{${DIR3##*/}}%"
      list_pdf_files "$DIR3"
      # Level 4:
      list_directories "$DIR3" | while read -r DIR4; do
        exist_pdf_files "$DIR4" || continue
        tex_headline "\paragraph{${DIR4##*/}}%"
        list_pdf_files "$DIR4"
        # Level 5:
        list_directories "$DIR4" | while read -r DIR5; do
          exist_pdf_files "$DIR5" || continue
          tex_headline "\subparagraph{${DIR5##*/}}%"
          list_pdf_files "$DIR5"
done >>"$FILE.tex"
echo "\end{document}%" >>"$FILE.tex"
echo "Sourcecode to PDF directly [J/n]"
read -r ANSWER
case "$ANSWER" in
[JjYy]) ;;
*) exit 0 ;;
pdflatex "$FILE"
[ $? -eq 0 ] && rm -f "$FILE.aux" "$FILE.log" "$FILE.tex"

I have not written that code, I've got it from a discussion here: http://www.listserv.dfn.de/cgi-bin/wa?A2=ind1201&L=tex-d-l&T=0&P=10771

It is very usefull. I've translated some German comments into English.

Regards, Alexander


This link: http://www.verypdf.com/wordpress/201302/how-to-combine-4-page-pdf-into-1-page-pdf-file-to-save-ink-and-papers-34505.html shows VeryPDF PDF Stitcher can do the job vertically or sideways. Download at: http://www.verypdf.com/app/pdf-stitch/index.html


Sorry for not answering your specific question about pdftk, but since other answers exist show alternatives, I thought I'd chime in and present yet another alternative.

With a system that has poppler installed, you should have the pdfunite program. Using it is simple:

pdfunite foo.pdf bar.pdf   /tmp/output.pdf
  • This does not tile anything onto one page. Jan 23 at 0:10
  1. Save pages wanted into a pdf doc with something like Acrobat Pro.

  2. Print document using the multiple pages to a page feature, back to a pdf document.

Multiple pages to a single page. :-)

  • 1
    I see your answer is downvoted without a comment. That's not cool, but there are certainly ways to improve your answer. Improve its grammar, add a description to the top as to why you are doing this, etc.
    – user477799
    Feb 13, 2017 at 7:49
  • upvoted this answer - only because downvotes without a comment are not cool IMO! Nov 14, 2017 at 0:45
  • 3
    Downvoted because the subject says "with pdftk". Your answer is maybe not off topic, but clearly not what the questioner is looking for.
    – Nik
    Dec 18, 2018 at 12:22
  • I agree with @Nik's conjecture.
    – stephanmg
    Jul 8, 2020 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.