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
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