Forum moved here!

Home / Default to print current page

packet68

Hi Chris,

Just wandering if there is an option (I could not find it) to set in print dialog ‘Page Range’ to ‘Current Page’ as a default? I’m printing multiple single pages from documents daily and every time I need to remember to change to ‘current page’. Maybe it would be possible to set PrintRange variable in PrinterDefaults []?

Thanks for your great work!

Pozdrawiam, Marcin

kjk

There is no way to do that. I don’t know of any software that has an option like that.

GitHubRulesOK

@packet68
You could set in advanced options to call a second copy of Sumatrapdf
(obviously dont call the main copy that has the page open)
This can fail on larger files due to file locking so if you see that happen the alternative is to use a batch file to copy the pdf then print the given page of the copy !

ExternalViewers [
	[
		CommandLine = "C:\SumatraPDF\3.1.2\SumatraPDF.exe" -print-to-default -print-settings "%p"  "%1"
		Name = &# Print Current Page
	]
]

NOTE to others copying/pasting the above command, beware when copying command lines that quotes may be changed from required simple double " marks to non working “curly quoted”

packet68

Thanks, that worked but only from the command line. Besides navigating to ‘External command’ in the menu takes the same amount of clicks as changing to current page in the printing dialog so no gain.

In MSWord you can use macro and create extra button to do the job - but I believe there is no such option in Sumatra.

Anyway appreciate your help.

Martin

GitHubRulesOK

@packet68
there is a very slight reduction if you shortcut it to a free key

Thus I might use Alt F # = 3 keys
Otherwise its Alt F P Tab U P = 6 Keys
:slight_smile:
see where I edited above to include &#

packet68

Indeed. That would be some solution. But as I mentioned the call to external command from Sumatra does not do anything. It works if I run it from cmd (command) line but then I use actual file name and page number. This is what I have in advanced settings:

ExternalViewers [
[
CommandLine = “C:\SumatraPDF\SumatraPDF.exe” -print-to-default -print-settings “%p” “%1”
Name = &d Print Current Page
]
]

where c:\SumatraPDF\SumatraPDF.exe is a copy of the 64-bit installed in “Program Files”

GitHubRulesOK

Ok just be careful you are running two copies and the external command must be in the master application NOT the copy.
So in main (normal) SumatraPDF check those values are actually present in that settings file
Usually proof is that if “C:\SumatraPDF\SumatraPDF.exe” is found then you get the visible option to proceed using the current pdf or xps etc no other clue until the print dialog appears, however I just discovered that in this case nothing can confirm the command is right other than trapping the call in say a cmd or other script file !
To Check what is called YOU COULD TEMPORARILY TRY
CommandLine = c:\windows\system32\cmd.EXE /K ECHO "C:\sumatr…

ALSO do not simply copy the exe on its own to another folder, best is usually to use a simple one exe portable copy from standard or historic pages here
https://www.sumatrapdfreader.org/download-free-pdf-viewer.html (avoid experimental versions for now unless you want bleading edge actions) old version 3.0 .zip may help in some cases

packet68

Thanks for the suggestions. I used standalone SumatraPDF.exe (tried both 3.1.2 and 3.0) as you recommended. Also External command is ONLY present in Master (installed) application. When I run with ECHO cmd this is what is being called:

“C:\SumatraPDF\SumatraPDF.exe” -print-to-default -print-settings “3” “C:\Users\Martin\AppData\Local\Temp\arystofanes-chmury.pdf”

so it looks OK, all parameters are correct

and when I run it directly from command line everything works as it should, I get page 3 printed.

But when I run it from master SumatraPDF nothing prints. I tried from 2 PC’s running Windows 10 and 7. Looks like passing this command to OS does not work correctly.

I guess I’ll have to live with it. Thanks for your help.

GitHubRulesOK

I am completely flummoxed, everthing looks like it should work, for what it is worth I reset my default printer to a real one (normally use virtual) all default settings are as I need them (portrait etc) so a “print to default” command should not need any alteration

I open a document that has two ways of showing pages (not relevant to your use, but I like to check other behaviours, I enter page 3 in the selector and it jumps to page 11, that is expected (there are 8 intro pages) so I would expect that viewing page 11 then I will get one printed that shows 3 in the corner.

I press Alt F # (my shortcut) and after a delay (as it goes wi-fi to a router and back to the printer) sure enough page 3 (really 11) appears from the printer beyond, There is no clear warning if it fails (you may get a hidden message if lucky and do NOT add the -silent command) some users found adding the superflous -exit-when-done helped
and you could try calling temporarily with -print-dialog to see/test things like usage rights

GitHubRulesOK

Looking at your command you are calling your temp directory ? if the files are in progress from a web or cloud location that can cause usage problems I would first check on files in a static personal documents area then move on to restricted or temporary /remote locations

packet68

Ok, got it, hehe :). The freaking quotes!!! I just copied&pasted from your post and they were curly quote characters (Alt 0147 and Alt 0148) instead ASCII. Now it works!!!

doesn’t work:

CommandLine = “c:\SumatraPDF\SumatraPDF.exe” -print-to-default -print-settings “%p” “%1”

works:

CommandLine = "c:\SumatraPDF\SumatraPDF.exe" -print-to-default -print-settings "%p" "%1"

Little nasty things :rofl: :rofl:

Thanks again for your patience and help!

GitHubRulesOK

@packet68
YES I should have noticed / thought of that one it is a common problem with web based cut and paste, I have re-block quoted my first example to reduce that issue for others, well spotted and may the "quotes" be with you :slight_smile: