Working with Images

Extract Images from a OneNote Document

Extract Images

To extract all images or from a OneNote document, follow these steps:

  1. Use the Document.getChildNodes method to select all Image nodes.
  2. Iterate through the resulting Image node collections.
  3. Extract image bytes array using the Image.Bytes property.
  4. Save image bytes to a file.

This example shows how to extract images from a OneNote document and save them as files.

Get Information of Each Image from the OneNote Document

The Image class provides all the image properties for images in OneNote documents. All the images of the OneNote file are contained by image nodes in the Document object.

Get Information

Adding Image to a OneNote Document Page and Saving as PDF

Aspose.Diagram for JAVA APIs now allows inserting an image anywhere on the OneNote document.

These examples show how to:

Insert an Image in an Existing OneNote Document

To insert an image on a OneNote document, follow these steps:

  1. Use the Document.getFirstChild() property to get the first page.
  2. Use the Image class constructor to load the image.
  3. Use the Image.getWidth() and Image.getHeight() properties to adjust size of the image.
  4. Use the Image.getVerticalOffset() and Image.getHorizontalOffset() properties to set location of the image.
  5. Use the Page.appendChild() property to insert the image.
  6. Save a OneNote document.

This example shows how to insert an image on a OneNote document and save them as files.

Build a OneNote Document from the Scratch and Insert an Image

This example shows how to build a new OneNote document and insert an image by file path.

Build a OneNote Document from the Scratch and Insert an Image using an Image Stream

This example shows how to build a new OneNote document and insert an image using the image stream.

Support for Image Alternative Text