Integrated Sumatra PDF based Lister plug-in (wlx)
Moderators: Hacker, petermad, Stefan2, white
Integrated Sumatra PDF based Lister plug-in (wlx)
I had this project in my personal queue for quite some time. Fortunately, I finally found some time to start coding.
So here it is:
A fully integrated Sumatra PDF based Lister plug-in.
This is the initial release so there are probably some rough edges, though I tested it quite extensively.
Now to what is more important - the features:
- View PDFs with Lister (or any other tool supporting wlx plug-ins)
- Fully independent of any external tools or additional libraries
- Very simple non-obtrusive interface, stripped down to the bare minimum
- Tightly integrated into Total Commander, thus offering support for search (your favorite F3->F3 combo works!) and position
- Fast, because it uses the Sumatra PDF code-base (that in turn uses MuPDF to render)
- Small, only 1.7 MB (compressed with UPX) for a full fledged PDF viewer
- Free Software (GPLv3 as required by Sumatra PDF)
Known issues (will be fixed when I find some more time):
- Original toolbar implementation of Sumatra PDF is a hack, thus there are some minor render glitches (in the toolbar you'll see an extra separator) when using the "Classic Theme"
- Slow rendering tasks may need to be completed before window will be closed
TODO/Wishlist (will be added when I find some more time):
- Add advanced (XMP based) properties dialog for the shown PDF
- Implement printing support
- Find a nice way to show/hide TOC box (ini setting?) and make it search-able
Screenshot:
Image: http://helicoid.de/tc/wlx_sumatrapdf.png
Changelog
Version 0.8.1:
- [face=courier]sendcommand=0[/face] did not save zoom level when "Fit to window" was active
Version 0.8:
- Updated to SumatraPDF r2072 (fixes Issue 1013)
- Added the ini-Setting [face=courier]sendcommand[/face] to disable sending and receiving the "Fit to Page"-commands from Lister. Default is 1.
Version 0.7.5:
- Store display mode (facing, continuous) in ini
- Do not write sumatrapdfprefs.dat file
- Updated detection string to match ext="pdf" or the pdf signature without forcing
Version 0.7.3:
- Some fixes for the TOC box ('t' always toggles the box, do not zoom when toggle)
Version 0.7.2:
- Added option to toggle TOC (press 't' and 't' again when the box is not focused or click the little arrow) - this is not persistent (yet).
Version 0.7.1:
- Added a toolbar button to show the SumatraPDF based properties window of a PDF
Version 0.7:
- Added support for ListGetPreviewBitmap(W) (which means thumbnails will be generated even on systems without any external PDF reader installed)
Version 0.6:
- Zoom level is now stored in lsplugin.ini
- Buttons for "fit page" and "fit to width" added to toolbar
Version 0.5:
- Initial release
Download:
Sumatra PDF WLX - Version 0.8.1 (1.7 MB)
For now, I did not put the sources into a proper repository, but you can get them here.
The changes were made against r2072 so just check out this version (or try it with HEAD) and extract the archive to the source tree.
Credits:
Krzysztof Kowalczyk and some other contributors wrote the Sumatra PDF core. Check the official Sumatra PDF page for more information. The wlx part is my work.
Feel free to report bugs you find (also check if they exist in the original Sumatra PDF and then and only then report them there). Patches are also very welcome.
So here it is:
A fully integrated Sumatra PDF based Lister plug-in.
This is the initial release so there are probably some rough edges, though I tested it quite extensively.
Now to what is more important - the features:
- View PDFs with Lister (or any other tool supporting wlx plug-ins)
- Fully independent of any external tools or additional libraries
- Very simple non-obtrusive interface, stripped down to the bare minimum
- Tightly integrated into Total Commander, thus offering support for search (your favorite F3->F3 combo works!) and position
- Fast, because it uses the Sumatra PDF code-base (that in turn uses MuPDF to render)
- Small, only 1.7 MB (compressed with UPX) for a full fledged PDF viewer
- Free Software (GPLv3 as required by Sumatra PDF)
Known issues (will be fixed when I find some more time):
- Original toolbar implementation of Sumatra PDF is a hack, thus there are some minor render glitches (in the toolbar you'll see an extra separator) when using the "Classic Theme"
- Slow rendering tasks may need to be completed before window will be closed
TODO/Wishlist (will be added when I find some more time):
- Add advanced (XMP based) properties dialog for the shown PDF
- Implement printing support
- Find a nice way to show/hide TOC box (ini setting?) and make it search-able
Screenshot:
Image: http://helicoid.de/tc/wlx_sumatrapdf.png
Changelog
Version 0.8.1:
- [face=courier]sendcommand=0[/face] did not save zoom level when "Fit to window" was active
Version 0.8:
- Updated to SumatraPDF r2072 (fixes Issue 1013)
- Added the ini-Setting [face=courier]sendcommand[/face] to disable sending and receiving the "Fit to Page"-commands from Lister. Default is 1.
Version 0.7.5:
- Store display mode (facing, continuous) in ini
- Do not write sumatrapdfprefs.dat file
- Updated detection string to match ext="pdf" or the pdf signature without forcing
Version 0.7.3:
- Some fixes for the TOC box ('t' always toggles the box, do not zoom when toggle)
Version 0.7.2:
- Added option to toggle TOC (press 't' and 't' again when the box is not focused or click the little arrow) - this is not persistent (yet).
Version 0.7.1:
- Added a toolbar button to show the SumatraPDF based properties window of a PDF
Version 0.7:
- Added support for ListGetPreviewBitmap(W) (which means thumbnails will be generated even on systems without any external PDF reader installed)
Version 0.6:
- Zoom level is now stored in lsplugin.ini
- Buttons for "fit page" and "fit to width" added to toolbar
Version 0.5:
- Initial release
Download:
Sumatra PDF WLX - Version 0.8.1 (1.7 MB)
For now, I did not put the sources into a proper repository, but you can get them here.
The changes were made against r2072 so just check out this version (or try it with HEAD) and extract the archive to the source tree.
Credits:
Krzysztof Kowalczyk and some other contributors wrote the Sumatra PDF core. Check the official Sumatra PDF page for more information. The wlx part is my work.
Feel free to report bugs you find (also check if they exist in the original Sumatra PDF and then and only then report them there). Patches are also very welcome.
Last edited by j on 2010-08-22, 22:51 UTC, edited 18 times in total.
Hi J, I'm the author of Sumatra. If there are improvements that you're making as part of your plugin work that would also benefit Sumatra, I encourage you to send them to me, as described at Sumatra website (section develop)
I believe it would be good for both of us: Sumatra would get the benefit of additional improvements and you would have a smaller diff to maintain for your project. In general I'm happy to give svn commit privileges after a few patches, to make it easy for people to contribute.
Maybe it would even be possible to build your plugin directly from Sumatra's sources (with a few #ifdefs).
Either way, I'm happy that Sumatra was of use for you.
I believe it would be good for both of us: Sumatra would get the benefit of additional improvements and you would have a smaller diff to maintain for your project. In general I'm happy to give svn commit privileges after a few patches, to make it easy for people to contribute.
Maybe it would even be possible to build your plugin directly from Sumatra's sources (with a few #ifdefs).
Either way, I'm happy that Sumatra was of use for you.
Krzysztof Kowalczyk
http://blog.kowalczyk.info
http://blog.kowalczyk.info
Sure thing. For now the changes mainly regard the integration part. But when it comes to the toolbar I will definitely prepare patches for the main source tree when I make improvements.kjk wrote:I believe it would be good for both of us: Sumatra would get the benefit of additional improvements and you would have a smaller diff to maintain for your project. In general I'm happy to give svn commit privileges after a few patches, to make it easy for people to contribute.
I first went this way but the source became a bit too convoluted. I suppose in the long term it might be better to basically have a main.cpp and a listplug.cpp and put the specialized parts in either and the common parts in the SumatraPDF.cpp (those where little to none #ifdefs are needed). Anyway, if the plug-in would be a welcome addition to the main project I suppose that I will try to find some time to do a bit of integration work so the changes do not diverge that much and the plug-in keeps an up-to-date code-basis.kjk wrote:Maybe it would even be possible to build your plugin directly from Sumatra's sources (with a few #ifdefs).
kjk wrote:Either way, I'm happy that Sumatra was of use for you.
It sure was. Great work by the way .
It is based on the original source code, hence the Sumatra PDF origin and not MuPDF (or so). But to implement an integration, printing and search needs to be delegated and the Sumatra PDF based search was not portable in that sense.Alextp wrote:I also suggest to base on original source code. You will be able to do print, search etc, and no glitches when rendering.
Pls, Upx compr. - make an option(if I include it into UV package, non-compr. version will be better)
Also printing needs to be redirected as Total Commander tells the method what printer to use etc. (basically not that hard to do).
The glitch is inherent in the Sumatra PDF toolbar as it uses a separator as a spacer and thus it will produce some glitches. When I will find some time I will implement a proper toolbar that can be used in Sumatra PDF and my derived WLX.
Finally, I tested various compression variants and UPX produces the smallest overall archive. On important point is, that I want to use a standard format such as RAR or ZIP, any other would mean that the user needs an extra packer (plug-in) installed. Feel free to use UPX to decompress the DLL if you have a problem with it or compile the source code to get a real vanilla file.
I don't have an account there yet. But when I'll get one, I will.Alextp wrote:3, Will you put to totalcmd.net?
You are right. I forgot to mention that in my "Known Issues" list. There is no proper configuration yet. When it will be used, the zoom will definitely be saved.Horst.Epp wrote:There should be at least an option to set the default Zoom factor.
Currently it comes up everytime with some unreadable small display and doesn't remenber the last used Zoom.
This way you can't read a lot of PDF files in a short time.
- fenix_productions
- Power Member
- Posts: 1979
- Joined: 2005-08-07, 13:23 UTC
- Location: Poland
- Contact:
I released an update. The new version will store the last set zoom level.
You can disable writing of a new zoom level by setting [face=courier]savezoom=0[/face] in the [face=courier]lsplugin.ini[/face] under the [face=courier][SumatraPDF][/face] key. Then the value stored as [face=courier]zoom[/face] will be used when opening a PDF (where -1 is fit page and -2 fit to width).
There is some heuristic going on when "fit image to window" is active:
When a previous session (like Imagine or what ever) sets the "Fit image to window" it will overrule the previous zoom level but will not overwrite the setting in the INI. Thus when pressing "f" you will return to the previous zoom-level. I think this way the behavior is quite consistent.
Any other suggestions are welcome.
You can disable writing of a new zoom level by setting [face=courier]savezoom=0[/face] in the [face=courier]lsplugin.ini[/face] under the [face=courier][SumatraPDF][/face] key. Then the value stored as [face=courier]zoom[/face] will be used when opening a PDF (where -1 is fit page and -2 fit to width).
There is some heuristic going on when "fit image to window" is active:
When a previous session (like Imagine or what ever) sets the "Fit image to window" it will overrule the previous zoom level but will not overwrite the setting in the INI. Thus when pressing "f" you will return to the previous zoom-level. I think this way the behavior is quite consistent.
Any other suggestions are welcome.