|
@@ -158,7 +158,7 @@ class ComPDFKitViewer {
|
|
|
|
|
|
if (verified) {
|
|
|
if (!this.webviewerServer) {
|
|
|
- const response = await fetch('/lib/DroidSansFallbackFull.ttf')
|
|
|
+ const response = await fetch('./lib/DroidSansFallbackFull.ttf')
|
|
|
const blob = await response.blob()
|
|
|
this.#fonFile = new File([blob], 'DroidSansFallbackFull.ttf', { type: blob.type })
|
|
|
}
|
|
@@ -654,7 +654,7 @@ class ComPDFKitViewer {
|
|
|
#formatAnnotation(rawAnnotation) {
|
|
|
const annotation = {}
|
|
|
annotation.type = rawAnnotation.type
|
|
|
- annotation.rect = this.#formatRect(rawAnnotation)
|
|
|
+ rawAnnotation.rect && (annotation.rect = this.#formatRect(rawAnnotation))
|
|
|
annotation.date = parseAdobePDFTimestamp(rawAnnotation.creationdate)
|
|
|
annotation.pageIndex = Number(rawAnnotation.page)
|
|
|
annotation.index = Number(rawAnnotation.index)
|
|
@@ -1404,7 +1404,7 @@ class ComPDFKitViewer {
|
|
|
this.pdfViewer.renderAnnotation(annotation[i], !!data.show)
|
|
|
}
|
|
|
annotation[i].targetPage = annotation[i].pageIndex * 1 + 1
|
|
|
- let currentAnnotation = annotation[i]
|
|
|
+ let currentAnnotation = JSON.parse(JSON.stringify(annotation[i]))
|
|
|
if (currentAnnotation.inklist) {
|
|
|
currentAnnotation = this.handleInk(currentAnnotation)
|
|
|
}
|
|
@@ -1413,9 +1413,9 @@ class ComPDFKitViewer {
|
|
|
} else {
|
|
|
const annotations = this.annotations[annotation.pageIndex]
|
|
|
if (!annotations) return
|
|
|
- const index = findIndex(annotation.name, annotations)
|
|
|
+ const index = findIndex(annotation.name, annotations)
|
|
|
if (this.webviewerServer) {
|
|
|
- annotation.index = index
|
|
|
+ annotation.index = index + 1
|
|
|
}
|
|
|
if (data.type === 'delete') {
|
|
|
annotations.splice(index, 1)
|
|
@@ -1531,6 +1531,26 @@ class ComPDFKitViewer {
|
|
|
delete annotation.pagePtr
|
|
|
}
|
|
|
delete annotation.content
|
|
|
+ break
|
|
|
+ case 'inkPointes':
|
|
|
+ const { height } = this.pagesPtr[annotation.pageIndex]
|
|
|
+ const inkPointes = annotation.inkPointes
|
|
|
+ let points = ''
|
|
|
+ for (let i = 0; i < inkPointes.length; i++) {
|
|
|
+ const inkPoint = inkPointes[i]
|
|
|
+ for (let j = 0; j + 1 < inkPoint.length; j+=2) {
|
|
|
+ if (j === 0) {
|
|
|
+ points+=inkPoint[j].PointX
|
|
|
+ }
|
|
|
+
|
|
|
+ points+=`,${height - inkPoint[j + 1].PointY}`
|
|
|
+ }
|
|
|
+
|
|
|
+ points+='//'
|
|
|
+ }
|
|
|
+ delete annotation.inkPointes
|
|
|
+ annotation.inklist = points
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1541,7 +1561,7 @@ class ComPDFKitViewer {
|
|
|
const { left, top: rawTop, right, bottom: rawBottom } = rect
|
|
|
const top = height - rawTop
|
|
|
const bottom = height - rawBottom
|
|
|
- return `${left},${top},${right},${bottom}`
|
|
|
+ return `${left},${bottom},${right},${top}`
|
|
|
}
|
|
|
|
|
|
#formatLinePointsForBackend(linePoints, pageIndex) {
|