Adding a transparent image to a pdf page with PDFsharp

sahin kaya 20 Reputation points
2023-10-16T09:01:08.8033333+00:00

Hello, I am adding an image to the pdf page using the following codes using PDFsharp, but how can I make this image transparent?

document = PdfReader.Open("D:/test/aaa.pdf");             PdfPage lpage = document.Pages[0];              FileStream imageStream = new FileStream("D:/3.jpg", FileMode.Open, FileAccess.Read);             XImage image =  XImage.FromFile("D:/test/3.jpg");                        XGraphics gfx = XGraphics.FromPdfPage(lpage);                         gfx.DrawImage(image, 50, 50, 200, 200);              document.Save("d:/image.pdf");     
document.Close();
Developer technologies | C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.