Line annotations created with Aspose.PDF for Java don't display in Chrome

Line/arrow annotations added with Aspose.PDF for Java do not display in Chrome’s built-in PDF viewer. They do display when the PDF is viewed with Acrobat, Acrobat Reader and the Preview app on macOS. Note that line annotations created directly in Acrobat display in Chrome wthout issue.

Below is an example that produces a PDF demonstrating the issue. An input document to use with the example is attached.

input_document.pdf (30.7 KB)

Versions used to test this issue…

  • Aspose.PDF for Java com.aspose:aspose-pdf:21.6
  • Chrome for macOS Version 102.0.5005.61 (Official Build) (x86_64)
  • Chrome for Windows Version 102.0.5005.63 (Official Build) (64-bit)

Example code…

public class LineAnnotationBug {
    public static void main(String[] args) {
        Document inputDoc = null;
        try {
            // Set to the path of your Aspose license file or comment out
            License pdfLicense = new License();
            pdfLicense.setLicense("aspose.lic");

            // Open input document
            inputDoc = new Document("input_document.pdf");

            // Example code directly from....
            // https://docs.aspose.com/pdf/java/figures-annotation/#how-to-add-line-annotation-into-existing-pdf-file
            Page page = inputDoc.getPages().get_Item(1);

            // Add line annotation to the page
            LineAnnotation lineAnnotation = new LineAnnotation(page, new Rectangle(550, 93, 562, 439),
                    new Point(556, 99), new Point(556, 443));

            lineAnnotation.setTitle("John Smith");
            lineAnnotation.setColor(Color.getRed());
            lineAnnotation.setWidth(3);
            lineAnnotation.setStartingStyle(LineEnding.OpenArrow);
            lineAnnotation.setEndingStyle(LineEnding.OpenArrow);
            lineAnnotation.setPopup(new PopupAnnotation(page, new Rectangle(842, 124, 1021, 266)));

            page.getAnnotations().add(lineAnnotation);

            // Save output document
            inputDoc.save("output_document.pdf");
        } catch(Exception ex) {
            System.err.printf("An exception occurred: %s%n", ex.getLocalizedMessage());
            System.exit(1);
        } finally {
            if (inputDoc != null) {
                inputDoc.close();
                inputDoc.dispose();
            }
        }
    }
}

@rgabbard

We were able to reproduce the issue in our environment using 22.5 version of the API. Therefore, it has been logged as PDFJAVA-41694 in our issue tracking system. We will further look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

@asad.ali Just checking to see if there is any update on this issue or perhaps an ETA on when we might expect to see a resolution? Thanks!

@rgabbard

We are afraid that the earlier logged ticket has not been yet resolved. We will surely investigate it on a first come first serve basis and let you know as soon as we have some news about its resolution or ETA. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFJAVA-41694) have been fixed in Aspose.PDF for Java 23.10.