PopupAnnotation Class
Defines a PDF popup annotation.
Declaration
public class PopupAnnotation extends BaseAnnotation
Remarks
A popup annotation displays the text associated with a markup annotation in a separate pop-up window. Unlike other annotation types, a popup annotation cannot exist on its own. It must be associated with a MarkupAnnotation, such as a text, free text, highlight, or rubber stamp annotation.
Use the setOpen(boolean value) method to specify whether the popup is initially displayed when the document is opened.
The following code snippet creates a free text annotation, specifies its author, content, and text appearance, and adds the annotation to a page:
package pdf;
import com.devexpress.docs.pdf.*;
import com.devexpress.system.drawing.*;
import java.nio.channels.*;
import java.nio.file.*;
public class Main {
public static void main(String[] args) throws Exception {
try (FileChannel fileChannel = FileChannel.open(Path.of("Document.pdf"));
PdfDocument pdfDocument = new PdfDocument(fileChannel)) {
Page page = pdfDocument.getPages().getFirst();
createFreeTextAnnotation(page);
// Save the document.
try (WritableByteChannel channel =
FileChannel.open(Path.of("Result.pdf"),
StandardOpenOption.CREATE,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)) {
pdfDocument.save(channel);
}
}
}
static void createFreeTextAnnotation(Page page) {
FreeTextAnnotation annotation =
new FreeTextAnnotation(
new RectangleF(200, 520, 260, 220));
annotation.setTitle("John Smith");
annotation.setSubject("Editorial Review");
annotation.setContent("Update this section.");
annotation.setTextJustification(TextJustification.LEFT_JUSTIFIED);
annotation.setDefaultStyle("font: Times-Roman 12pt; color: #2B579A;");
annotation.setOpacity(0.5);
annotation.getPopup().setOpen(true);
page.getAnnotations().add(annotation);
}
}
The following screenshot illustrates the result:

Inherited Members
Inheritance
PopupAnnotation(MarkupAnnotation markupAnnotation, RectangleF bounds)
Initializes a new instance of the PopupAnnotation class with the specified settings.
Declaration
public PopupAnnotation(MarkupAnnotation markupAnnotation, RectangleF bounds)
Parameters
| Name | Type | Description |
|---|---|---|
| markupAnnotation | MarkupAnnotation | The markup annotation associated with the popup annotation. |
| bounds | RectangleF | The popup annotation bounds. |
Methods
getOpen() Method
Returns whether the popup annotation is open.
Declaration
public boolean getOpen()
Returns
| Type | Description |
|---|---|
| boolean |
|
getParent() Method
Returns the popup annotation parent.
Declaration
public BaseAnnotation getParent()
Returns
| Type | Description |
|---|---|
| BaseAnnotation | The popup annotation parent. |
setOpen(boolean value) Method
Sets whether the popup annotation is open.
Declaration
public void setOpen(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
setParent(BaseAnnotation value) Method
Sets the popup annotation parent.
Declaration
public void setParent(BaseAnnotation value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | BaseAnnotation | The popup annotation parent. |