Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

PDF::API2
Hi everyone,
Today I am stuck with PDF::API2. Although seeming very powerful, the module
documentation is horridly lacking. I was able to figure a great deal of what
I need by directly examining the source, however some issues are left
unsolved:

1. Is there a way to get the (x,y) pos and maybe more attributes of an
already processed object? I looked all over the place - doesn't look like
there is such a function. Even if I put every single line and dot into a
separate handler - the dump of the structure still does not yield anything.
I need this to be able to do background hilighting - e.g. I placed some text
through handler $some_text, I pass it to the subroutine, it extracts the
starting position, the alignment and the width of the text and creates an
ellipse behind it with a certain fillcolor. I actually have more uses for
that, but this is the main one.

2. I don't really understand the entire concept of objectifying content
elements - I can have a $paragraph object handler and use ->text in
conjunction with ->nl to write out an entire paragraph, or I can make a
separate handler for each line - the output doesn't seem to change. In this
case - why the need/possibility for separate handlers?

3. Is there a difference between methods ->gfx->textlabel and ->text ? I
understand they have a different syntax but they seem to do the same thing
in the end.

4. Is there vertical alignment for text? Or the font is always centered
between the zone denoted by ->lead ?

I have seen questions about PDF::API2 on this list before, and here and
there people were suggested to try other modules. Unfortunately
PDF::API2::Lite has 0 documentation and PDF::Report does not seem to be able
to do all the graphics that I would eventually need in my case. So I am
stuck with the vanilla API2. Any help/comments/and most importantly
references to somewhat complete documentation/examples would be appreciated.

Thank you

Peter

Report this thread to moderator Post Follow-up to this message
Old Post
Peter Rabbitson
04-20-05 08:56 PM


Re: PDF::API2
On Wed, 20 Apr 2005 10:27:47 -0500
Peter Rabbitson <rabbit@rabbit.us> wrote:


> Today I am stuck with PDF::API2. Although seeming very powerful, the modul
e
> documentation is horridly lacking. I was able to figure a great deal of wh
at
> I need by directly examining the source, however some issues are left
> unsolved:



I can't help you but I do have this page bookmarked which may be of assistan
ce

http://www.printaform.com.au/clients/pdfapi2/





Owen

Report this thread to moderator Post Follow-up to this message
Old Post
Owen
04-21-05 08:56 AM


Re: PDF::API2
Peter Rabbitson wrote:

>Hi everyone,
>Today I am stuck with PDF::API2. Although seeming very powerful, the module
>documentation is horridly lacking. I was able to figure a great deal of wha
t
>I need by directly examining the source, however some issues are left
>unsolved:
>
>1. Is there a way to get the (x,y) pos and maybe more attributes of an
>already processed object? I looked all over the place - doesn't look like
>there is such a function. Even if I put every single line and dot into a
>separate handler - the dump of the structure still does not yield anything.
>I need this to be able to do background hilighting - e.g. I placed some tex
t
>through handler $some_text, I pass it to the subroutine, it extracts the
>starting position, the alignment and the width of the text and creates an
>ellipse behind it with a certain fillcolor. I actually have more uses for
>that, but this is the main one.
>
>
>
Are you rendering the text yourself, or editing an existing PDF? If
you're rendering it yourself, then you should be tracking where you're
up to. Otherwise, sorry, I haven't editing existing PDFs before.

>2. I don't really understand the entire concept of objectifying content
>elements - I can have a $paragraph object handler and use ->text in
>conjunction with ->nl to write out an entire paragraph, or I can make a
>separate handler for each line - the output doesn't seem to change. In this
>case - why the need/possibility for separate handlers?
>
>
I single object reduces the size of the resulting pdf a little. If you
have a *lot* of objects, it makes a difference. I'm working on a PDF
report writer ( which I'm calling PDF::ReportWriter unless someone
objects ), upon reading your post I realised that I was creating a new
gfx object each time I was rendering a cell ( box ). When I changed this
to only create a new gfx object per page, the PDF dropped from 80k to
32k. I assume a smaller PDF will be rendered to screen faster as well.

Another reason why you may want to use separate objects is that this (
apparently ) makes it easier to edit the pdf later ( ie easier to get
the part you want, I assume ). As I said, I haven't done this, but I'd
read quickly over some else's description of doing it.

>3. Is there a difference between methods ->gfx->textlabel and ->text ? I
>understand they have a different syntax but they seem to do the same thing
>in the end.
>
>
>
No idea.

>4. Is there vertical alignment for text? Or the font is always centered
>between the zone denoted by ->lead ?
>
>
>
As far as I know, there is no vertical alignment.

>I have seen questions about PDF::API2 on this list before, and here and
>there people were suggested to try other modules. Unfortunately
>PDF::API2::Lite has 0 documentation and PDF::Report does not seem to be abl
e
>to do all the graphics that I would eventually need in my case. So I am
>stuck with the vanilla API2.
>
Yeah that's basically the conclusion I came to. Zero documentation is a
big turn-off. That plus Perl programmers find white-space offensive so
going through the source code to their work requires a pack of headache
tablets.

Keep in mind that you don't necessarily have to do all your work with
one library. You can do some rendering with one, and then move to
another. For example, you could save the PDF and re-open it in another.
Alternatively, you can grab the PDF::API2 object and work with it directly.

If you're interested, I can email you with my unfinished
PDF::ReportWriter ... it's *almost* ready for an initial release. I'm
pondering whether I should remove the dodgy hard-coded stuff or not.

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@nusconsulting.com.au
website: http://www.nusconsulting.com.au

Report this thread to moderator Post Follow-up to this message
Old Post
Daniel Kasak
04-21-05 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:15 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.