简体   繁体   English

使用iTextSharp为PDF中的图像添加透明度/不透明度

[英]Adding transparency / opacity for images in PDF using iTextSharp

I need to set the opacity for an image and add it to the PDF using iTextSharp. 我需要设置图像的不透明度,然后使用iTextSharp将其添加到PDF。 I have looked at the http://itextpdf.com/examples/ but could not find any working examples of doing this. 我已经看过http://itextpdf.com/examples/,但是找不到执行此操作的任何示例。

Can anyone help me or direct me to the right resource. 任何人都可以帮助我或将我定向到正确的资源。

//create new graphics state and assign opacity    
PdfGState graphicsState = new PdfGState();
graphicsState.FillOpacity = 0.2F;  // (or whatever)
//set graphics state to pdfcontentbyte    
pdfData.SetGState(graphicsState);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM