Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Integrated Sumatra PDF based Lister plug-in (wlx)
Goto page 1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) Printable version
View previous topic :: View next topic  
Author Message
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Sun Aug 15, 2010 3:08 pm    Post subject: Integrated Sumatra PDF based Lister plug-in (wlx) Reply with quote

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:
- sendcommand=0 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 sendcommand 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 Sun Aug 22, 2010 4:51 pm; edited 18 times in total
Back to top
View user's profile Send private message
dott
Senior Member
Senior Member


Joined: 03 Mar 2007
Posts: 285
Location: La Plata, Argentina

PostPosted: Sun Aug 15, 2010 10:02 pm    Post subject: Reply with quote

Testing...
Back to top
View user's profile Send private message Send e-mail
kjk
New Member
New Member


Joined: 15 Aug 2010
Posts: 1

PostPosted: Sun Aug 15, 2010 10:35 pm    Post subject: Reply with quote

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.
_________________
Krzysztof Kowalczyk
http://blog.kowalczyk.info
Back to top
View user's profile Send private message Send e-mail Visit poster's website
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Mon Aug 16, 2010 12:33 am    Post subject: Reply with quote

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.


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:
Maybe it would even be possible to build your plugin directly from Sumatra's sources (with a few #ifdefs).


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:
Either way, I'm happy that Sumatra was of use for you.

It sure was. Great work by the way Wink.
Back to top
View user's profile Send private message
Alextp
Power Member
Power Member


Joined: 16 Aug 2004
Posts: 2304
Location: Russian Federation

PostPosted: Mon Aug 16, 2010 1:29 am    Post subject: Reply with quote

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)
_________________
Universal Viewer - Log Viewer - SynWrite
Back to top
View user's profile Send private message Visit poster's website
Alextp
Power Member
Power Member


Joined: 16 Aug 2004
Posts: 2304
Location: Russian Federation

PostPosted: Mon Aug 16, 2010 1:46 am    Post subject: Reply with quote

3, Will you put to totalcmd.net?
Back to top
View user's profile Send private message Visit poster's website
Horst.Epp
Power Member
Power Member


Joined: 06 Feb 2003
Posts: 2192
Location: Germany

PostPosted: Mon Aug 16, 2010 5:47 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Mon Aug 16, 2010 6:00 am    Post subject: Reply with quote

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)


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.
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.

Alextp wrote:
3, Will you put to totalcmd.net?

I don't have an account there yet. But when I'll get one, I will.
Back to top
View user's profile Send private message
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Mon Aug 16, 2010 6:02 am    Post subject: Reply with quote

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.


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.
Back to top
View user's profile Send private message
fenix_productions
Power Member
Power Member


Joined: 07 Aug 2005
Posts: 1941
Location: Poland

PostPosted: Mon Aug 16, 2010 7:37 am    Post subject: Reply with quote

2j
I must say you fulfilled my dream (shared with Ultima Prime long ago). Thank you.

So... next dreams are:
- some comic viewer as WLX,
- ToDoList by AbstractSpoon as WFX Wink
_________________
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Xnor
Junior Member
Junior Member


Joined: 17 Apr 2009
Posts: 80

PostPosted: Mon Aug 16, 2010 12:45 pm    Post subject: Reply with quote

good job, thanks a lot Exclamation Exclamation
_________________
#201591 Single user licence
Back to top
View user's profile Send private message
dott
Senior Member
Senior Member


Joined: 03 Mar 2007
Posts: 285
Location: La Plata, Argentina

PostPosted: Mon Aug 16, 2010 11:37 pm    Post subject: Reply with quote

On the zoom regard, Z shortcut help me on this, it's not ideal but...
Back to top
View user's profile Send private message Send e-mail
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Tue Aug 17, 2010 1:08 pm    Post subject: Reply with quote

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 savezoom=0 in the lsplugin.ini under the [SumatraPDF] key. Then the value stored as zoom 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.
Back to top
View user's profile Send private message
Xnor
Junior Member
Junior Member


Joined: 17 Apr 2009
Posts: 80

PostPosted: Tue Aug 17, 2010 4:18 pm    Post subject: Reply with quote

nice progress.
I wanted to ask if it could be possible to select text in a pdf and be able to copy it to the clipboard. It would be just great.
_________________
#201591 Single user licence
Back to top
View user's profile Send private message
j
Member
Member


Joined: 13 Apr 2009
Posts: 123

PostPosted: Tue Aug 17, 2010 4:43 pm    Post subject: Reply with quote

Xnor wrote:
nice progress.
I wanted to ask if it could be possible to select text in a pdf and be able to copy it to the clipboard. It would be just great.


Yes, hold Ctrl while dragging with your mouse to select a text area. Then you can either Ctrl+C or do Edit->"Copy as text" from the menu.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) All times are GMT - 6 Hours
Goto page 1, 2, 3, 4, 5, 6, 7  Next
Page 1 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group