Adding text, merge with 2nd pdf and upload it

C

ccampise

Hello all-

I'm attempting to take two existing pdf files, add text to them, merge
them into 1 single pdf, then stream that pdf to a browser allowing the
user to download the modified-single file.

I have no problem when adding text to a single document, and then
streaming that. The text shows up correctly in the downloaded pdf.

The problem is when I add text to > 1 document, merge them into a
single document, and stream the single document. The downloaded pdf
file doesn't contain any of the text I added, although it does merge
them correctly.

My current code :

sub stream {
my $self = shift;

my $dest_pdf_filename = "my_first.pdf";
my $source_pdf_filename = "my_second.pdf";

my $source_pdf = PDF::API2->open( $source_pdf_filename );
my $dest_pdf = PDF::API2->open( $dest_pdf_filename );

my $page = $source_pdf->openpage(1);

$page->text->textlabel(
60,
681,
$source_pdf->corefont('Arial'),
45,
'TEST');

$dest_pdf->importpage( $source_pdf, 1);

my $cgi = new CGI;

print $cgi->header(
-type => "application/pdf",
-attachment => "forms.pdf",
);

$dest_pdf->stringify;

return;
}

Any thoughts or ideas on this would be greatly appreciated!

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top