Created
January 9, 2013 17:22
-
-
Save melo/4494996 to your computer and use it in GitHub Desktop.
Merge the content of two single page PDFs, on a pretty template, the other an invoice, into a new *single* page PDF, using Perl PDF::API2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use PDF::API2; | |
my ($template_pdf, $data_pdf) = @ARGV; | |
my $t_pdf = PDF::API2->open($template_pdf); | |
my $page = $t_pdf->openpage(1); | |
my $d_pdf = PDF::API2->open($data_pdf); | |
$t_pdf->importpage($d_pdf, 1, $page); | |
$t_pdf->saveas("merged-$data_pdf"); | |
$t_pdf->end; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment