RavishaHesh / PDFJsAnnotations

Wrapper for PDF JS to add annotations
MIT License
322 stars 98 forks source link

Can't Save PDF #69

Open hudeaki opened 1 year ago

hudeaki commented 1 year ago

I use code fo insert image from url but can't save to pdf

PDFAnnotate.prototype.addImageToServer = function () { var inst = this; var canvas = inst.fabricObjects[inst.active_canvas]

fabric.util.loadImage('https://d1hdtc0tbqeghx.cloudfront.net/sites/536207e0e52e306190000002/theme/images/sd-laravel-icon.png', function(img) { if(img == null) { alert("Error!"); }else { var image = new fabric.Image(img); canvas.add(image).setActiveObject(image); canvas.renderAll(); } }, { crossOrigin: 'anonymous' });

}

hudeaki commented 1 year ago

Or this code insert image finish but can't save pdf

PDFAnnotate.prototype.addImageToServer = function () { var inst = this; var canvas = inst.fabricObjects[inst.active_canvas]

fabric.Image.fromURL('https://d1hdtc0tbqeghx.cloudfront.net/sites/536207e0e52e306190000002/theme/images/sd-laravel-icon.png', function(oImg) {

// scale image down, and flip it, before adding it onto canvas oImg.scale(0.5).set('flipX', true); canvas.add(oImg); }); }