[Advanced Tips] Add your own Notes

Many users request some way to add their own notes to PDF or other supported file formats like this .xps example

This is easily achieved (with some limitations) in current version

There will be a few cases where this will not work due to file structures.

There can be problems when switching book modes since the page number will usually be the one of the left pair.

My example will create one new file per “Page” you can reduce that to one .NOTE.txt file per PDF easily but will need to then search that file for the corresponding page note.

You can add automatic time logging as shown but need to be aware how it works (Notepad will add a time and date opened to the end of the file if the first line is .LOG i.e. that is a dot followed by uppercase log)

So how is this done?

SumatraPDF can call notepad with the current filename and page number so in Settings > Advanced Options you will see

ExternalViewers [

if you change that to the following entry

 ExternalViewers [
		CommandLine = C:\windows\system32\Notepad.exe "%1.Page%p.txt"
		Name = Notepad the Notes for &This page
		Filter = *.*

Then use ALTFT (note F N is for reName and F P is Print)
or use the file menu entry half-way down


it will tell notepad to open a filename.PAGE#.txt

On the first run it will ask if you want to create the file

Simply hit enter or Y or click the button
(No will keep notepad open not really useful) and
if you changed your mind simply click Cancel

IF you want to log the times the file is opened then on the first line write .LOG (don’t forget the dot)

When you finish adding notes don’t forged to “Save” the file

On subsequent runs you won’t get the yes no options but must always remember to save the notes file.

If you don’t want to litter the file folder with pages of notes but only one notes file per original then change the command to this

 ExternalViewers [
		CommandLine = C:\windows\system32\Notepad.exe "%1.Notes.txt"
		Name = Notepad the Notes for &This file
		Filter = *.*

If you have a notes editor that accepts a command line search and place page markers such as [3] then you could have one file and a command like editor.exe "%1.Notes.txt" find"[%p]"

NotePad is very basic and notes cut and pasted will at best be plain text
The next best onboard option is to use Write.exe (WordPad) this application has many advantages and one or two major disadvantage.
The first hurdle is that WordPad will NOT offer to open a given notes file if it does not exist, it will usually close itself. So If you remember to always put a starter.docx or .odt alongside the PDF this will not be a problem.
The main advantages with using WordPad are

  1. You can copy and paste images as well as text.
  2. WordPad can keep one file open to be added to over and over (no need for a file per page or closing NotePad for each call).
  3. Some users can utilize the built-in spell checking.
  4. You can print your notes to PDF

You can use a script to open WordPad with a search for [Page-Tag] along with adding a timestamp. The following WordPad example can be used as a template.

    ' Build script to open Gwennel (Featured) NotePad (Quick) or WordPad (Compatability)
    ' Expects "Path\FileName.EXT" followed by Page Number or optional .FileType (needs dot)
    ' Usage:-
    ' "C:Windows\System32\wscript.exe" "Path\ThisFile.vbs" "Path\FileName.for notes.EXT" ##
    ' where .for notes. may be a PDF, JPG or any other viewer file needing external notes,
    ' .EXT is editor format such as .docx/.odt/.rtf/.txt and ## is page number for tagging
    ' at your own risk the alternative call option to switch formats described below can be
    ' "C:Windows\System32\wscript.exe" "Path\ThisFile.vbs" "Path\FileName.for notes" ## .EXT
    ' Beware if it misfires the editor may attempt to open the ".for notes" source document
    FullName = WScript.Arguments.Item(0)
    PageNum = WScript.Arguments.Item(1)
    '* Remove ' on next line allows filetype e.g. write can switch to .doc/.odt/.rtf/.txt
    'FileType = WScript.Arguments.Item(2)
    Set WshShell = WScript.CreateObject("WScript.Shell")
    '* If you use Gwennel you will need to prefix with its path\Gwennel.exe
    '* for NotePad use "%windir%\NotePad.exe " for WordPad use "%windir%\write.exe "
    'WshShell.Run "Gwennel.exe "+""""+FullName+FileType+"""", 9
    'WshShell.Run "%windir%\NotePad.exe "+""""+FullName+FileType+"""", 9
    WshShell.Run "%windir%\write.exe "+""""+FullName+FileType+"""", 9
    ' The folowing line is an error fall back to build the file for notes if it does not already exist
    WshShell.Run "%windir%\System32\cmd.exe /c if not exist "+""""+FullName+FileType+""""+" echo .LOG >"+""""+FullName+FileType+"""", 9
    ' Give Editor time to load so lets first use part of that time
    ' to calculate date then add say another 1000 milliseconds for slow starters
    dtmNow = Now()
       dtmDay = Day(dtmNow)
       dtmMonth = Month(dtmNow)
       dtmYear = Year(dtmNow)
    isoDate = dtmYear & "-" & Right(0 & dtmMonth,2) & "-" & Right(0 & dtmDay,2)

    ' ensure this value is not too low otherwise the following commands will fail
    ' with larger notes files this delay may need to be increased
    WScript.Sleep 1000
    '* WordPad/Write is much slower to start if not already open so add another second
    WScript.Sleep 1000

    ' start find
    ' Lets default from just below known HOME position just incase
    ' .LOG or a WordPad window is reused (i.e. unique instance)
    WshShell.SendKeys "^{HOME}{DOWN}{ENTER}"
    WScript.Sleep 100

    '* for Gwennel % E F keys MUST be separated
    'WshShell.SendKeys "%"
    'WshShell.SendKeys "E"
    'WshShell.SendKeys "F"

    '* for NotePad send keys together and ensure
    ' we are searching Down with cleared buffer
    'WshShell.SendKeys "%EF"
    'WshShell.SendKeys "%D%n{DEL}"

    '* for WordPad %H keys separated will not work
    WshShell.SendKeys "%H"
    WshShell.SendKeys "FD"

    ' Give Dialog Box time to load
    WScript.Sleep 2000

    ' For WordPad we NEED extra +"{ENTER}" but NOT for Gwennel
    ' remove second +"{ENTER}" on next line for Gwennel
    WshShell.SendKeys "Page-"+PageNum+"{ENTER}"+"{ENTER}"

    ' Close Dialog Box(s)
    WshShell.SendKeys "{ESCAPE}{ESCAPE}"

    'If tag found move to above either way insert new tag on current line
    WshShell.SendKeys "{HOME}"
    WshShell.SendKeys "*[Page-"+PageNum+"] " & isoDate & " " & Time
    WshShell.SendKeys "{ENTER}{ENTER}{UP}"

So here my Advanced settings comandline is

  CommandLine = "c:\windows\System32\wscript.exe" "C:\Apps\Test\thisfile.vbs" "%1.docx" %p 

And having placed a companion thisfile.txt.docx in that folder I can add my notes like this

The above examples are using the tools Microsoft include in Windows
However you can apply exactly the same techniques using any prefered editor

Here is an example where I read in SumatraPDF then use a cloud synchronized MarkDown editor (actually here I am in portable offline mode)
Then as I take my notes in text format I can export to PDF (or HTML) to preview my changes as I edit in a new window

1 Like