Re: Tk::Canvas to PDF module offer

"John" <[email protected]>
Newsgroups gmane.comp.lang.perl.tk
Message-ID <004601c4d6dc$440194c0$747882c3@jonsof>
Well, I installed the PDF::API2 through the ppm (Activestate perl)

Now what?

giving

>perldoc Tk::Canvas::PDF

i receive no results (i tried to install the Tk::Canvas::PDF using ppm but
it cannot find that module)

How to unify the Canvas and Pdf api now?



----- Original Message ----- 
From: "Petr Pajas" <[email protected]>
To: "John" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, November 30, 2004 2:16 PM
Subject: Re: Tk::Canvas to PDF module offer


Dne út 30. listopadu 2004 08:31 John napsal(a):
> Hello
>
> How did you hack the module?

Simply:-) It uses PDF::API2 module to create the actual PDF content.
It creates a new PDF object and a PDF page, then it examinines
every object on a given canvas one by one and translates it to a
corresponding PDF-object. It's really only a matter of itemCget,
some conversions on the object parameters and some PDF::API2 calls.

The only harder thing to implement were the arrows (if a multi-line
is smooth, you have to position the arrow head correctly) and
shapes.

> Does it work for you? With any encoding even with iso-8859-7 ?

Yes, of course, it works for me fine (Linux/Windows/MacOSX-X11) :-)
(I use it as one of Print outputs in a tree-editor called TrEd -
used mostly for linguistic annotation, see
a shot: http://ckl.mff.cuni.cz/pajas/tred_doc/pics/treddiff.png
or homepage: http://ckl.mff.cuni.cz/pajas/tred/),

Yes, I hope it should handle iso-8859-7 too (at least, it worked
with iso-8859-2 and iso-8859-6). If using "8bit" Tk (<800) only
have to specify the encoding to the PDF conversion routine. If you
use unicode/utf8 Tk>804, it should work out of the box.

> Could you tell us more, because that is so intresting.

It's attached. It's called Tk::Canvas::PDF and uses the same
namespace. It can be used in various ways, but as the simplest
approach it adds a new $canvas->pdf method (very similar to
$canvas->postscript) to the Tk::Canvas namespace.

It depends on the attached Tk::rgb.pm (it's just color-names to rgb
map) and the standard Encode module (perl>=5.7), but the later
dependency should be relatively easily to remove.

I think it gives best result with TrueType fonts, but PS fonts and
PDF-core fonts are supported as well.

It only lacks documentation, except for a short (probably outdated)
synopsis-like POD.

As I told earlier, I don't have time to put it all in shape, at
least not right now. So if anyone was interested in taking it,
probably going through the code, writing some POD and preparing it
for a release, I'd be glad. If not, you can use it as it is. Maybe
in the up-comming weeks I'll be able to find some to do that
myself...

-- Petr

> ----- Original Message -----
> From: "Petr Pajas" <[email protected]>
> To: <[email protected]>
> Sent: Monday, November 29, 2004 8:06 PM
> Subject: Tk::Canvas to PDF module offer
>
>
>
> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> This message was posted through the Stanford campus mailing list
> server.  If you wish to unsubscribe from this mailing list, send
> the message body of "unsubscribe ptk" to
> [email protected]


-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.