We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The opacity of image background in PDF file is not the same for subsequent pages

I have this program to add an image as a background to a PDF file. I set the opacity of the image to 0.5 and add it to the pdf file. But the result is always the same just the first page has the opacity that I set, but subsequent pages the opacity seems to go back to default which is 1 (no opacity at all).

var doc = new Document(@“test.pdf”);

var background = new BackgroundArtifact();
var imgBg = @“image.jpg”;

background.BackgroundImage = System.IO.File.OpenRead(imgBg);

background.Opacity = 0.5;

for (int i=1; i<=doc.Pages.Count; i++)
{
	Page page = doc.Pages[i];
	page.Artifacts.Add(background);
}

doc.Save("output.pdf");

@Gaucon

Can you please try to add the image stamp in the PDF document using Aspose.PDF? The ImageStamp Class also offers the option the set opacity. Please use the code in the linked article and let us know in case you still notice any issue.