Monday, December 6, 2010

OneNote Publish to PDF

Microsoft.Office.Interop.OneNote Publish. To publish the entire notebook, use the code below, where Personal is the name and folder of my notebook. The Publish action will find all the .one files and combine them into one pdf file. Whammooo!!

var onenoteApp = new Microsoft.Office.Interop.OneNote.Application();

string bstrHierarchyID = string.Empty;
onenoteApp.OpenHierarchy(@"C:\Users\brad.test\Documents\OneNote Notebooks\Personal\",
System.String.Empty, out bstrHierarchyID, Microsoft.Office.Interop.OneNote.CreateFileType.cftNone);

string bstrTargetFilePath = "C:\\Temp\\Personal1.pdf";

onenoteApp.Publish(bstrHierarchyID, bstrTargetFilePath, OneNote.PublishFormat.pfPDF);

2 comments:

Anonymous said...

Hi, i just want to say hello to the community

PDF signature said...

This is the perfect blog for anyone who wants to know about this topic. You know You definitely put a new spin on a subject that's been written about for years. Great stuff, just great!