Sunday February 28th 2021 - Update issue with packman inode mirror
There are issues with the inode mirror, please configure an alternative mirror. See http://packman.links2linux.org/mirrors
-
Apache2 and Perl with modules PDF::API2 & MIME::Lite (Creating a PDF Document)
Hope someone can point me in the right Direction or help with a problem / lack of knowledge.
SuSE Linux 12.1 64bit
Apache2, Perl and the PDF::API2 & MIME::Lite modules installed.
Simplistic cgi script created so far:
#!/usr/bin/perl
use PDF::API2;
use MIME::Lite;
### Create PDF Document
my $pdf = PDF::API2->new(-file => "../htdocs/invoices/invoice.pdf");
$pdf->mediabox(595,842);
my $page = $pdf->page;
my $fnt = $pdf->corefont('Arial',-encoding => 'latin1');
my $txt = $page;
$pdf->saveas ('../htdocs/invoices/invoice-$Number.pdf';
### Mailing Data
my $from_address = 'mai1test@otherdomainname.co.uk';
my $to_address = 'admin@mydomainname.co.uk';
### Adjust subject and body message
my $subject = 'eInvoice blah';
my $message_body = "Please find attached your invoice, blah, blah";
### Adjust the filenames
my $path = '../htdocs/invoices/';
my $attachment = 'invoice-$Number.pdf';
### Create the multipart container
$msg = MIME::Lite->new (
From => $from_address,
To => $to_address,
Subject => $subject,
Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";
### Add the text message part
$msg->attach (
Type => 'TEXT',
Data => $message_body
) or die "Error adding the text message part: $!\n";
### Add the PDF Document
$msg->attach (
Type => 'application/pdf',
Path => $path,
Filename => $attachment,
Disposition => 'attachment'
) or die "Error adding $file_gif: $!\n";
### Send the Message
$msg->send;
this successfully creates the pdf document and then sends it off as an attachment in an email.
At the mo i have a html webform for entering user data that is sent to a cgi script, the script formats the data does a few sums then prints to screen a html page for printing, a html email is sent to myself and to the person entering the data.
I would like to learn how to take that same data from the webform and use images to create a pdf document that can then be sent as an attachment in an email.
Can someone help or recommend a website or two where i may find more info and get help.
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|