|
@@ -2,10 +2,11 @@ importScripts("/lib/ComPDFkit.js")
|
|
|
|
|
|
import Color from '../color';
|
|
|
import { parseAdobePDFTimestamp, roundToDecimalPlaces } from '../ui_utils';
|
|
|
-import { AnnotationType } from '../../constants'
|
|
|
+import { AnnotationType, LineTypeString } from '../../constants'
|
|
|
|
|
|
let ComPDFKitJS = {}
|
|
|
let DataArray = []
|
|
|
+let LineType = {}
|
|
|
let BorderStyle = {}
|
|
|
let PageSize = {}
|
|
|
let Rect = {}
|
|
@@ -103,10 +104,10 @@ class CPDFWorker {
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotText', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -139,10 +140,10 @@ class CPDFWorker {
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotLink', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -174,17 +175,17 @@ class CPDFWorker {
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotFreeText', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
|
right: roundToDecimalPlaces(Rect.Right),
|
|
|
bottom: roundToDecimalPlaces(Rect.Bottom)
|
|
|
}
|
|
|
-
|
|
|
+ debugger
|
|
|
const rawContent = Module._GetAnnotContent(annotPtr)
|
|
|
const content = UTF8ToString(rawContent)
|
|
|
const rawCreateDate = Module._GetAnnotCreationDate(annotPtr)
|
|
@@ -209,10 +210,10 @@ class CPDFWorker {
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotLine', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
-
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
+
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -223,31 +224,45 @@ class CPDFWorker {
|
|
|
const rawContent = Module._GetAnnotContent(annotPtr)
|
|
|
const content = UTF8ToString(rawContent)
|
|
|
const rawCreateDate = Module._GetAnnotCreationDate(annotPtr)
|
|
|
- const createDate = parseAdobePDFTimestamp(UTF8ToString(rawCreateDate))
|
|
|
+ const date = UTF8ToString(rawCreateDate)
|
|
|
+ const createDate = date && parseAdobePDFTimestamp(date)
|
|
|
|
|
|
- FontDa = {}
|
|
|
- Module._GetAnnotFont(annotPtr)
|
|
|
+ const borderWidth = Module._GetAnnotBorderWidth(annotPtr)
|
|
|
|
|
|
RGBColor = {}
|
|
|
+ const borderColor = {}
|
|
|
Module._GetAnnotRGBColor(annotPtr)
|
|
|
for (key in RGBColor) {
|
|
|
- RGBColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
+ borderColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
}
|
|
|
|
|
|
+ const transparency = Module._GetAnnotTransparency(annotPtr)
|
|
|
+
|
|
|
+ LineType = {}
|
|
|
+ Module._GetLineType(annotPtr)
|
|
|
+
|
|
|
+ LinePoint = {}
|
|
|
+ Module._GetLinePoint(pagePtr, annotPtr)
|
|
|
+ const linePoints = [LinePoint.StartPointX, LinePoint.StartPointY, LinePoint.EndPointX, LinePoint.EndPointY]
|
|
|
+
|
|
|
return {
|
|
|
content,
|
|
|
createDate,
|
|
|
rect,
|
|
|
- color: RGBColor,
|
|
|
- font: FontDa.fontSize
|
|
|
+ borderColor,
|
|
|
+ borderWidth,
|
|
|
+ linePoints,
|
|
|
+ transparency,
|
|
|
+ tail: LineTypeString[LineType.Tail],
|
|
|
+ head: LineTypeString[LineType.Head]
|
|
|
}
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotSquare', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -259,37 +274,41 @@ class CPDFWorker {
|
|
|
const content = UTF8ToString(rawContent)
|
|
|
const rawCreateDate = Module._GetAnnotCreationDate(annotPtr)
|
|
|
const createDate = parseAdobePDFTimestamp(UTF8ToString(rawCreateDate))
|
|
|
- FontDa = {}
|
|
|
- Module._GetAnnotFont(annotPtr)
|
|
|
|
|
|
const borderWidth = Module._GetAnnotBorderWidth(annotPtr)
|
|
|
|
|
|
- BorderStyle = {}
|
|
|
- Module._GetAnnotBorderStyle(annotPtr)
|
|
|
+ RGBColor = {}
|
|
|
+ const fillColor = {}
|
|
|
+ Module._GetAnnotFilledRGBColor(annotPtr)
|
|
|
+ for (key in RGBColor) {
|
|
|
+ fillColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
+ }
|
|
|
|
|
|
RGBColor = {}
|
|
|
+ const borderColor = {}
|
|
|
Module._GetAnnotRGBColor(annotPtr)
|
|
|
for (key in RGBColor) {
|
|
|
- RGBColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
+ borderColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
}
|
|
|
|
|
|
- const color = RGBColor
|
|
|
+ const transparency = Module._GetAnnotTransparency(annotPtr)
|
|
|
+
|
|
|
return {
|
|
|
content,
|
|
|
createDate,
|
|
|
rect,
|
|
|
- color,
|
|
|
- font: FontDa.fontSize,
|
|
|
+ fillColor,
|
|
|
borderWidth,
|
|
|
- BorderStyle: BorderStyle
|
|
|
+ borderColor,
|
|
|
+ transparency
|
|
|
}
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotCircle', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -305,26 +324,40 @@ class CPDFWorker {
|
|
|
FontDa = {}
|
|
|
Module._GetAnnotFont(annotPtr)
|
|
|
|
|
|
+ const borderWidth = Module._GetAnnotBorderWidth(annotPtr)
|
|
|
+
|
|
|
RGBColor = {}
|
|
|
+ const fillColor = {}
|
|
|
+ Module._GetAnnotFilledRGBColor(annotPtr)
|
|
|
+ for (key in RGBColor) {
|
|
|
+ fillColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
+ }
|
|
|
+
|
|
|
+ RGBColor = {}
|
|
|
+ const borderColor = {}
|
|
|
Module._GetAnnotRGBColor(annotPtr)
|
|
|
for (key in RGBColor) {
|
|
|
- RGBColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
+ borderColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
}
|
|
|
|
|
|
+ const transparency = Module._GetAnnotTransparency(annotPtr)
|
|
|
+
|
|
|
return {
|
|
|
content,
|
|
|
createDate,
|
|
|
rect,
|
|
|
- color: RGBColor,
|
|
|
- font: FontDa.fontSize
|
|
|
+ fillColor,
|
|
|
+ borderWidth,
|
|
|
+ borderColor,
|
|
|
+ transparency
|
|
|
}
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotPolygon', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
-
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
+
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -356,10 +389,10 @@ class CPDFWorker {
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotPolyline', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -391,10 +424,10 @@ class CPDFWorker {
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotHighlight', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -407,9 +440,6 @@ class CPDFWorker {
|
|
|
const rawCreateDate = Module._GetAnnotCreationDate(annotPtr)
|
|
|
const createDate = parseAdobePDFTimestamp(UTF8ToString(rawCreateDate))
|
|
|
|
|
|
- FontDa = {}
|
|
|
- Module._GetAnnotFont(annotPtr)
|
|
|
-
|
|
|
RGBColor = {}
|
|
|
Module._GetAnnotRGBColor(annotPtr)
|
|
|
for (key in RGBColor) {
|
|
@@ -417,23 +447,22 @@ class CPDFWorker {
|
|
|
}
|
|
|
|
|
|
InkPointArray = []
|
|
|
- Module._GetQuadPoints(page, annotPtr)
|
|
|
+ Module._GetQuadPoints(pagePtr, annotPtr)
|
|
|
|
|
|
return {
|
|
|
content,
|
|
|
createDate,
|
|
|
rect,
|
|
|
color: RGBColor,
|
|
|
- font: FontDa.fontSize,
|
|
|
quadPoints: InkPointArray
|
|
|
}
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotUnderline', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -446,28 +475,29 @@ class CPDFWorker {
|
|
|
const rawCreateDate = Module._GetAnnotCreationDate(annotPtr)
|
|
|
const createDate = parseAdobePDFTimestamp(UTF8ToString(rawCreateDate))
|
|
|
|
|
|
- FontDa = {}
|
|
|
- Module._GetAnnotFont(annotPtr)
|
|
|
RGBColor = {}
|
|
|
Module._GetAnnotRGBColor(annotPtr)
|
|
|
for (key in RGBColor) {
|
|
|
RGBColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
}
|
|
|
|
|
|
+ InkPointArray = []
|
|
|
+ Module._GetQuadPoints(pagePtr, annotPtr)
|
|
|
+
|
|
|
return {
|
|
|
content,
|
|
|
createDate,
|
|
|
rect,
|
|
|
color: RGBColor,
|
|
|
- font: FontDa.fontSize
|
|
|
+ quadPoints: InkPointArray
|
|
|
}
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotSquiggly', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -480,29 +510,29 @@ class CPDFWorker {
|
|
|
const rawCreateDate = Module._GetAnnotCreationDate(annotPtr)
|
|
|
const createDate = parseAdobePDFTimestamp(UTF8ToString(rawCreateDate))
|
|
|
|
|
|
- FontDa = {}
|
|
|
- Module._GetAnnotFont(annotPtr)
|
|
|
-
|
|
|
RGBColor = {}
|
|
|
Module._GetAnnotRGBColor(annotPtr)
|
|
|
for (key in RGBColor) {
|
|
|
RGBColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
}
|
|
|
|
|
|
+ InkPointArray = []
|
|
|
+ Module._GetQuadPoints(pagePtr, annotPtr)
|
|
|
+
|
|
|
return {
|
|
|
content,
|
|
|
createDate,
|
|
|
rect,
|
|
|
color: RGBColor,
|
|
|
- font: FontDa.fontSize
|
|
|
+ quadPoints: InkPointArray
|
|
|
}
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotStrikeout', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -515,29 +545,29 @@ class CPDFWorker {
|
|
|
const rawCreateDate = Module._GetAnnotCreationDate(annotPtr)
|
|
|
const createDate = parseAdobePDFTimestamp(UTF8ToString(rawCreateDate))
|
|
|
|
|
|
- FontDa = {}
|
|
|
- Module._GetAnnotFont(annotPtr)
|
|
|
-
|
|
|
RGBColor = {}
|
|
|
Module._GetAnnotRGBColor(annotPtr)
|
|
|
for (key in RGBColor) {
|
|
|
RGBColor[key] = roundToDecimalPlaces(RGBColor[key] * 255)
|
|
|
}
|
|
|
|
|
|
+ InkPointArray = []
|
|
|
+ Module._GetQuadPoints(pagePtr, annotPtr)
|
|
|
+
|
|
|
return {
|
|
|
content,
|
|
|
createDate,
|
|
|
rect,
|
|
|
color: RGBColor,
|
|
|
- font: FontDa.fontSize
|
|
|
+ quadPoints: InkPointArray
|
|
|
}
|
|
|
})
|
|
|
|
|
|
messageHandler.on('GetAnnotStamp', (data) => {
|
|
|
- const { page, annotPtr } = data
|
|
|
-
|
|
|
+ const { pagePtr, annotPtr } = data
|
|
|
+
|
|
|
Rect = {}
|
|
|
- Module._GetAnnotRect(page, annotPtr)
|
|
|
+ Module._GetAnnotRect(pagePtr, annotPtr)
|
|
|
const rect = {
|
|
|
left: roundToDecimalPlaces(Rect.Left),
|
|
|
top: roundToDecimalPlaces(Rect.Top),
|
|
@@ -586,41 +616,29 @@ class CPDFWorker {
|
|
|
return { imageArray }
|
|
|
})
|
|
|
|
|
|
- messageHandler.on('SetAnnotRect', (data) => {
|
|
|
- const { ptr, annotPtr, rect } = data
|
|
|
- const { left, right, bottom, top } = rect
|
|
|
-
|
|
|
- const result = Module._SetAnnotRect(ptr, annotPtr, left, right, bottom, top)
|
|
|
- return result
|
|
|
- })
|
|
|
-
|
|
|
- messageHandler.on('SetAnnotContent', (data) => {
|
|
|
- const { annotPtr, content: rawContent } = data
|
|
|
-
|
|
|
- const content = stringToNewUTF8(rawContent)
|
|
|
- const result = Module._SetAnnotContent(annotPtr, content)
|
|
|
- return result
|
|
|
- })
|
|
|
-
|
|
|
- messageHandler.on('SetAnnotRGBColor', (data) => {
|
|
|
- const { annotPtr, color } = data
|
|
|
- const { R, G, B } = color
|
|
|
-
|
|
|
- const result = Module._SetAnnotRGBColor(annotPtr, R, G, B)
|
|
|
- return result
|
|
|
- })
|
|
|
-
|
|
|
- messageHandler.on('SetAnnotTransparency', (data) => {
|
|
|
- const { annotPtr, transparency } = data
|
|
|
-
|
|
|
- const result = Module._SetAnnotTransparency(annotPtr, transparency)
|
|
|
- return result
|
|
|
+ messageHandler.on('EditAnnotation', (data) => {
|
|
|
+ const { annotation } = data
|
|
|
+ debugger
|
|
|
+ if (annotation.rect) {
|
|
|
+ setAnnotRect(annotation)
|
|
|
+ }
|
|
|
+ if (annotation.color) {
|
|
|
+ setAnnotRGBColor(annotation)
|
|
|
+ }
|
|
|
+ if (annotation.transparency) {
|
|
|
+ setAnnotTransparency(annotation)
|
|
|
+ }
|
|
|
+ if (annotation.content) {
|
|
|
+ setAnnotContent(annotation)
|
|
|
+ }
|
|
|
+ if (annotation.linePoints) {
|
|
|
+ setLinePoint(annotation)
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
messageHandler.on('CreateAnnotation', (data) => {
|
|
|
- console.log('CreateAnnotation')
|
|
|
const { doc, pagePtr, annotation } = data
|
|
|
- createAnnotation(doc, pagePtr, annotation)
|
|
|
+ return createAnnotation(doc, pagePtr, annotation)
|
|
|
})
|
|
|
|
|
|
messageHandler.on('SaveDocumentByStream', (data) => {
|
|
@@ -671,21 +689,64 @@ function RenderPageBitmapWithMatrix(data) {
|
|
|
|
|
|
function createAnnotation(doc, pagePtr, annotation) {
|
|
|
const typeInt = AnnotationType[annotation.type.toUpperCase()]
|
|
|
- console.log('CreateAnnotation')
|
|
|
+
|
|
|
+ const annotPtr = Module._CreateAnnot(doc, pagePtr, typeInt)
|
|
|
+
|
|
|
+ const { left, right, top, bottom } = annotation.rect
|
|
|
+ const createRectResult = Module._SetAnnotRect(pagePtr, annotPtr, left, right, bottom, top)
|
|
|
+ console.log(createRectResult)
|
|
|
+ const { borderColor, lineWidth } = annotation
|
|
|
+
|
|
|
switch (typeInt) {
|
|
|
case AnnotationType.HIGHLIGHT:
|
|
|
- const annotPtr = Module._CreateAnnot(doc, pagePtr, typeInt)
|
|
|
- const { left, right, top, bottom } = annotation.rect
|
|
|
- const createRectReslut = Module._SetAnnotRect(pagePtr, annotPtr, left, right, bottom, top)
|
|
|
- console.log(createRectReslut)
|
|
|
-
|
|
|
- const createColorReslut = Module._SetAnnotRGBColor(annotPtr, 1, 0, 0)
|
|
|
+ const createColorResult = Module._SetAnnotRGBColor(annotPtr, 1, 0, 0)
|
|
|
+ console.log(createColorResult)
|
|
|
|
|
|
const createContentReslut = Module._SetAnnotContent(annotPtr, stringToNewUTF8(annotation.content))
|
|
|
console.log(createContentReslut)
|
|
|
- const createQuadReslut = Module._SetQuadPoints(pagePtr, annotPtr, annotation.quadPoints, annotation.quadPoints.length)
|
|
|
- console.log(createQuadReslut)
|
|
|
+ const { quadPointsX, quadPointsY } = annotation
|
|
|
+ const length = quadPointsX.length
|
|
|
+ let pointXBytes = length * 4
|
|
|
+ let pointXPtr = _malloc(pointXBytes)
|
|
|
+ for (var i = 0; i < length; i++) {
|
|
|
+ Module.HEAP32[pointXPtr / 4 + i] = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ let pointYBytes = length * 4
|
|
|
+ let pointYPtr = _malloc(pointYBytes)
|
|
|
+ for (var i = 0; i < length; i++) {
|
|
|
+ Module.HEAP32[pointYPtr / 4 + i] = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ const createQuadResult = Module._SetQuadPoints(pagePtr, annotPtr, pointXPtr, pointYPtr, length)
|
|
|
+ console.log(createQuadResult)
|
|
|
break
|
|
|
+ case AnnotationType.TEXT:
|
|
|
+ case AnnotationType.LINK:
|
|
|
+ case AnnotationType.FREETEXT:
|
|
|
+ case AnnotationType.LINE:
|
|
|
+ const { tail, linePoints } = annotation
|
|
|
+ if (tail) {
|
|
|
+ Module._SetLineType(annotPtr, 0, 1)
|
|
|
+ }
|
|
|
+ const result = Module._SetLinePoint(pagePtr, annotPtr, linePoints[0], linePoints[1], linePoints[2], linePoints[3])
|
|
|
+ Module._SetAnnotRGBColor(annotPtr, borderColor.R / 255, borderColor.G / 255, borderColor.B / 255)
|
|
|
+ Module._SetAnnotBorderWidth(annotPtr, lineWidth)
|
|
|
+ return annotPtr
|
|
|
+ case AnnotationType.SQUARE:
|
|
|
+ Module._SetAnnotRGBColor(annotPtr, borderColor.R / 255, borderColor.G / 255, borderColor.B / 255)
|
|
|
+ Module._SetAnnotBorderWidth(annotPtr, lineWidth)
|
|
|
+ return annotPtr
|
|
|
+ case AnnotationType.CIRCLE:
|
|
|
+ Module._SetAnnotRGBColor(annotPtr, borderColor.R / 255, borderColor.G / 255, borderColor.B / 255)
|
|
|
+ Module._SetAnnotBorderWidth(annotPtr, lineWidth)
|
|
|
+ return annotPtr
|
|
|
+ case AnnotationType.HIGHLIGHT:
|
|
|
+ case AnnotationType.UNDERLINE:
|
|
|
+ case AnnotationType.SQUIGGLY:
|
|
|
+ case AnnotationType.STRIKEOUT:
|
|
|
+ case AnnotationType.STAMP:
|
|
|
+ case AnnotationType.INK:
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -701,3 +762,41 @@ function saveDocumentByStream(doc) {
|
|
|
DataArray=[]
|
|
|
return pdfData
|
|
|
}
|
|
|
+
|
|
|
+function setAnnotRect(data) {
|
|
|
+ const { pagePtr, annotPtr, rect } = data
|
|
|
+ const { left, right, bottom, top } = rect
|
|
|
+
|
|
|
+ const result = Module._SetAnnotRect(pagePtr, annotPtr, left, right, bottom, top)
|
|
|
+ return result
|
|
|
+}
|
|
|
+
|
|
|
+function setAnnotContent(data) {
|
|
|
+ const { annotPtr, content: rawContent } = data
|
|
|
+
|
|
|
+ const content = stringToNewUTF8(rawContent)
|
|
|
+ const result = Module._SetAnnotContent(annotPtr, content)
|
|
|
+ return result
|
|
|
+}
|
|
|
+
|
|
|
+function setAnnotRGBColor(data) {
|
|
|
+ const { annotPtr, color } = data
|
|
|
+ const { R, G, B } = color
|
|
|
+
|
|
|
+ const result = Module._SetAnnotRGBColor(annotPtr, R, G, B)
|
|
|
+ return result
|
|
|
+}
|
|
|
+
|
|
|
+function setAnnotTransparency(data) {
|
|
|
+ const { annotPtr, transparency } = data
|
|
|
+
|
|
|
+ const result = Module._SetAnnotTransparency(annotPtr, transparency)
|
|
|
+ return result
|
|
|
+}
|
|
|
+
|
|
|
+function setLinePoint(data) {
|
|
|
+ const { pagePtr, annotPtr, linePoints } = data
|
|
|
+
|
|
|
+ const result = Module._SetLinePoint(pagePtr, annotPtr, linePoints[0], linePoints[1], linePoints[2], linePoints[3])
|
|
|
+ return result
|
|
|
+}
|