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");