So I tried to setImageData() with kepSVG as true. This made the resolution better but there is a limitation that when the flag is true then the image is not visible in other pdf tools.
instance.Core.annotationManager.addEventListener(“annotationChanged”, (annots, action) => {
for (const annot of annots) {
if (annot instanceof instance.Core.Annotations.StampAnnotation && action === ‘add’) {
annot.setImageData(annot.image.src, true);
instance.Core.annotationManager.redrawAnnotation(annot);
}
}
});
Is there any solution to improve the resolution of the svg image?
There are a couple options to maintain resolution of the SVG file:
We can convert it to an image format like PNG or rasterize the SVG to a higher resolution.
To investigate further, can you please provide the original SVG file?
There is currently no way to improve resolution on WebViewer as it depends on the image source. Setting the resolution high and then resizing the annotation to 100x100px does show improvement however. You can force a resize:
annotationManager.addEventListener("annotationChanged", (annots, action, { imported }) => {
if (!imported) {
for (const annot of annots) {
if (annot instanceof instance.Core.Annotations.StampAnnotation && action === 'add') {
annot.Width = 100;
annot.Height = 100;
instance.Core.annotationManager.redrawAnnotation(annot);
}
}
}
});