@june24/expo-pdf-reader 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/ExpoPdfReaderView.swift +12 -0
- package/package.json +1 -1
|
@@ -461,6 +461,12 @@ class ExpoPdfReaderView: ExpoView, UIGestureRecognizerDelegate {
|
|
|
461
461
|
func setAnnotations(_ annotations: [[String: Any]]) {
|
|
462
462
|
guard let document = pdfView.document else { return }
|
|
463
463
|
|
|
464
|
+
// Clear all existing annotations first
|
|
465
|
+
for i in 0..<document.pageCount {
|
|
466
|
+
guard let page = document.page(at: i) else { continue }
|
|
467
|
+
page.annotations.removeAll()
|
|
468
|
+
}
|
|
469
|
+
|
|
464
470
|
// Clear undo/redo stacks when setting annotations
|
|
465
471
|
undoStack.removeAll()
|
|
466
472
|
redoStack.removeAll()
|
|
@@ -512,10 +518,16 @@ class ExpoPdfReaderView: ExpoView, UIGestureRecognizerDelegate {
|
|
|
512
518
|
annotation.color = color
|
|
513
519
|
}
|
|
514
520
|
|
|
521
|
+
annotation.shouldDisplay = true
|
|
522
|
+
annotation.shouldPrint = true
|
|
515
523
|
page.addAnnotation(annotation)
|
|
516
524
|
}
|
|
517
525
|
}
|
|
518
526
|
}
|
|
527
|
+
|
|
528
|
+
// Force PDF view to refresh after setting annotations
|
|
529
|
+
pdfView.layoutDocumentView()
|
|
530
|
+
pdfView.setNeedsDisplay(pdfView.bounds)
|
|
519
531
|
}
|
|
520
532
|
|
|
521
533
|
@objc func handlePan(_ gesture: UIPanGestureRecognizer) {
|
package/package.json
CHANGED