Hello!
I want to add an image from application resources to the document and render it to RTF. It perfectly works with PDF but does not work with RTF. The image does not shows. I used both PDFsharp-MigraDoc.1.50.4000-beta3b and PDFsharp-MigraDoc-GDI.1.50.4000-beta3b but the result is the same...
Here is my code (VB.NET):
Code:
// main code
...
Dim image_ As Byte() = LoadImage("Inventory.image_for_report.png")
Dim imageFilename As String = MigraDocFilenameFromByteArray(image_)
paragraph.AddImage(imageFilename)
...
Private Function LoadImage(ByVal filename As String)
Try
Dim assembly = System.Reflection.Assembly.GetExecutingAssembly()
Using stream_ As UnmanagedMemoryStream = assembly.GetManifestResourceStream(filename)
Dim count As Long = stream_.Length
Dim data_(count) As Byte
stream_.Read(data_, 0, count)
Return data_
End Using
Catch ex As Exception
Return vbNull
End Try
End Function
Private Function MigraDocFilenameFromByteArray(ByVal image As Byte())
Return "base64:" & Convert.ToBase64String(image)
End Function