in reply to Re: combining PDFs
in thread combining PDFs

The system line is

system "pdftk /home/Memos/exhibit1_29JUN2010.pdf /home/Memos/exhibit2.pdf cat output /home/exhibits_29JUN2010.pdf";

I've tried using a wildcard (*) to take the place of the datestamp (29JUN2010) in the first file's name, but I'm still having the problem of getting the combined file to have the datestamp in its name.

Replies are listed 'Best First'.
Re^3: combining PDFs
by almut (Canon) on Jun 30, 2010 at 19:52 UTC

    Not sure I understand. Have you hardcoded those file names in the system call?  I would guess that you get the input file names from somewhere (listing directory contents, some config file, user input...).  Otherwise, how would the program work if there's a new date stamp...

    So why not simply dynamically create the output file name according to the date stamp found in the input file?  For example:

    my $in1 = "exhibit1_29JUN2010.pdf"; my $in2 = "exhibit2.pdf"; my ($date) = $in1 =~ /_([^_]+)\.pdf$/; # extract date my $out = "exhibits_$date.pdf"; # create output file name system "pdftk /home/Memos/$in1 /home/Memos/$in2 cat output /home/Memos +/$out";

    Or maybe

    my $dir = "/home/Memos"; my $in1 = <$dir/exhibit1_*.pdf>; my $in2 = "$dir/exhibit2.pdf"; my ($date) = $in1 =~ /_([^_]+)\.pdf$/; my $out = "$dir/exhibits_$date.pdf"; system "pdftk", $in1, $in2, "cat", "output", $out;