List of usage examples for org.apache.pdfbox.pdmodel.interactive.annotation PDAnnotationText setContents
public void setContents(String value)
From source file:de.berber.kindle.annotator.lib.Comment.java
License:Apache License
@Override protected PDAnnotation toPDAnnotation(final @Nonnull PDDocumentOutline documentOutline, final @Nonnull PDPage page) { LOG.info("Creating annotation " + xPositionFactor + "/" + yPositionFactor + " -> " + text); // Create annotation text with background color final PDGamma pdColor = getColor(); final PDAnnotationText textAnnotation = new PDAnnotationText(); textAnnotation.setContents(getText()); textAnnotation.setColour(pdColor);//w ww .j av a 2 s .co m // set the text position final PDRectangle cropBox = page.getTrimBox(); final PDRectangle position = new PDRectangle(); position.setLowerLeftX((float) (cropBox.getLowerLeftX() + xPositionFactor * (cropBox.getUpperRightX() - cropBox.getLowerLeftX()))); position.setUpperRightX((float) (cropBox.getLowerLeftX() + xPositionFactor * (cropBox.getUpperRightX() - cropBox.getLowerLeftX()))); position.setUpperRightY((float) (cropBox.getUpperRightY() - yPositionFactor * (cropBox.getUpperRightY() - cropBox.getLowerLeftY()))); position.setLowerLeftY((float) (cropBox.getUpperRightY() - yPositionFactor * (cropBox.getUpperRightY() - cropBox.getLowerLeftY()))); textAnnotation.setRectangle(position); return textAnnotation; }