How to Convert OneNote Notebook to PDF using Java

This simple and brief topic focuses on how to convert OneNote Notebook to PDF using Java. We alternatively name the OneNote files as .ONE files and you can easily convert ONE to PDF in Java with simple API calls which are not dependent on any other application software or third party tool. This application has been implemented in Java environment and can be used in Windows, macOS and Linux platforms.

Steps to Convert OneNote Notebook to PDF using Java

  1. Add Aspose.Note JAR file from the Maven Repository in your conversion application
  2. Create an object of Document Class to load the input OneNote file for converting to PDF
  3. Save the source .one file to PDF using Save method and Pdf SaveFormat

The OneNote Notebook file may contain images or text with different formatting and fonts. In order to export OneNote Notebook to PDF using Java, the very first step will be to load the input OneNote file. Next we proceed to convert the .ONE file to PDF file in with the save method and SaveFormat enumerator. This two-step conversion process is completed using simple API calls in Java.

Code to Export OneNote Notebook to PDF using Java

import com.aspose.note.Document;
import com.aspose.note.License;
import com.aspose.note.SaveFormat;
public class OneNoteFileToPDFJava {
public static void main(String[] oneNoteArgument) throws IOException { // main method for converting OneNote file to PDF in Java
// Applying the Aspose.Note license before converting OneNote file to PDF in Java
License NoteLicense = new License();
NoteLicense.setLicense("Aspose.Note.lic");
// Create Document class object and load the input .one file for conversion to PDF
Document OneNoteDocument = new Document("InputOneNoteDocument.one");
// By using the save method and SaveFormat, save the .one file to PDF
OneNoteDocument.save("OneNoteConvertedToPDF.pdf",SaveFormat.Pdf);
}
}

In the previous topic, we have learnt how to convert Markdown to XPS file using Java. However, in this topic we have focused on OneNote to PDF conversion in Java with simple two-step procedure.

 English