Render embedded annotations in PDF (#59)
* Added support for reading and displaying embedded PDF annotations. Changes include: - Added JNI bindings in `NativePdfiumBridge` and `pdfium_bridge.cpp` to extract annotation count, subtypes, rectangles, and string values (Contents, NM, IRT, T) using PDFium. - Introduced `EmbeddedAnnotation` data class to represent PDF annotations and their reply threads. - Implemented annotation extraction logic in `PdfPageComposable` to fetch, group, and map embedded annotations (Sticky Notes, Highlights, etc.) to screen coordinates. - Updated `PdfSelectionMenuPopup` to support displaying and copying comment threads. - Improved selection menu positioning and hit detection for annotations. - Added a safety check to recycle bitmaps in `PdfTile` rendering if handover to the main thread fails. * Improved comment thread UI
This commit is contained in:
parent
06ec45504f
commit
8582ed9679
4 changed files with 585 additions and 159 deletions
|
|
@ -11,4 +11,14 @@ object NativePdfiumBridge {
|
|||
@JvmStatic external fun getPageFontSizes(textPagePtr: Long, count: Int): FloatArray?
|
||||
@JvmStatic external fun getPageFontWeights(textPagePtr: Long, count: Int): IntArray?
|
||||
@JvmStatic external fun getPageFontFlags(textPagePtr: Long, count: Int): IntArray?
|
||||
|
||||
@JvmStatic external fun getAnnotCount(pagePtr: Long): Int
|
||||
@JvmStatic external fun getAnnotSubtype(pagePtr: Long, index: Int): Int
|
||||
@JvmStatic external fun getAnnotRect(pagePtr: Long, index: Int): FloatArray?
|
||||
@JvmStatic external fun getAnnotString(pagePtr: Long, index: Int, key: String): String?
|
||||
|
||||
const val ANNOT_TEXT = 1 // Sticky Note
|
||||
const val ANNOT_LINK = 2 // Link
|
||||
const val ANNOT_HIGHLIGHT = 8 // Highlight
|
||||
const val ANNOT_INK = 12 // Freehand drawing
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue