Convert OneNote to image

Save OneNote to image in Bmp format using the default options

The following code example demonstrates how to convert OneNote to image in Bmp format using the default options. By default only the first page is saved. The saved image has resolution of 96 dpi.

 1            // The path to the documents directory.
 2            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
 3
 4            // Load the document into Aspose.Note.
 5            Document oneFile = new Document(dataDir + "Aspose.one");
 6
 7            dataDir = dataDir + "SaveToBmpImageUsingImageSaveOptions_out.bmp";
 8
 9            // Save the document as gif.
10            oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Bmp));

Save OneNote to image in Gif format using the default options

The following code example demonstrates how to convert OneNote to image in Gif format using the default options. By default only the first page is saved. The saved image has resolution of 96 dpi.

 1// The path to the documents directory.
 2string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
 3
 4// Load the document into Aspose.Note.
 5Document oneFile = new Document(dataDir + "Aspose.one");
 6
 7dataDir = dataDir + "SaveToImageDefaultOptions_out.gif";
 8
 9// Save the document as gif.
10oneFile.Save(dataDir, SaveFormat.Gif);

Save a specific page of OneNote to image

The following code example demonstrates how to convert a specific page of OneNote to image in Png format. The page is specified by setting PageIndex property of ImageSaveOptions instance. The saved image has resolution of 96 dpi.

 1// The path to the documents directory.
 2string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
 3
 4// Load the document into Aspose.Note.
 5Document oneFile = new Document(dataDir + "Aspose.one");
 6
 7// Initialize ImageSaveOptions object 
 8ImageSaveOptions opts = new ImageSaveOptions(SaveFormat.Png);
 9            
10// Set page index
11opts.PageIndex = 1;
12
13dataDir = dataDir + "ConvertSpecificPageToImage_out.png";
14
15// Save the document as PNG.
16oneFile.Save(dataDir, opts);

Specify resolution for output image

The following code example demonstrates how to specify resolution of output image. The resolution is specified by setting Resolution property of ImageSaveOptions instance.

 1// The path to the documents directory.
 2string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
 3
 4// Load the document into Aspose.Note.
 5Document doc = new Document(dataDir + "Aspose.one");
 6
 7dataDir = dataDir + "SetOutputImageResolution_out.jpg";
 8
 9// Save the document.
10doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Resolution = 220 });

Specify quality for output image

The following code example demonstrates how to convert OneNote to image in Jpeg format with specified compression quality. The compression quality is specified by setting Quality property of ImageSaveOptions instance. This setting is used when image saved in lossy format. The image quality can be set from 0 to 100. Zero indicates the lowest quality and 100 gives the highest quality for the image. The default quality value is 90.

 1// The path to the documents directory.
 2string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
 3
 4// Load the document into Aspose.Note.
 5Document doc = new Document(dataDir + "Aspose.one");
 6
 7dataDir = dataDir + "SetOutputImageResolution_out.jpg";
 8
 9// Save the document.
10doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Quality = 100 });
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.