Monday, February 3, 2014
11:20 PM

Merging pdf files

This post is about combining pdf files. It complements 2 earlier posts on splitting pdf files - part 1, and 2.

I am using a tool named SimpleScan to scan in multiples pages of a document. Each page is scanned into a separate pdf file. I must find a way to stitch the pdf files together into one single pdf.

You can use either the pdftk command, or the gs command to merge pdf files. You may recall that they are the same commands you would use to split pdf files. In the examples below, the input files are T4a.pdf, T4b.pdf, and T4c.pdf; the merged output file is combined.pdf.

  • pdftk

    $ pdftk T4a.pdf T4b.pdf T4c.pdf output combined.pdf
  • gs (GhostScript)

    $ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=combined.pdf T4a.pdf T4b.pdf T4c.pdf
    GPL Ghostscript 9.05 (2012-02-08)
    Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
    This software comes with NO WARRANTY: see the file PUBLIC for details.
    Processing pages 1 through 4.
    Page 1
    Loading NimbusSanL-Regu font from /usr/share/fonts/type1/gsfonts/n019003l.pfb... 4247256 2644865 2257128 952885 3 done.
    Loading NimbusSanL-Bold font from /usr/share/fonts/type1/gsfonts/n019004l.pfb... 4288248 2754288 2277312 983470 3 done.
    Loading NimbusMonL-Regu font from /usr/share/fonts/type1/gsfonts/n022003l.pfb... 4331192 2899511 2438784 1137910 3 done.
    Page 2
    Loading NimbusSanL-BoldItal font from /usr/share/fonts/type1/gsfonts/n019024l.pfb... 4370920 2866410 2479152 934054 3 done.
    Loading NimbusSanL-ReguItal font from /usr/share/fonts/type1/gsfonts/n019023l.pfb... 4410584 2982313 2499336 1004810 3 done.
    Page 3
    Page 4
    Processing pages 1 through 4.
    Page 1
    Page 2
    Page 3
    Page 4
    Processing pages 1 through 4.
    Page 1
    Page 2
    Page 3
    Page 4

0 comments:

Post a Comment