How to batch import PDFs into OneNote as printouts

October 09, 2013

Here is a way to batch import lots of PDF files into OneNote as printouts. The idea is to ask Windows to print the pdf files one by one to Send to OneNote printer and setup OneNote so that it will import printouts into a certain section without asking. We can do this with scripting:

  1. Print one of the PDFs into OneNote and when you get the dialog that asks you where to send, choose a section as your target location and choose the option that says "always send to this location"Select location
  2. Set "Send To OneNote" as your default printerSet default printer
  3. Put all the pdfs in a folder
  4. Create a script file like below and save as printPdfs.js in the same folder
  5. Create a batch file like below and save as printPdfs.bat in the same folder
  6. Open command line (Start > Run > cmd)
  7. Go to the folder (cd c:\path\to\the\folder)
  8. Execute the batch file (printPdfs.bat)

printPdfs.js:

new ActiveXObject("Shell.Application").ShellExecute(WScript.Arguments.Item(0),"","","print","1");

printPdfs.bat

@for /f "delims=" %%a IN ('dir /b *.pdf') do call cscript //nologo printPdfs.js "%%a"

This will print each PDF file into OneNote to the section you picked. Note that if you have too many files, this can take quite some time. You can try it first with a few files. Also if you forget to set the "Send to OneNote" printer as default, this will send the PDFs to your default printer!

Comments

Name
Comment
MrLindeman - 2017-12-24
Found the problem.

I had changed from using PDFx-Change to Draw for handling PDFs. Which meant the print print command was unavailable from the command prompt.

The script therefor did not recognize draw as a valid .pdf file association.

After installing PDFx-change and setting it as the default file handler, the script is running smoothly again.
Mike - 2017-12-20
This just stopped working for me :(
It's been working perfectly, but since I reset my machine it just gives me the following error:
"This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Program control panel."

Any clues to which program should be set, and for what?
Tom - 2017-07-12
Ran across this and tried it in One Note 2016 (Windows 10) and unfortunately it doesn't seem to work. I was able to set my default print to Send to One note after setting the options as described and that is working for me for Onenote 2016 and Windows 10. Thank you for the tip!

Other Posts

Show all posts