You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Robert Main <RM...@gmx.de> on 2010/03/08 13:34:49 UTC

Problem with cubic paths

Hello.
I have GeneralPath objects that I extracted from a pdf and want to put them into another pdf. I can get the points just fine, however calculating the point to draw on screen doesn't seem to work.
I used the formula provided to draw the bezier curve and as you can see, it works. However, the object doesn't resemble the original at all.
You can see this in the following example; the original is this http://www.imn.htwk-leipzig.de/~sfreuck/circle.pdf and the result is http://www.imn.htwk-leipzig.de/~sfreuck/circout.pdf . 
I use a PathIterator to go through GeneralPath objects and each time if the currentSegment is cubic, I add that coordinate into a List and once the size of that list equals 4, I print it using the provided bezier algorithm. However as you can see, it doesn't quite work.

Another strange thing is that for this page, I have 4 GeneralPath objects, however there are 2 duplicates in there but I have no idea if this matters.

Greetings,

Sebastian
-- 
GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://portal.gmx.net/de/go/dsl02

Re: Problem with cubic paths

Posted by Daniel Wilson <wi...@gmail.com>.
Sebastian,

Our rendering routine in PDF2Image is handling this document correctly.  So
I believe the parsing and representation as paths are correct.

Can you use the routine in o.a.pdfbox.pdfviewer.PageDrawer.strokePath() to
turn the path that's been retrieved from the document into something
graphical?

Daniel

On Mon, Mar 8, 2010 at 7:34 AM, Robert Main <RM...@gmx.de> wrote:

> Hello.
> I have GeneralPath objects that I extracted from a pdf and want to put them
> into another pdf. I can get the points just fine, however calculating the
> point to draw on screen doesn't seem to work.
> I used the formula provided to draw the bezier curve and as you can see, it
> works. However, the object doesn't resemble the original at all.
> You can see this in the following example; the original is this
> http://www.imn.htwk-leipzig.de/~sfreuck/circle.pdf<http://www.imn.htwk-leipzig.de/%7Esfreuck/circle.pdf>and the result is
> http://www.imn.htwk-leipzig.de/~sfreuck/circout.pdf<http://www.imn.htwk-leipzig.de/%7Esfreuck/circout.pdf>.
> I use a PathIterator to go through GeneralPath objects and each time if the
> currentSegment is cubic, I add that coordinate into a List and once the size
> of that list equals 4, I print it using the provided bezier algorithm.
> However as you can see, it doesn't quite work.
>
> Another strange thing is that for this page, I have 4 GeneralPath objects,
> however there are 2 duplicates in there but I have no idea if this matters.
>
> Greetings,
>
> Sebastian
> --
> GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
> http://portal.gmx.net/de/go/dsl02
>