I still do not know why, but it only happens in a particular case.
If the PDF loaded contains a png image with transparency when adding one image in the page it transforms the text of the page into image.
If the PDF contains a jpg image it works.
Just go with png with transparency.
The source code to introduce the image to the pdf that I use is:
Code:
Dim oDocument As PdfSharp.Pdf.PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open("c:\doc.pdf", PdfDocumentOpenMode.Modify)
Dim oPage As PdfSharp.Pdf.PdfPage = oDocument.Pages(1)
Dim gfx As PdfSharp.Drawing.XGraphics = PdfSharp.Drawing.XGraphics.FromPdfPage(oPage)
Dim oStream As New System.IO.MemoryStream
oImg.Save(oStream, ImageFormat.Png)
oStream.Position = 0
Dim oImage As PdfSharp.Drawing.XImage = PdfSharp.Drawing.XImage.FromStream(oStream)
gfx.DrawImage(oImage, oPosition.X, oPosition.Y, oImage.PixelWidth, oImage.PixelHeight)
oDocument.Save("c:\docMod.pdf")
oDocument.Close()
Any idea what may be going on?
thanks