Message:
The given key was not present in the dictionary.
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at .( )
at .()
at . ()
at .()
at . ()
at .(Stream , Document , LoadOptions )
at Aspose.Note.Document.(Stream , LoadOptions )
at Aspose.Note.Document…ctor(Stream inStream, LoadOptions loadOptions)
at Aspose.Note.Document…ctor(Stream inStream)
at LoadFile(Filespec filespec, LoadOptions options, FileAccess access, AppError& error)
Can you please check if this is a bug in the library itself?
After an initial test, I am able to reproduce the issue as you mentioned by loading your OneNote file via Aspose.Note for .NET. I found “KeyNotFoundException” when loading the OneNote file.
We require thorough evaluation of your issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): NOTENET-5818
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The issues you have found earlier (filed as NOTENET-5818) have been fixed in this update. This message was posted using Bugs notification tool by senua.remizova
System.Collections.Generic.KeyNotFoundException: The given key ‘00000000-0000-0000-0000-000000000000, 0’ was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at .()
at .()
at .()
at .(Stream )
at .(Stream )
at .(Stream , String )
at tream , String , Boolean )
at .(Stream , Document , LoadOptions )
at Aspose.Note.Document.(Stream , LoadOptions )
at Aspose.Note.Document…ctor(Stream inStream, LoadOptions loadOptions)
at Aspose.Note.Document…ctor(Stream inStream)
I’m getting this exception while converting onenote document to pdf on the below code, please resolve this issue:
public List TransformOneNoteFileToPdfStream(byte[] documentBytes)
{
var pdfContent = new MemoryStream();
var license = new License();
license.SetLicense(“Aspose.Note.NET.lic”);
var document = new Document(new MemoryStream(documentBytes));
var pdfDocuments = new List();
IList pages = document.GetChildNodes();
for (int i = 0; i < pages.Count(); i++)
{
PdfSaveOptions opts = new PdfSaveOptions();
opts.PageIndex = i;
opts.PageCount = 1;
document.Save(pdfContent, opts);
pdfDocuments.Add(new OneNoteConvertedFileDto
{
PageTitle = pages[i].Title?.TitleText.Text,
File = pdfContent,
PageIndex = i + 1
});
pdfContent = new MemoryStream();
}
return pdfDocuments.Count() > 0 ? pdfDocuments : null;
}
I have attached onenote file for your reference: response.zip (70.2 KB)
Which version of Aspose.Note for .NET you are using? Please try using Aspose.Note for .NET 24.9. I have tested using the following line of code with Aspose.Note for .NET 24.9 and it works fine.
e.g.,
var document = new Document("e:\\test2\\response.one");
Let us know with details if you still find the issue with Aspose.Note for .NET 24.9.