| Code with Finding: |
class PdfAnnotation {
/**
* Adds a circle or a square that shows a tooltip when you pass over it.
* @param writer
* @param rect
* @param contents The tooltip
* @param square true if you want a square, false if you want a circle
* @return A PdfAnnotation
*/
public static PdfAnnotation createSquareCircle(PdfWriter writer, Rectangle rect, String contents, boolean square) {
PdfAnnotation annot = new PdfAnnotation(writer, rect);
if (square)
annot.put(PdfName.SUBTYPE, PdfName.SQUARE);
else
annot.put(PdfName.SUBTYPE, PdfName.CIRCLE);
annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
return annot;
}
}
|