We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cannot load image using paragraph.AppendPicture()

Cannot load image using paragraph.AppendPicture(). Please help, thanks!

var imageData = "";
var paragraph = new Syncfusion.DocIO.DLS.WParagraph(document);
var logoBinary = System.Convert.FromBase64String(imageData);
paragraph.AppendPicture(logoBinary);

Error Message:
MM.SalesTools.Infrastructure.DocBuilderTests.DocBuilderTests.DocBuilder_GenerateDocumentTest threw exception: System.NullReferenceException: Object reference not set to an instance of an object..

Error Stack Trace:
Syncfusion.DocIO.DLS.WPicture.LoadImage(Byte[] imageBytes)
Syncfusion.DocIO.DLS.WParagraph.AppendPicture(Byte[] imageBytes)
...

2 Replies

PN Phuoc Nguyen April 7, 2010 01:48 AM UTC

Using AppendPicture(Stream imageStream) raise the following exception. Please help!

Error Message:
Test method MM.SalesTools.Infrastructure.DocBuilderTests.DocBuilderTests.DocBuilder_GenerateDocumentTest threw exception: System.TypeInitializationException: The type initializer for 'System.Windows.DependencyObject' threw an exception. ---> System.UnauthorizedAccessException: InvalidCrossThreadAccess.

Error Stack Trace:
MS.Internal.XcpImports.CheckThread()
System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex, IntPtr constructDO)
System.Windows.DependencyObject..ctor()
System.Windows.DependencyObject.ManagedReferencesToken..ctor()
System.Windows.DependencyObject..cctor()
System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex)
System.Windows.Media.Imaging.BitmapImage..ctor()
Syncfusion.DocIO.DLS.Entities.Image.ParsePngImage()
Syncfusion.DocIO.DLS.Entities.Image.Initialize()
Syncfusion.DocIO.DLS.Entities.Image..ctor(Stream stream)
Syncfusion.DocIO.DLS.WPicture.LoadImage(Stream imageStream)
Syncfusion.DocIO.DLS.WParagraph.AppendPicture(Stream imageStream)
...


PR Poornima R Syncfusion Team April 9, 2010 04:40 AM UTC

Hi Phuoc,

Sorry for the long delay in getting back to you.

We have prepared the sample for your requirement.Could you please find the samlpe from the below. Try running the sample and let us know if this helps.If still the issue exist, Could you please provide us with the entire sample you are using to reproduce ths issue.So that we can analyse the issue and provide you with clear details.

Sample link:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F938262054369625.zip

Please let us know if you have any queries.

Regards,
Poornima

Loader.
Live Chat Icon For mobile
Up arrow icon