Black background when inserting an image in PDF ITEXTSHARP

737 Views Asked by At

I am getting a black background when I insert a image into PDF using ITextSharp version 5.5.8.0 as shown in the image:

enter image description here

I tried setting a white background but still no impact.
Below is the VB.NET code where I am inserting the image.My goal is to have a white background instead of the black.

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)
0

There are 0 best solutions below