当我使用ITextSharp版本5.5.8.0将图像插入PDF时,我得到一个黑色背景,如图所示:
我尝试设置白色背景,但仍然没有影响 下面是我插入图像的VB.NET代码。我的目标是使用白色背景而不是黑色。
Dim cb As PdfContentByte = stamper.GetUnderContent(1)
Dim structureeditor As New StructureEditor
Dim temp As System.Drawing.Image = structureeditor.StructureToImage(Me.queryMoleculeTxt.Text)
Dim compoundstructure As Image = Image.GetInstance(temp, System.Drawing.Imaging.ImageFormat.Jpeg)
' White background is set
compoundstructure.BackgroundColor = BaseColor.WHITE
compoundstructure.SetAbsolutePosition(30, 150)
cb.AddImage(compoundstructure)