当我尝试在itextsharp中从方法(qr代码)添加图片结果生成时返回下一个错误:
无法将system.drawing.bitmap转换为system.itextsharp.text.image
iTextSharp.text.Image=iTextSharp.text.Image.GetInstance(picture2().GetHbitmap)
方法
Public Function picture2() As System.Drawing.Bitmap
Dim generarCodigoQR As QRCodeEncoder = New QRCodeEncoder
generarCodigoQR.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE
generarCodigoQR.QRCodeScale = Int32.Parse(4)
generarCodigoQR.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.H
generarCodigoQR.QRCodeVersion = 0
Try
If opForzarUTF.Checked Then
imgQR.Image = generarCodigoQR.Encode("http://www.ajpdsoft.com", _
System.Text.Encoding.UTF8)
Else
imgQR.Image = generarCodigoQR.Encode("http://www.ajpdsoft.com")
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly)
End Try
Return generarCodigoQR.Encode("http://www.ajpdsoft.com")
End Function