RavishaHesh / PDFJsAnnotations

Wrapper for PDF JS to add annotations
MIT License
333 stars 99 forks source link

loading image from sample_output breaks background #67

Open zakk616 opened 2 years ago

zakk616 commented 2 years ago

I added rectangle on pdf, picked the json and replaced it in var sampleOutput = { "page_setup": { "format": [ 612, 792 ], "orientation": "portrait" }, "pages": [ { "version": "4.3.0", "objects": [ { "type": "rect", "version": "4.3.0", "originX": "left", "originY": "top", "left": 422.5, "top": 228, "width": 100, "height": 100, "fill": "#212121", "stroke": null, "strokeWidth": 1, "strokeDashArray": null, "strokeLineCap": "butt", "strokeDashOffset": 0, "strokeLineJoin": "miter", "strokeMiterLimit": 4, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "backgroundColor": "", "fillRule": "nonzero", "paintFirst": "fill", "globalCompositeOperation": "source-over", "skewX": 0, "skewY": 0, "uuid": "e4dd4c35-2cdf-4d6f-b5a8-8741f3124854" } ] }, ] }

now when i load it it loads the rectange on page load.

but when i do the same with image. it breaks.

code for image object is: var sampleOutput = { "page_setup": { "format": [ 612, 792 ], "orientation": "portrait" }, "pages": [ { "version": "4.3.0", "objects": [ { "type": "image", "version": "4.3.0", "originX": "left", "originY": "top", "left": 190, "top": 276, "width": 200, "height": 175, "fill": "rgb(0,0,0)", "stroke": null, "strokeWidth": 0, "strokeDashArray": null, "strokeLineCap": "butt", "strokeDashOffset": 0, "strokeLineJoin": "miter", "strokeMiterLimit": 4, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "shadow": null, "visible": true, "backgroundColor": "", "fillRule": "nonzero", "paintFirst": "fill", "globalCompositeOperation": "source-over", "skewX": 0, "skewY": 0, "uuid": "a2c8e0ba-b9c8-4884-818d-a0ff640d67c9", "src": "data:image/png;base64,iVBORw................SuQmCC", "crossOrigin": null, "filters": [] } ] } ] };

try to resolve this issue.

adeelahmed233 commented 1 year ago

I am facing the same problem. Did you get any solution or workaroud?

zakk616 commented 1 year ago

I am facing the same problem. Did you get any solution or workaroud?

not solved yet, just not using image functionality.

zakk616 commented 1 year ago

Error Sample:

without image in sample_output.js image

with image in sample_output.js image