Hi, I’m trying to convert OneNote (.one) documents to multi-page images using the following code:
Aspose.Note.Document doc = new Aspose.Note.Document(originalFile);
noOfDocPages = doc.GetChildNodes(Aspose.Note.NodeType.Page).Count();
List frames = new List();
Aspose.Note.Saving.ImageSaveOptions options = new Aspose.Note.Saving.ImageSaveOptions(Aspose.Note.SaveFormat.Png);
endpage = Math.Min(noOfDocPages - 1, endpage);
for (int i = startpage; i < endpage; i++)
{
MemoryStream imgStream = new MemoryStream();
options.PageIndex = i - 1;
doc.Save(imgStream, options);
imgStream.Position = 0;
frames.Add(new TiffFrame(imgStream));
}
new TiffImage(frames.ToArray()).Save(convertedFile);
However:
a) noOfDocPages is wrong with the file I tried (the default ‘general.one’ that OneNote creates automatically). It only has 2 pages, but GetChildNodes(…).Count() returns 4. Using PageIndex of 2 or 3 causes a ‘parameter incorrect’ exception when using doc.Save(…).
b) The image output is very grainy and only in black and white. I’ve tried other image formats but to no avail, and there appears to be no way to specify the desired DPI.
Am I doing something wrong?
Dylan