Thanks for your sharing.
For the file you provided, I directly opened it with MS Word, and then saved the picture in the first page as a png file, but I found that its background is not transparent.
Meanwhile, I used the following code to insert an image with a transparent background into your file, and then convert it to a pdf file, but found that the background of image in the generated pdf file is still transparent. Attached are my test image and the output file.
- Code: Select all
Dim input As String = "HCR20V3I.1097071.14_V11.docx"
Dim doc As New Document()
doc.LoadFromFile(input)
Dim selections() As TextSelection = doc.FindAllString("Risk", True, True)
Dim selection = selections(0)
Dim range As TextRange = selection.GetAsOneRange()
Dim index As Integer = range.OwnerParagraph.ChildObjects.IndexOf(range)
Dim pic As New DocPicture(doc)
pic.LoadImage(System.Drawing.Image.FromFile("Logo1.png"))
range.OwnerParagraph.ChildObjects.Insert(index, pic)
range.OwnerParagraph.ChildObjects.Remove(range)
doc.SaveToFile("result.pdf", FileFormat.PDF)
To help us investigate further, please provide your test image, your output pdf file and your OS information (Win7, 64bit). Thanks in advance.
Sincerely,
Brian
E-iceblue support team
Login to view the files attached to this post.