Re: Re: rounded rectangles - deformed!
Alan Fry <ajf-n9G92GgND9yX/[email protected]> Mon, 7 Jul 2008 09:38:09 +0100
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
So far as I can see the 'Niko Tyni patch' is not applied to the
'Content.pm' returned by the link to CPAN below.
The link to the patch appears to have been moved to <http://rt.cpan.org/Public/Bug/Display.html?id=18222
> from which there are working links to 'pdf-test.pl' and the patch
itself. So all is not lost. But it will take some work to get back to
where matters were a year ago.
Returning to Rick Measham's original post I have experimented with
this script:
#!/usr/bin/perl
use strict;
use warnings;
use PDF::API2;
my $pdf = PDF::API2->new( -file => "$0.pdf" );
my $page = $pdf->page;
$page->mediabox(842, 595);
my $gfx = $page->gfx;
$gfx->strokecolor('green');
$gfx->move(110, 0);
$gfx->vline(595);
$gfx->move(0, 485);
$gfx->hline(842);
$gfx->move(732, 0);
$gfx->vline(595);
$gfx->stroke;
$gfx->strokecolor('black');
$gfx->arc(110, 485, 100, 100, 180, 90, 1);
$gfx->line(832, 485); #try with this line commented out
$gfx->arc(732, 485, 100, 100, 0, 270, 0);
$gfx->stroke;
$pdf->save;
which does exactly what one would expect. However comment out line 21
('$gfx->line(832, 485)') and the line drawn seems to me quite bizarre.
In PostScript 'arc' creates a straight line from the current point to
the first end point of the arc followed by an arc of a circle to the
second end point. API2 appears to create some sort of Bezier curve
from the current point to to final end point. Is that what it is
supposed to do? If so it is difficult to see in what circumstances it
might be useful.
In an attempt to try to see what is going on a 'print' extracts the
p3_x and y returned by 'arc'. The result (with or without line 21) is:
p3x = 17.6120467488713; p3y = 523.268343236509
p3x = 39.2893218813453; p3y = 555.710678118655
p3x = 71.731656763491; p3y = 577.387953251129
p3x = 110; p3y = 585
p3x = 827.694033573221; p3y = 514.028467725446
p3x = 815.146961230255; p3y = 540.55702330196
p3x = 795.439328416365; p3y = 562.301045336274
p3x = 770.268343236509; p3y = 577.387953251129
p3x = 741.801714032956; p3y = 584.51847266722
p3x = 712.490967798387; p3y = 583.078528040323
p3x = 684.8603263174; p3y = 573.192126434835
p3x = 661.289321881345; p3y = 555.710678118655
p3x = 643.807873565165; p3y = 532.1396736826
p3x = 633.921471959677; p3y = 504.509032201613
p3x = 632.48152733278; p3y = 475.198285967044
p3x = 639.612046748871; p3y = 446.731656763491
p3x = 654.698954663726; p3y = 421.560671583635
p3x = 676.44297669804; p3y = 401.853038769746
p3x = 702.971532274554; p3y = 389.305966426779
p3x = 732; p3y = 385
It would be most helpful if some one could shed some light on what
this is all about. The last line at least is comprehensible.
My version of 'Content.pm' is '2.9 2007/10/10 06:18:15' -- which I
believe is the latest current version on CPAN?
Regards,
Alan Fry
On 6 Jul 2008, at 18:19, jeffchimene wrote:
> --- In [email protected], "Steve Kleiman"
> <steve@...> wrote:
> >
> > check out:
> > http://tech.groups.yahoo.com/group/perl-text-pdf-modules/message/
> 2922
> >
> > regrettably a patch was submitted for this in March 06 but has never
> > been applied to PDF::API2 -
> <-- SNIP -->
>
> The patch was applied. The log shows it was applied on May 08 2007.
> See:
> http://search.cpan.org/src/AREIBENS/PDF-API2-0.69/lib/PDF/API2/Content.pm
>
> Cheers,
> jec
>
>
>