Which product are you using?
PDF.js Express Plus 8.7.4
Detailed description of issue
Hi there!
Let’s try this repo as our base, with upgrading library version to 8.7.4
.
Let’s make some changes in code:
- ‘/files/PDFTRON_about.pdf’ - set correct file name in line 13
- Add several stamps like below:
// add stamps
for (let [x, y] of [[200, 500], [200, 550], [200, 600]]) {
const stamp = new Annotations.StampAnnotation();
stamp.PageNumber = 1;
stamp.X = x;
stamp.Y = y;
stamp.Height = 20;
stamp.Width = 20;
stamp.setImageData('/goku.png');
stamp.Opacity = 0.5;
stamp.ReadOnly = true;
annotManager.addAnnotation(stamp);
// need to draw the annotation otherwise it won't show up until the page is refreshed
annotManager.redrawAnnotation(stamp);
}
In my real application I use svg file as a stamp, but it’s impossible to load that type of image here, that’s why I loaded here a sample as png (works the same for me, or rather doesn’t work):
Where is the problem? I set opacity as 0.5 and it applies on pdf very randomly (even with full opacity for all stamps) on Chrome (120.0.6099.129 - the same problem with previous version):
Firefox looks much better for this sample - almost every page refreshing set correct opacity for all three stamps. Sometimes, after a change in code and refreshing page, one of the stamps is full, but it’s rather rare situation.
Any idea what I’m doing wrong?
Best regards and Merry Christmas ,
Dorota