Yan Wong - 2014-05-19

I've been using the Java version of pdfclown (the most recent SVN release branch) to try to make a pdf with clickable annotations, so that a mouseDown on the annotation opens up a URL. But nothing I try seems to work. I've tried

    org.pdfclown.documents.interaction.annotations.Polygon pg = 
      new org.pdfclown.documents.interaction.annotations.Polygon(
        page,
        new Rectangle.Double(50, 350, 100, 30),
        "test me!");
    Point2D[] pts = {
        (Point2D)new Point2D.Double(50, 350),
        (Point2D)new Point2D.Double(50,380),
        (Point2D)new Point2D.Double(150,380),
        (Point2D)new Point2D.Double(150,350)};

    pg.setVertices(Arrays.asList(pts));
    Action goto_ob = new GoToURI(
            document,
            new URI("http://pdfclown.org/")
        );
    pg.setAction(goto_ob);

and also

    org.pdfclown.documents.interaction.annotations.AnnotationActions act = 
      new org.pdfclown.documents.interaction.annotations.AnnotationActions(pg);
    act.setOnMouseDown(goto_ob);
    pg.setActions(act);

Is there any way to do this?

Incidentally, I can't get the polygon annotation to take up a colour either. Doing pg.setFillColor(DeviceRGBColor.get(Color.RED)); seems to do nothing.

Cheers

Yan