Written by James McDonald

December 12, 2014

I wanted to join multiple pdf files together. I usually have used pdftk but it has been retired. You can get a pdftk source rpm but it depends on gcj and several other packages that have been superseded in Fedora 21.

So an alternative is needed…

# install poppler-utils
yum install poppler-utils
# use the pdfunite command to join the pdfs
pdfunite pdf1.pdf pdf2.pdf output.pdf

Winning!

6 Comments

  1. David Levner

    The perl package PDF::API2 can also be used to create replacement programs for pdftk. I also needed a script that merged PDF files, so I wrote the following pdf-merge.pl:

    use English;
    use strict;
    use PDF::API2;

    my $output_pdf_file_name = pop @ARGV;
    if (not @ARGV) {die "usage: perl $PROGRAM_NAME input-pdf-file ... input-pdf-file output-pdf-file\n";}

    my $output_pdf = PDF::API2->new(-file => $output_pdf_file_name);
    while (@ARGV)
    {
    my $input_pdf = PDF::API2->open(shift @ARGV);
    my $number_of_input_pages = $input_pdf->pages();
    for (my $page_number = 1; $page_number importpage($input_pdf, $page_number, 0);
    } # for $page_number
    } # while

    $output_pdf->save();
    exit 0;

    Reply
    • David Levner

      Cut and paste didn’t work too well. Nor did the “code” and “/code” tags that I tried to place around the perl code. And, of course, the HTML obliterated my indentation.

      The inner loop should look like this:

      for (my $page_number = 1; $page_number importpage($input_pdf, $page_number, 0);
          } # for $page_number

      If this doesn’t look right, I’m not fixing it again.

      Reply
  2. HM

    None of these utils allows manipulating pdf passwords, which is mostly what I use pdftk for.

    Reply
    • James

      So hopefully someone will update the spec file for the PDFtk to allow building under Fedora 21.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…