Sumatra PDF is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR reader for Windows

Reopen Closed Tab

Is it possible to implement a “reopen” or “undo closed tab” option, similar to the Ctrl+Shift+T function in browsers such as Firefox and Chrome?

(Maybe I’m the only one who would find this helpful, but if you are looking at many of the same PDFs often, e.g., while working on a project, it would be quite appreciated.)

Reasonable request, and not the first time requested, stock answer is why can’t you simply Alt+F+1 or up to 9 and 0

Sorry for late response - glad to hear I’m not the only one thinking about it (apologies for not finding the previous requests).

I suppose “Alt+F+number” is one solution if “Remember open files” is checked, though I find that setting slightly annoying for two reasons:

  1. having all my PDFs open to the last place (say page 24) if I’m opening up the file for the first time in a while is generally not what I want, and

  2. having all of my tabs reopen next time Sumatra is launched (i.e., if I close a window with ten tabs because I’m done with the project, it’s slightly annoying to close all ten to start fresh. Additionally, if you access files on a networked drive, and later open up the program when you no longer have access to it [work v. home], then the program has to freeze and try to access to disconnected drive before giving up, which takes time).

Because of those quirks, I disable “Remember open files”. Maybe if those two functions (remembering recently opened files in the File menu, and remembering open tabs/location) were separated, then the Alt+F+# would be a more workable solution.

Obviously, this is just a minor issue. Just my 2¢.


Try in advanced settings RestoreSession = false and on the standard options uncheck remember per document but do check remember opened files

That should give you the list without your “annoyances”

Yup - that seems to work. Thanks!

(Official reopen closed tab shortcut would still be convenient, but this is definitely a usable workaround)

I opened +/-15 files in various time. I will be open more one, and i close unnecessary.
Last opened and last closed - It is not the same;
I accidentally close one book… oh! i don’t remember what of book I close… I don’t remember both name and author… . And I don’t remember when the file is get opened.
And more badly ctrl+W is keyboard shortcut for Close file, and ctrl+1/2… for change view.

i think it is very need feature restore last closed file, or list both last open (it already exists) and last closed

I do agree it can be frustrating to loose the current session of tabs for many reasons and the proximity of W is unfortunate if frequently using nearby keys.

The issue of saving last file closed is still an open issue as shown above

My best suggestion to consider is to frequently store your current tabs collection especially just before any accidental closure then save again only once you are happy with the next collection.

I outline how that can be achieved (note only in more recent pre-release) in my Alternative method of posting Open files from *MULTIPLE* tabs in Acrobat (or other app)

By combining the concept of save current tabs using ISO date you can restore the current status later. Here at 20 minutes past, I can return to the tabs as they were at 18 minutes past the hour or 19 minutes past. Obviously this list can build up very quickly so it may also be necessary to use an automated means to cull all the old files once no longer required.

1 Like

I use Git ) for save session)

While using multiple windows it could happen the “main instance” gets closed before a new single pdf window.
So it would be nice if each instance gets a extra “last used files” or something similar.

Would also be possible with something like “open last closed window”.

Currently there is only the one session history even when two windows are opened
It would be complex (though not impossible) to keep two sets of history for the one session.

You can use separate copies to have two separate sessions but they clearly will not share a common history, so only useful if you have two distinct separate needs such as Reading main files and alongside other reference material. or one for leisure and one business etc.

Actually whilst testing the two sets of tab states are held in the settings so it may be possible for a script to save the two sets of tab states but I think it would require some time to ensure it worked for all usages.

Am I correct in understanding there is no simple way to save the list of files currently opened in Sumatra, close the app, restart, and re-open the list of files?

I guess a work-around is to write an AutoIT/AutoHotKey script to loop through the list of open files, hit CTRL+D, copy/parse to grab the full pathname, and another script to re-open the whole thing, but I wanted to check before bothering.

Thank you.

There WAS no way even with autoxx to save currently open ffilenames of tabs (they were stored in memory only) but you can look at the method suggested above to store current session data (in recent pre-release version) the long history filenames have two tab spaces but the currently open ones have four tab characters so you can use cmd “find”. That should be easy ? in AHK but console should work just as well although vbs would be quieter.

This is my current script so wont work for most users but you can get the gist

set target=%addins%\..\SumatraPDF.exe

FIND "				FilePath =" "%addins%\..\SumatraPDF-settings.txt" > %temp%\pdflist.txt
echo. >>%temp%\pdflist.txt

FOR /F "tokens=3,2,1 delims=/" %%i in ("%date%") do set IsoDate=%%k-%%j-%%i
FOR /F "tokens=2,1 delims=: " %%m in ("%time%") do set IsoTime=-%%m-%%n-
echo :[Filenames] >"%IsoDate%%IsoTime%SumatraPDFSavedSession.cmd"
FOR /F "tokens=3* skip=2 delims= " %%G IN (%temp%\pdflist.txt) DO echo start "" "%target%" -reuse-instance "%%G %%H" >>"%IsoDate%%IsoTime%SumatraPDFSavedSession.cmd"

Thanks for the script.