TomRoush / PdfBox-Android

The Apache PdfBox project ported to work on Android
Apache License 2.0
1.02k stars 260 forks source link

Can PDFbox render comments on PDF files on Android devices? #491

Open Origina1s-jay opened 1 year ago

Origina1s-jay commented 1 year ago

Can PDFbox render comments on PDF files on Android devices?

After I used pdfbox, I found that when I used PdfRenderer.Page.render to convert the content of the pdf page to a bitmap, I found that the annotations above were missing.

Ahsan2408 commented 3 months ago

You'll need to make sure you set the appearance of the annotation. In my case, it worked like this PDAppearanceDictionary appearanceDictionary = new PDAppearanceDictionary(); appearanceDictionary.setNormalAppearance(appearanceStream); textAnnotation.setAppearance(appearanceDictionary);

you can set default appearance. textAnnotation.setDefaultAppearance("/Helv 12 Tf 0 g");