Poor image conversion

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

Hi Dylan,


Thank you for contacting support. We are not able to compile your sample code because it includes unknown class as TiffFrame. We suspect you are using Aspose.Imaging API too, please confirm. It will be so nice of you if you can prepare a sample console application project along with the source OneNote document. It will help us to be more specific. We’re looking forward to helping you.

I wasn’t expecting you to compile it as is, it was just demonstrating what I’d done. I use Aspose.Imagine.TiffFrame for other image conversions and don’t have any issues there.

And the page count issue is certainly nothing to do with that.
But if I have time today I might be able to throw together a zip file with everything needed to reproduce the issue.


Hi Dylan,


Sure, we’re waiting specially for your problematic OneNote document. We have tried with a default OneNote document, but the results vary. We need to check with your sample OneNote document. Thanks in advance.