Skip to content

Commit

Permalink
GH-316 fix print issue with documents that do not have annotations. (#…
Browse files Browse the repository at this point in the history
…317)

Co-authored-by: Patrick Corless <[email protected]>
  • Loading branch information
pcorless and Patrick Corless authored Nov 15, 2023
1 parent 2a74a7d commit 50c8d60
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,14 @@ public int print(Graphics printGraphics, PageFormat pageFormat, int pageIndex) {
Dimension dim = pageDim.toDimension();
Rectangle2D.Float rect = new Rectangle2D.Float(0, 0, dim.width, dim.height);
List<Annotation> annotations = currentPage.getAnnotations();
for (Annotation annot : annotations) {
Rectangle2D.union(
rect,
annot.calculatePageSpaceRectangle(currentPage, Page.BOUNDARY_MEDIABOX, rotation, zoomFactor),
rect);
if (annotations != null) {
for (Annotation annot : annotations) {
Rectangle2D.union(
rect,
annot.calculatePageSpaceRectangle(currentPage, Page.BOUNDARY_MEDIABOX, rotation,
zoomFactor),
rect);
}
}

// Get location of imageable area from PageFormat object
Expand Down

0 comments on commit 50c8d60

Please sign in to comment.