Fwd: First time using Perl & PDF::API2
- From: paikkos@xxxxxxxxxxxxxx (Dermot)
- Date: Wed, 28 May 2008 08:28:50 +0100
2008/5/28 Daniel Kasak <dkasak@xxxxxxxxxxxxxxxxxxxx>:
On Tue, 2008-05-27 at 07:10 -0700, ChrisC wrote:
Hi!,
Not sure if using PDF::API2 is a good choice or not. Little to no
doc.
Yeah it's very powerful, and *very* poorly documented. What's worse, one
of the best tutorials ( http://rick.measham.id.au/pdf-api2/ ) has a big
photo of John f'n Howard in it. There's no need to immortalise that war
criminal.
In the "sub paging " I create the next page, but the
script does not print in the next page. Do I have to tell it to print
on page 2? If so how?
For each page, you have to set up page dimensions, create new text and
graphics objects, eg:
# Set page dimensions
$page->mediabox( $self->{page_width}, $self->{page_height} );
# Create a new txt object for the page
$self->{txt} = $page->text;
# Set y to the top of the page
$self->{y} = $self->{page_height} - $self->{upper_margin};
# Create a new gfx object for our lines
$self->{line} = $page->gfx;
How do I add an image, jpg etc.
$gfx->image(
$image, # The image
$img_x_pos, # X
$img_y_pos, # Y
$imgdata->{scale_ratio} # scale
);
You might want to look at my project, PDF::ReportWriter. It uses
PDF::API2 to produce reports. It simplifies things considerably, does
page breaking for you, grouping, etc. You can also use it just to render
text ( keep calling $report->render_data with new text ). I use it for
everything from Access-like reports to producing mail-merge letters ( it
does alignment, justification, etc as well ).
I would point you to my webpage, but I accidentally lost everything
during a server upgrade, so you'll have to get it from CPAN. You can
either use it directly, or view the source to see how to use PDF::API2.
Let me know if you have any other questions, feature requests, etc.
Dan
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
I have to agree. I really like PDF::API2 but the documentation is a
little poor. I think the guy how created it (Alfred Reibenschuh) moved
on before he had time to write the documentation up. It would be
really cool if someone could come up with a new tutorial. I also
wonder if there is some more features that could be added to the API
now. No one has done any work on it since 2005.
Just a though,
Dp.
.
- References:
- First time using Perl & PDF::API2
- From: ChrisC
- First time using Perl & PDF::API2
- Prev by Date: Getting Segmentation fault
- Next by Date: about SFTP and Thread dependency
- Previous by thread: First time using Perl & PDF::API2
- Next by thread: gateway between googlegroups and the list
- Index(es):
Relevant Pages
|