PDF Viewer plugin for TC 64-bit in 2021?

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *Fla$her »

AkulaBig wrote: 2023-12-12, 20:12 UTCIt's clear. Everything is described in the readme.
I watched the Readme earlier. There are only 3 dual-purpose keys, fixed Esc and reading paths in ini. Does this require a lot of code?

Response to the following comments:
AkulaBig wrote: 2023-12-13, 05:52 UTC I'm not going to communicate with you in that tone.
I keep a calm and cool tone. Without any emotion.
If you don't like something specific in what has been written, please point it out, and I will try to rephrase it.
AkulaBig wrote: 2023-12-13, 10:12 UTC Yes, I don’t understand why Fla$her should be so rude. Do I have to report how many lines of code I wrote? :) I'm ready for a constructive discussion, but not tro-lo-lo.
There are no tro-lo-lo here. You wrote that the problem is the output size due to the large number of options. I don't believe that what I have listed is a large number and that in this regard the size should increase so significantly. I didn't exactly ask for the number of lines of code. There is such a thing as curiosity. There is nothing rude or disrespectful about him. If talking about sizes offends you, then I don't dare bother you about it anymore. And I am always ready for a constructive dialogue.
Last edited by Fla$her on 2023-12-13, 12:19 UTC, edited 1 time in total.
Overquoting is evil! 👎
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

Fla$her wrote: 2023-12-12, 23:19 UTC
AkulaBig wrote: 2023-12-12, 20:12 UTCIt's clear. Everything is described in the readme.
I watched the Readme earlier. There are only 3 dual-purpose keys, fixed Esc and reading paths in ini. Does this require a lot of code?
I'm not going to communicate with you in that tone.
User avatar
deus-ex
Power Member
Power Member
Posts: 969
Joined: 2003-02-10, 17:45 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *deus-ex »

2AkulaBig

I feel with you. It's not that you receive any payment for it, right? Especially from those, who are demanding.

I hope you can find the time and energy to check whether the speed of the plugin can be further improved. But please don't feel rushed, it's not an urgent issue, your plugin works fine in its current state.
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

deus-ex wrote: 2023-12-13, 07:09 UTC 2AkulaBig
I feel with you. It's not that you receive any payment for it, right? Especially from those, who are demanding.
Yes, I don’t understand why Fla$her should be so rude. Do I have to report how many lines of code I wrote? :) I'm ready for a constructive discussion, but not tro-lo-lo.
deus-ex wrote: 2023-12-13, 07:09 UTC 2AkulaBig
I hope you can find the time and energy to check whether the speed of the plugin can be further improved. But please don't feel rushed, it's not an urgent issue, your plugin works fine in its current state.
Of course I will look into the reason when I find the time. I'm interested in this myself.
Thank you for your support and understanding!
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *white »

Moderator message from: white » 2023-12-13, 10:57 UTC

Please stay on-topic. I will remove posts that go further off-topic after this, unless it is an apology or positive feedback.

Please note that you can also simply ignore people. There is even a forum feature (Add foe) for that.


Edit:

Moderator message from: white » 2023-12-13, 12:08 UTC

Further off-topic posts by Fla$her and AkulaBig removed.
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

Today we finally got around to testing the sLister and TCSumatraPDF plugins for speed. The tested pdf file weighs 135 MB. The file opening speed was the same for both plugins. I tested it on Win11 on a powerful computer and on Win7 on a weak computer. It turns out that in the last testing I even copied SumatraPDF 3.2 to the plugin folder, but forgot to specify the path to it. And I tested my plugin with SumatraPDF 3.1, and sLister with SumatraPDF 3.2. Which is much faster than version 3.1.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *gdpr deleted 6 »

2AkulaBig
from this comment i gather you are the author of the TCSumatraPDF plug-in. As there is no dedicated forum thread here for TCSumatraPDF and me being unable to find any other venue for filing bug reports for TCSumatraPDF, please excuse me for using this thread to report a quite severe bug.

I was and am using the SumatraPDF as viewer (associated with the .pdf file extension) for PDF files on my Windows 11 box. So, installing TCSumatraPDF plug-in to integrate SumatraPDF also in TC would make perfect sense. However, in a scenario like mine where i want to use SumatraPDF stand-alone as well as within TC, things can go badly quite quickly.

TC version: 11.01, x64
TCSumatraPDF version: 1.6, x64 (downloaded from https://totalcmd.net/plugring/wlx_TCSumatraPDF.html)
SumatraPDF version: 3.5.2, x64
OS: Windows 11 Pro 23H2, x64, english

sumatrapdf.ini:

Code: Select all

[Options]
path64=C:\Program Files\SumatraPDF\SumatraPDF.exe
The path64 specified in my sumatrapdf.ini is the path of the SumatraPDF.exe that is also used for stand-alone PDF viewing (outside of TC).

When there is already a stand-alone SumatraPDF viewer running, TCSumatraPDF (or the SumatraPDF instance started by TCSumatraPDF; i don't know the implementation of the TCSumatraPDF plug-in to make a definite statement) will hijack this stand-alone SumatraPDF viewer instead of creating its own SumatraPDF instance for lister/quick-view in TC. This freezes TC, and messes up the UI of the stand-alone SumatraPDF viewer instance (when a navigation key like one of the cursor keys is then pressed in SumatraPDF). Even worse, it seems to intercept keyboard events on a global level, messing up keyboard input of other unrelated applications (like the cursor keys for example).

Steps to reproduce:

1. Close all instances of SumatraPDF, whether stand-alone or in TC.
2. Open a PDF in stand-alone SumatraPDF viewer (outside of TC).
3. Open some (larger) web page in a web browser and confirm that you can scroll the web page with the cursor keys. (I am using Firefox.)
3. Switch to TC (with TCSumatraPDF installed), and press F3 on another PDF file for viewing it in lister.

Observed issues:

- Unexpectedly, the PDF file is not being opened in lister but in the stand-alone SumatraPDF instead.
- TC freezes, and "(Not responding)" appears in its title bar when trying to click on the TC window.
- Switch to the web browser showing the aforementioned larger web site. Trying to scroll it with the cursor keys won't work, pressing a cursor key will switch from the web browser to the SumatraPDF viewer instead.
- Pressing cursor keys (or probably other navigation keys) in the SumatraPDF viewer now makes its tab bar and the min/max/close buttons in its top right corner disappear.

Also, sometimes it is impossible to close the SumatraPDF viewer with ALT+F4 when this problem occurs, sometimes it is possible to still close it with Alt+F4. But i have not invested the time yet to discover the conditions required for ALT+F4 to stop working for the stand-alone SumatraPDF viewer (seems possibly be related to trying to ALT+TAB to TC, but i am not entirely certain about it).


Workaround:

The bug seems to be reliant on both the stand-alone SumatraPDF viewer and TCSumatraPDF using the same path to the same SumatraPDF.exe executable. Therefore, to side-step this issue it is sufficient to make a copy (or symlink) of SumatraPDF.exe in a different directory and/or with a different file name. One SumatraPDF executable is used as stand-alone viewer (associated with the .pdf file extension), and the copy (or symlink) of the SumatraPDF executable is then used for TCSumatraPDF.

If you can't fix the issue in code and prefer affected users doing the workaround i described, i think would be nice to include an advice to this effect in the plug-in's readme.txt and caveat/rewrite this sentence in the readme.txt
readme.txt wrote: For the installed SumatraPDF, you must specify the paths to its executable files
SumatraPDF.exe in the sumatrapdf.ini file, which is automatically created in the
folder plugin after the first use.
-----------------------------
(I also noticed another cosmetic responsiveness issue when TCSumatraPDF is used in lister and for quick-view at the same time, but this issue is not only minor but also unrelated to the bug i report above. And it might even perhaps be resolved coincidentally by a fix for the reported bug. So, i am undecided whether this would be worth reporting...)
Last edited by gdpr deleted 6 on 2023-12-28, 09:08 UTC, edited 8 times in total.
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

elgonzo wrote: 2023-12-27, 19:03 UTC As there is no dedicated forum thread here for TCSumatraPDF and me being unable to find any other venue for filing bug reports for TCSumatraPDF, please excuse me for using this thread to report a quite severe bug.
I looked, indeed, there is no separate thread for the TCSumatraPDF plugin. I do not create plugin topics on this forum, but only answer questions.
You have a problem because UseTabs = true is written in SumatraPDF-settings.txt. Change the value to UseTabs = false.
I completely forgot to describe this requirement in the readme.
In older versions of the plugin, SumatraPDF itself applied this setting when used as a plugin. Now this setting must be done manually. I will add this feature to the description on the download site.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *gdpr deleted 6 »

AkulaBig wrote: 2023-12-28, 08:29 UTC You have a problem because UseTabs = true is written in SumatraPDF-settings.txt. Change the value to UseTabs = false.
Unfortunately, setting UseTabs=false in my SumatraPDF.ini does not solve the issue.

In the meantime i found a workaround, which i added to my report above. The workaround is quite easy to do, so in case you can't fix the issue in code i think it would be sufficient to include an advice regarding the workaround in the plug-in's readme.txt.
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

There are no problems in the plugin code. The option I provided solves the problem. I checked it myself. It's all about the SumatraPDF settings. If necessary, I can post my SumatraPDF-settings.txt. With which everything works correctly.
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

No workaround is required if you do the setup I described. In general, it is up to you how you configure your SumatraPDF.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *gdpr deleted 6 »

My bad, i was absent-minded for a moment. I tried setting UseTabs=false in my SumatraPDF.ini, not noticing that you talked about SumatraPDF's settings file. My apologies. Setting UseTabs=false in the correct settings file does indeed solve the issue.

And i figured that i can have tabs enabled in the standalone viewer and tabs off for the TCSumatraPDF plug-in by using different SumatraPDF-settings.txt files. I now only need to decide on how to neatly organize the different SumatraPDF-settings.txt files for the standalone viewer (with UseTabs=true) and for the TCSumatraPDF plug-in (with UseTabs=false).

Is there a way to configure the TCSumatraPDF plug-in to let it pass a user-defined directory for SumatraPDF's -appdata commandline switch or something similar? (If not, no problemo; i would then write a dirty proxy .exe for SumatraPDF.exe that would do it :lol:)
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

The plugin does not change the SumatraPDF code or settings. And the author of SumatraPDF did not make an option for SumatraPDF to use multiple ini configuration files. It is better to contact the author about setting up SumatraPDF.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *gdpr deleted 6 »

AkulaBig wrote: 2023-12-28, 11:00 UTC And the author of SumatraPDF did not make an option for SumatraPDF to use multiple ini configuration files.
SumatraPDF already allows providing the location of the setting file through the -appdata commandline option. The -appdata option essentially makes using multiple settings files possible. (I don't know whether this commandline option is a recent addition to SumatraPDF, though; SumatraPDF's version history doesn't seem to mention anything in this regard.)

Quote from https://www.sumatrapdfreader.org/docs/Command-line-arguments:
List of command line options
...
-appdata <directory> : set custom directory where we’ll store SumatraPDF-settings.txt file and thumbnail cache
SumatraPDF already being able to be used with different settings files located in different directories is the reason why i was asking about whether it is possible for the plug-in to pass a user-defined directory for the -appdata commandline option.
AkulaBig
Senior Member
Senior Member
Posts: 372
Joined: 2021-09-09, 17:28 UTC

Re: PDF Viewer plugin for TC 64-bit in 2021?

Post by *AkulaBig »

elgonzo wrote: 2023-12-28, 11:12 UTC SumatraPDF already allows providing the location of the setting file through the -appdata commandline option.
We need to understand this option. The documentation clearly states that the SumatraPDF portable configuration file is ALWAYS located in the program directory. So it's not clear what the -appdata option does. Perhaps it indicates for the installed version of SumatraPDF that the configuration file is always located in AppData.
Otherwise, it can be located either in the program folder or in AppData.
My plugin does not handle this parameter.
Post Reply