You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by RM...@gmx.de on 2010/05/12 14:03:53 UTC

PDF object layers

I want to draw the path objects (lines etc.) on a pdf page and for that reason made a class that inherits PageDrawer. It overrides fillPath and strokePath and stores the GeneralPath objects used in those methods for later use. That works flawlessly, however how can I tell when I later draw those objects that one should hide parts of the other or not? I don't see any information on this, but I converted the page into an image using your PDFToImage program and it displayed correctly, so how do I do it? I guess I need information to which layer an object belongs to, but have no idea where that would be.

A small example would be http://www.4shared.com/document/2JtVrpkW/file.html
It's basically 2 rectangles where one hides parts of the other one.

Robert
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Re: PDF object layers

Posted by RM...@gmx.de.
I forgot that I also had the information if the path had to be a stroke or be filled... I used draw(Shape) and that always only drew it as a stroke. I now changed the code so it knows if it has to be filled or not, now it works even with lots of shapes at once. The goal was to export the graphical content into an SVG for later use, which now works. 
Thanks.


-------- Original-Nachricht --------
> Datum: Sat, 22 May 2010 17:37:03 +0200
> Von: Andreas Lehmkuehler <an...@lehmi.de>
> An: RMain@gmx.de
> Betreff: Re: PDF object layers

> Hi,
> 
> RMain@gmx.de schrieb:
> > I want to draw the path objects (lines etc.) on a pdf page and for that
> reason made a class that inherits PageDrawer. 
> > It overrides fillPath and strokePath and stores the GeneralPath objects
> used in those methods for later use. That works flawlessly,
> > however how can I tell when I later draw those objects that one should
> hide parts of the other or not? I don't see any information 
> > on this, but I converted the page into an image using your PDFToImage
> program and it displayed correctly, so how do I do it? I guess
> > I need information to which layer an object belongs to, but have no idea
> where that would be.
> There is no concept of different layers within pdfs. There are some things
> you 
> have to take into amount if we talk about graphic objects:
> 
> - all objects will be processed one after the other, just in the order in
> which 
> they are read from the stream
> - but be aware: it is possible to move the graphics state (consists of
> color 
> information, clipping path and some more things) to a stack and get it
> back later
> - some paths are used as clipping path, which is used to limit the drawing
> area
> 
> So, I'm afraid it is not sufficient to just collect all path information
> from 
> fill/strokePath. What is the goal of your code? Do you want to just filter
> the 
> graphical content of a pdf to draw it with java2d?
> 
> BR
> Andreas Lehmkühler

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01