Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: PDF::API2 Editing PDf files

by ikkon (Monk)
on Dec 14, 2006 at 22:49 UTC ( [id://589928]=note: print w/replies, xml ) Need Help??


in reply to Re: PDF::API2 Editing PDf files
in thread PDF::API2 Editing PDf files

well I got as far as creating a pdf and then opening and writing text, i need to write the text on the first page of the opened file but every time i try it apends it to another page.
use PDF::API2; use DBI; use strict; use constant mm => 25.4/72; use constant in => 1/72; use constant pt => 1; $pdf = PDF::API2->open('Build.pdf'); my %font = ( Helvetica => { Bold => $pdf->corefont('Helvetica-Bold', -encoding => 'la +tin1'), # Roman => $pdf->corefont('Helvetica', -encoding => 'la +tin1'), # Italic => $pdf->corefont('Helvetica-Oblique', -encoding => 'la +tin1'), }, Times => { # Bold => $pdf->corefont('Times-Bold', -encoding => 'la +tin1'), Roman => $pdf->corefont('Times', -encoding => 'la +tin1'), # Italic => $pdf->corefont('Times-Italic', -encoding => 'la +tin1'), }, ); my $page = $pdf->page; my $headline_text = $page->text; $headline_text->font( $font{'Helvetica'}{'Bold'}, 18/pt ); $headline_text->fillcolor( 'white' ); $headline_text->translate( 19/mm, 131/mm ); $headline_text->text_right( 'this is my new stuff' ); $pdf->saveas("Build2.pdf");

Replies are listed 'Best First'.
Re^3: PDF::API2 Editing PDf files
by almut (Canon) on Dec 15, 2006 at 00:30 UTC

    It's your my $page = $pdf->page; that's creating the new page.

    To put further content on an already existing page, simply use the method openpage instead, e.g. my $page = $pdf->openpage(1) for the first page -- see the section "PAGE METHODS" in the module's docs for the details.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://589928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found