What I did:
Sometimes the error happens and sometimes not, but if I generate 5 PDF's in a row it will throw an exception(but not always...),once.
First I took a word file(e.g. my attachment, actually every word file I try to convert to pdf) worked with,saved it to ether a physically file or a MemoryStream.
Then I use the generated result(byte[]) from my Word file to generate my PDF-file.
This is the code, where the error comes in:
using (MemoryStream ms = new MemoryStream(_tempDatei))
{
WordDocument wordDocument = new WordDocument(ms);
DocToPDFConverter converter = new DocToPDFConverter();
pdfDocumentument pdfDocument = converter.ConvertToPDF(wordDocument);
//pdfDocument.Save(tempWordPdfFile); //Error occurs here
pdfDocument.Save(_temporaryMemoryStream); //and here
_tempDatei = _temporaryMemoryStream.ToArray();
wordDocument.Close();
converter.Dispose();
pdfDocument.Close();
}
The error:
"System.NullReferenceException"
occurs here, when I go into the save method:
pdfDocument.Save(tempWordPdfFile); //Error occurs here
and/or here (depending what I commented in)
pdfDocument.Save(_temporaryMemoryStream); //and here
Stacktrace and watch:
http://s32.postimg.org/5f8a0c0zn/syncfusion_stacktrace.png
I cant not provide you the code, because it is a big project.
How can I solve that problem ?
Attachment:
SIS_b3e6a6f5.7z