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

Discussion in 'Perl Misc' started by Aqua, Apr 27, 2004.

  1. Aqua

    Aqua Guest

    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
    Aqua, Apr 27, 2004
    #1
    1. Advertising

  2. Aqua

    Aandi Inston Guest

    (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 http://www.quite.com
    Please support usenet! Post replies and follow-ups, don't e-mail them.
    Aandi Inston, Apr 27, 2004
    #2
    1. Advertising

  3. Aqua

    Aqua Guest

    (Aandi Inston) wrote in message news:<>...
    > (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 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
    Aqua, Apr 28, 2004
    #3
  4. Aqua

    Thomas Guest

    (Aqua) wrote in message news:<>...
    > 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
    Thomas, Apr 28, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. michael vernersen

    Perl::API2 PDF problem.

    michael vernersen, Feb 29, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    76
    michael vernersen
    Feb 29, 2004
  2. mike

    justify text and PDF::API2 module

    mike, Feb 17, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    115
  3. Bruce Horrocks
    Replies:
    0
    Views:
    380
    Bruce Horrocks
    Jan 24, 2006
  4. Ted Byers
    Replies:
    3
    Views:
    138
    Peter J. Holzer
    Dec 17, 2008
  5. Jasper2000

    PDF::API2 (Creating PDF files)

    Jasper2000, Mar 11, 2010, in forum: Perl Misc
    Replies:
    1
    Views:
    274
    Jasper2000
    Mar 11, 2010
Loading...

Share This Page