nod5 / HighlightJump

AutoHotkey app to add, remove and jump between highlights in SumatraPDF
GNU General Public License v3.0
20 stars 4 forks source link

HighlightJump


:warning: HighlightJump does not work with SumatraPDF versions newer than SumatraPDF-prerelease-12145-64.exe released on 2020-02-14. See #10-comment


AutoHotkey app to add, remove and jump to color highlights in SumatraPDF

Version 2020-03-01 - Free software GPLv3 - by Nod5

HighlightJump Feature Overview

Setup

  1. Get newest SumatraPDF Prerelease version

  2. In SumatraPDF > Settings > Advanced Options:
    SaveIntoDocument = false
    FullPathInTitle = true

  3. Install AutoHotkey unicode

Use

Download repo, unzip and run HighlightJump.ahk
There is no UI. Use keyboard and mouse shortcuts.
Use tray icon to close or show help.
Tip: Copy a HighlightJump.ahk shortcut to Startup folder in Windows.

Keyboard shortcuts

A or Y : Highlight selection yellow
A (hold) : cycle highlight color: yellow > red > green > cancel

R : Highlight selection red
G : Highlight selection green
D : Make a blue square dot at the mouse pointer ("D for dot")

E (hold) : Remove all highlighting mouse moves over ("E for erase")
Ctrl + Delete : Remove all highlighting on active page

Win + A : Hide/Show all highlighting

Ctrl + PgUp/PgDn : Jump to next/previous page with highlight
Ctrl + Home/End : Jump to first/last page with highlight

Ctrl + Shift + Y/R/G/D : select jump filter color
Ctrl + Shift + A : cycle jump filter colors
Ctrl + Shift + PgUp/PgDn : Jump to next/previous filter color page
Ctrl + Shift + Home/End : Jump to first/Last filter color page

Quick jump shortcuts

1/2/3/4 (hold) : temporarily store current page number
1/2/3/4 (tap) : jump to stored page (tap again to undo jump)
5 : show list of stored pages

Mouse shortcuts

Lbutton + Rbutton : Highlight selected text yellow
Lbutton + Rbutton (hold) : Cycle highlight color: yellow > red > green > cancel

Rbutton + Mbutton : Make a blue square dot at the mouse pointer

Rbutton + Lbutton (hold) : Remove all highlighting mouse moves over

Rbutton (hold) + Scroll Up/Down : Jump to next/previous page with highlight

Ctrl + Lbutton (click drag) : Draw rectangle, then A/Y/R/G to make highlight

.ini file options

Edit HighlightJump.ahk.ini to change these options and then reload HighlightJump.

License

Free Software GPLv3 by github.com/nod5

FAQ

Q Which filetypes does HighlightJump support?
A PDF DJVU DJV and if SumatraPDF advanced settings section ChmUI is set to UseFixedPageUI = true then also CHM EPUB MOBI TXT LOG. The goal is to support all filetypes that SumatraPDF Prerelease can open and annotate.

Q What Windows versions are supported?
A HighlightJump is only developed and tested in Windows 10 x64. It might work in other versions.

Q Why does HighlightJump only work in SumatraPDF Prerelease?
A Regular SumatraPDF does not (yet) have the feature to make highlights.

Q Which versions of SumatraPDF Prerelease can be used with HighlightJump?
A Short answer: try the newest version. Longer: new Prerelease versions can have changes that break HighlightJump. In that case you can try older prerelease versions, until next HighlightJump release fixes the incompatibility. Prerelease versions from before 2020-02-02 are definitely incompatible.

Q Will my highlights work a year from now?
A Probably. But new SumatraPDF versions might also break HighlightJump permanently or change the .smx annotation format. Therefore consider highlights you make not future-proof.

Q Why are edits to SumatraPDF advanced settings required?
A Saving annotations (highlighting) to an external plaintext file filename.pdf.smx is necessary for HighlightJump to read/edit them. Showing full file path in window title is currently necessary for HighlightJump to know the file path. There is an experimental workaround, see further down.

Q I do not like that R and G override SumatraPDF shortcuts.
A Easy recall ("R for red") can be worth a small shortcut conflict. HighlightJump creates Ctrl+R as replacement reload shortcut and SumatraPDF already has Ctrl+G for go to. If you disagree then in HighlightJump.ahk.ini set RedGreenRG=0. That makes Y red and U green.

Q How do I change default highlight color from yellow to something else?
A First, in SumatraPDF advanced settings section AnnotationDefaults change HighlightColor = #ffff60 to a new hex color code. Next edit HighlightJump.ahk line vYellow := "ffff60" to the same new color code. Restart HighlightJump and SumatraPDF.

Q How do the quick jump keys work?
A Hold down one of 1 / 2 / 3 / 4 to store the current pagenumber. Later tap (short press) that key again to jump to the stored page. While on that page tap again to undo the jump. Press 5 to show a list of stored pages. Use it for temporary jumps. Clears when HighlightJump is closed. Independent from highlights. Similar to MuPDF Viewer numbered bookmarks.

Q Will pdf files with an UNC file path work?
A No, files like \\server\share\path\file.pdf do not yet work in HighlightJump.

Q What file encoding should be used?
A The correct encoding for the HighlightJump.ahk file is UTF-8 BOM. See AutoHotkey FAQ. The download from GitHub has that encoding.

Q Why does HighlightJump exist?
A HighlightJump is "feature request ware". I hope someone builds this into SumatraPDF.

Known Issues

When SumatraPDF is in continous page mode and (parts of) multiple pages are visible then D, E and Ctrl + Del and quick jump shortcuts operate on the page shown in SumatraPDF toolbar. That is sometimes not the page the mouse is over! Keep an eye out for that, otherwise you may add/remove highlights on the wrong page. Issue #5.

Experimental: improved methods

HighlightJump has experimental methods to interact with SumatraPDF via SendMessage. Improvements compared to default methods: faster, more reliable, silent, no FullPathInTitle setting required, solves the issue in continous page mode (see above), erasing with E removes highlight immediately.

To try the experimental features:

See also SumatraPDF repo issues 1411 and 1412