How to use PDF::API2 Perl Module for placing a Banner

A

Aqua

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
 
A

Aandi Inston

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

Aqua

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,

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
 
T

Thomas

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
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top