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/04 08:26:29 UTC

Getting information about paths and other graphical objects

Hello. I have PDFs that e.g. have circles or filled rectangles in them which aren't images. How am I able to identify those and get information about them, such as position etc.? Someone told me those are paths, but I see no way to access them via PDFBox.

Greetings
-- 
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser

Re: Getting information about paths and other graphical objects

Posted by Villu Ruusmann <vi...@gmail.com>.
Hello there,

On Thu, Mar 4, 2010 at 9:26 AM, Robert Main <RM...@gmx.de> wrote:
> Hello. I have PDFs that e.g. have circles or filled rectangles in them which aren't images. How am I able to identify those and get information about them, such as position etc.? Someone told me those are paths, but I see no way to access them via PDFBox.
>

Please take a look at the class
org.apache.pdfbox.pdfviewer.PageDrawer, methods #fillPath(int) and
#strokePath()

Here's an example:

class PrintPaths extends PageDrawer {

  @Override
  public void fillPath(int windingRules){
    System.out.println(getLinePath());
    super.fillPath(windingRules);
  }

  @Override
  public void strokePath(){
    System.out.println(getLinePath());
    super.strokePath();
  }
}


VR