Home > Archive > PERL Miscellaneous > April 2004 > How to use PDF::API2 Perl Module for placing a Banner
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to use PDF::API2 Perl Module for placing a Banner
|
|
|
| Group,
Could someone point me to a tutorial for PDF::API2 usage? (or samples
etc) Really I dont know how to start.
Basically I wanted to place a small banner (another PDF) in each page
of original PDF. How to do this?
Thanks for your time
Dominic
| |
| Aandi Inston 2004-04-27, 10:01 am |
| junk@dlink.org (Aqua) wrote:
>Group,
>
>Could someone point me to a tutorial for PDF::API2 usage? (or samples
>etc) Really I dont know how to start.
If you want to use any software that edits PDFs, a basic working
knowledge of the PDF format is a must. All editors are shaped and
constrained by what PDF is, and how it works, and it will be a real
struggle without that basic knowledge.
Read the PDF Reference, at least the first five chapters.
>
>Basically I wanted to place a small banner (another PDF) in each page
>of original PDF. How to do this?
See if the API talks about "form XObjects". If it does, you may be on
to something.
----------------------------------------
Aandi Inston quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.
| |
|
| quite@dial.pipex.con (Aandi Inston) wrote in message news:<408e58f5.1091820394@reading.news.pipex.net>...
> junk@dlink.org (Aqua) wrote:
>
>
> If you want to use any software that edits PDFs, a basic working
> knowledge of the PDF format is a must. All editors are shaped and
> constrained by what PDF is, and how it works, and it will be a real
> struggle without that basic knowledge.
>
> Read the PDF Reference, at least the first five chapters.
>
> See if the API talks about "form XObjects". If it does, you may be on
> to something.
> ----------------------------------------
> Aandi Inston quite@dial.pipex.com http://www.quite.com
> Please support usenet! Post replies and follow-ups, don't e-mail them.
Aandi,
Actually I am able to do this with PDF::Reuse and PDF::API2.
This is just a sample code. Using Reuse I cut the PDF into individual pages
for( $i = 0; $i < $TotalPgs; $i++ ) {
$CurrPg = $i + 1;
print "Creating PDF File for Page: $CurrPg\n";
prFile( "DOMTMP$CurrPg.pdf");
prDoc( { file => "$SFile",
first => $CurrPg,
last => $CurrPg });
prEnd();
}
Using PDF::API2 I am createing a new page with a banner and individual PDF pages.
$pdf2 = PDF::API2->open("$ArtPDF");
$pdf = PDF::API2->new;
$img = $pdf->pdfimage("$ArtPDF", 1);
$page = $pdf->page;
$page->mediabox(595, 842);
$gfx = $page->gfx;
$gfx->pdfimage($img, 0, 0, 1);
$imgx = $pdf->pdfimage("$HeadPDF", 1);
$gfx = $page->gfx;
$gfx->pdfimage($imgx, 40, 780, 1);
print "Creating new DOMTMP$PgCnt.pdf\n";
$pdf->saveas("DOMTMP$PgCnt.pdf");
$pdf->end();
$pdf2->end();
Then I am joining PDF pages using Reuse.
prFile("$OFile");
for( $i = 0; $i < $TotalPgs; $i++ ) {
$CurrPg = $i + 1;
prDoc( "DOMTMP$CurrPg.pdf" );
}
prEnd();
This logic may not be a direct one but it works perfectly.
Regards
Dominic
| |
| Thomas 2004-04-28, 5:50 am |
| junk@dlink.org (Aqua) wrote in message news:<55d7995c.0404270235.67dd5876@posting.google.com>...
> Group,
>
> Could someone point me to a tutorial for PDF::API2 usage? (or samples
> etc) Really I dont know how to start.
>
> Basically I wanted to place a small banner (another PDF) in each page
> of original PDF. How to do this?
>
> Thanks for your time
>
> Dominic
http://groups.yahoo.com/group/perl-text-pdf-modules/
Alfred Reibenschuh is the maintainer...but also some other people
there should be able to help u ! (i guess its possible)
best regards
Thomas
|
|
|
|
|