Hi all!!!
I'm having problems when trying to add an image to an existing PDF file. It appears the next error:
"
Object type transformation must not be done with direct objects"
Here is my piece of code:
Code:
Dim documento As PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open("path\file_name.pdf")
If documento.Version <= 14 Then
documento.Version = 14
End If
Dim pagina As PdfPage = documento.Pages(0)
Dim gfx As XGraphics = XGraphics.FromPdfPage(pagina)
Dim imagen As XImage = XImage.FromFile(System.AppDomain.CurrentDomain.BaseDirectory & "qr.jpg")
gfx.DrawImage(imagen, 470, 720)
documento.Save("new_path\new_file_name.pdf")
I have launched a Release version of the program but that error message still appears ... what am I doing wrong???
Thanks on advance!!!!