article

How to Convert OneNote File or Specified Page Range of OneNote Document into PDF using .NET

Email
Submitted on: 12/2/2015 10:22:55 AM
By: Sherazam  
Level: Intermediate
User Rating: Unrated
Compatibility: C#, VB.NET
Views: 2342
 
     This Technical tip explains how .NET developers can convert OneNote document or specified page range of OneNote document into PDF inside their .NET applications. PDF documents are widely used as a standard format of exchanging documents between organizations, government sectors and individuals. It's a popular format so developers are often asked to convert Microsoft OneNote documents to PDF documents. For this purpose, Aspose.Note for .NET supports converting OneNote to PDF documents without using any other component. This topic illustrates how this conversion can be done. Aspose.Note for .NET offers the Document class that represents a OneNote file. The Document class exposes the Save method that can be called to convert a OneNote document into a PDF document.

 
				This Technical tip explains how .NET developers can convert OneNote document or specified page range of OneNote document into PDF inside their .NET applications. PDF documents are widely used as a standard format of exchanging documents between organizations, government sectors and individuals. It's a popular format so developers are often asked to convert Microsoft OneNote documents to PDF documents. For this purpose, Aspose.Note for .NET supports converting OneNote to PDF documents without using any other component. This topic illustrates how this conversion can be done. Aspose.Note for .NET offers the Document class that represents a OneNote file. The Document class exposes the Save method that can be called to convert a OneNote document into a PDF document. The PdfSaveOptions class provides options for creating the PDF such as PageIndex, PageCount and others. This article shows how to Save all pages as PDF file with the default settings and save the range of pages as PDF. The following example shows how to convert a OneNote into a PDF document using the default options. The default options create a PDF document of maximum quality.
// [C# Code Sample]
// Load the document into Aspose.Note.
Document oneFile = new Document("FullFileName.one");
// Save the document as PDF
oneFile.Save("FullFileName.pdf", new PdfSaveOptions());
//[VB.NET Code Sample]
' Load the document into Aspose.Note.
Dim oneFile As New Document("FullFileName.one")
' Save the document as PDF
oneFile.Save("FullFileName.pdf", New PdfSaveOptions())
// [C# Code Sample]
// Load the document into Aspose.Note.
Document oneFile = new Document(@"FullFileName.one");
// Save the document as PDF
oneFile.Save(@"FullFileName.pdf", SaveFormat.Pdf);
 
//[VB.NET Code Sample]
' Load the document into Aspose.Note.
Dim oneFile As New Document("FullFileName.one")
' Save the document as PDF
oneFile.Save("FullFileName.pdf", SaveFormat.Pdf)
 
//Converting a Specified Page Range of OneNote to PDF
The following example shows how to convert a specific page in a OneNote file into an image using the ImageSaveOptions class. It sets the PageIndex properties.
//[C# Code Sample]
// Load the document into Aspose.Note.
Document oneFile = new Document(@"FullFileName.one");
// Initialize PdfSaveOptions object
PdfSaveOptions opts = new PdfSaveOptions();
// Set page index
opts.PageIndex = 2;
// Set page count
opts.PageCount = 3;
// Save the document as PDF
oneFile.Save(@"FullFileName.pdf", opts);
//[VB.NET Code Sample]
' Load the document into Aspose.Note.
Dim oneFile As New Document("FullFileName.one")
' Initialize PdfSaveOptions object
Dim opts As New PdfSaveOptions()
' Set page index
opts.PageIndex = 2
' Set page count
opts.PageCount = 3
' Save the document as PDF
oneFile.Save("FullFileName.pdf", opts)
Overview: Aspose.Note for .NET
Aspose.Note for .NET is a set of .NET components that enables developers to work with Microsoft Office OneNote files in C#, VB.NET, ASP.NET web applications, web services & Windows applications. It allows developers to open files & manipulate elements of OneNote books, from text, images & properties, to more complex elements, & then export to PNG, GIF, JPEG, BMP or PDF formats. It is a pure .NET alternative to the MS OneNote Object Model & supports OneNote 2010, OneNoteĀ® 2010 SP1 & 2013 files.


Other 44 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.