annotations.add(txtLink);
// Now draw a few more annotations
PDAnnotationSquareCircle aCircle =
new PDAnnotationSquareCircle( PDAnnotationSquareCircle.SUB_TYPE_CIRCLE);
aCircle.setContents("Circle Annotation");
aCircle.setInteriorColour(colourRed); // Fill in circle in red
aCircle.setColour(colourBlue); // The border itself will be blue
aCircle.setBorderStyle(borderThin);
// Place the annotation on the page, we'll make this 1" round
// 3" down, 1" in on the page
position = new PDRectangle();
position.setLowerLeftX(inch);
position.setLowerLeftY(ph-(3*inch)-inch); // 1" height, 3" down
position.setUpperRightX(2*inch); // 1" in, 1" width
position.setUpperRightY(ph-(3*inch)); // 3" down
aCircle.setRectangle(position);
// add to the annotations on the page
annotations.add(aCircle);
// Now a square annotation
PDAnnotationSquareCircle aSquare =
new PDAnnotationSquareCircle( PDAnnotationSquareCircle.SUB_TYPE_SQUARE);
aSquare.setContents("Square Annotation");
aSquare.setColour(colourRed); // Outline in red, not setting a fill
aSquare.setBorderStyle(borderThick);
// Place the annotation on the page, we'll make this 1" (72points) square
// 3.5" down, 1" in from the right on the page
position = new PDRectangle(); // Reuse the variable, but note it's a new object!
position.setLowerLeftX(pw-(2*inch)); // 1" in from right, 1" wide
position.setLowerLeftY(ph-(float)(3.5*inch) - inch); // 1" height, 3.5" down
position.setUpperRightX(pw-inch); // 1" in from right
position.setUpperRightY(ph-(float)(3.5*inch)); // 3.5" down
aSquare.setRectangle(position);
// add to the annotations on the page
annotations.add(aSquare);
// Now we want to draw a line between the two, one end with an open arrow