Forum moved here!

# Home / Allow different trays in one print job

andrew

Commandline options to allow printing pages on differents trays with the same job…

eg: --print-settings “1,bin=1,2,3=bin=2”

Background: some printer alllows to “staples” sheets together (printer-driver option)
example… print page 1 and 2 from tray1 … print page 2 and 3 from tray 2 … then staple all together…

CarstenM

Hi everybody!
I have to warm up this topic, because I need help.
I would like to print multipage pdfs on different trays by using command line. I tried different ways (i have to take the bin-names, the bin-numbers does not work at all).

-print-settings “simplex,1,bin=‘Kassette 1’,2=bin=‘Kassette 2’” only prints page 1 on default tray, but no other pages
-print-settings “simplex,1,bin=Kassette 1,2=bin=Kassette 2” only prints page 1 on Kassette 1, but no other pages
-print-settings “simplex,1,bin=Kassette 1,2,bin=Kassette 2” prints both sites on Kassette 2

I have tried a few similar ways, but none leads to success.
The aim is for single- and multi-page pdfs always to print the first page from Kassette 1, all following pages from Kassette 2.

greetings, Carsten

GitHubRulesOK

I don’t think the mixture of combinations you are trying are possible in one line

You want to print page 1 to cassette 1
then all other pages to cassette 2
so in two separate lines something along the lines of

-print-settings “simplex,1,bin=‘Kassette 1’"
-print-settings “simplex,2-100,bin=‘Kassette 2’”

It may be possible to use MSDOS “&” between the two long commands however I think It would be best to keep the two lines separate in one .cmd file so you can drag and drop one or more files in groups onto the cmd.

CarstenM

Thank you!!!
Sometimes it’s so easy.
I took a simple cmd file:
@echo off “C:\Program Files\SumatraPDF\SumatraPDF.exe” -print-to “Kyocera ECOSYS M6526cdn KX” -print-settings “simplex,1,bin=Kassette 1” %1 “C:\Program Files\SumatraPDF\SumatraPDF.exe” -print-to “Kyocera ECOSYS M6526cdn KX” -print-settings “simplex,2-99,bin=Kassette 2” %1 exit
This works fine - but a simple command-line would be nicer

GitHubRulesOK

There are tricks with && or using For in do loops

@SumatraPDF -print-to "Kyocera ECOSYS M6526cdn KX" -print-settings "simplex,1,bin=Kassette 1" "%1" && SumatraPDF -print-to "Kyocera ECOSYS M6526cdn KX" -print-settings "simplex,2-99,bin=Kassette 2" "%1"

HOWEVER just Keep It Simply Stupid (KISS) and may help to quote wrap those "%1" s

CarstenM

Great! ymmd
This is what i’m looking for!

CarstenM

Damn!
With this code single-page pdfs prints at tray 1 and again at tray 2.
Any smart ideas?

GitHubRulesOK

Struggling to NOT I did say keep it simple is best

I see no reason why page 1 should be processed by the second call but I don’t know how your calling try single & rather than && try capturing echo’s or screen output to check what Sumatra is getting so could have a sumatraTST.cmd full of echo %1 %2 %3 %4 %5 %6 %7and then test your calling against SumatraTST (where currently using SumatraPDF) to see what Sumatra is getting on each run

I just tried
SumatraTST -print-to “Kyocera ECOSYS M6526cdn KX” -print-settings “simplex,1,bin=Kassette 1” “SumatraPDF-settings.txt” && SumatraTST -print-to “Kyocera ECOSYS M6526cdn KX” -print-settings “simplex,2-99,bin=Kassette 2” “SumatraPDF-settings.txt”

and got back the expected pair of sequences but without a two tray system cant check if I would get similar results to you

1=-print-to 2="Kyocera ECOSYS M6526cdn KX" 3=-print-settings 4="simplex,1,bin=Kassette 1" 5="SumatraPDF-settings.txt" 6= 7= 8= 9=
1=-print-to 2="Kyocera ECOSYS M6526cdn KX" 3=-print-settings 4="simplex,2-99,bin=Kassette 2" 5="SumatraPDF-settings.txt" 6= 7= 8= 9=


It could well be that the second call is attempting to be respected and the nearest result is to send that first page to second device thus you would need to only send docs with more than one page in that second direction so need a means to detect number of pages (tricky)

OK I tried to simulate calling a file twice without enough pages and the second run prints last page so if the count is one then I guess page 1 is both first call and last on second call ! (not much help as I cant find a way with Sumatra to fault on the second page ) I tried view - page 2 but it will simply happily show page 1 without error !

I would be digging out some other tool to count pages then pass down one fork to 1 page printing and another fork for 2+ printing suitable tools may be mutools coherent pdf pdftk and filter with “find” num pages

so for example this should work with coherent community edition (other products are available)

cpdf -pages "%1">%temp%\pagecount.txt
set /P pagecount=<%temp%\pagecount.txt
SumatraPDF -print-to "Kyocera ECOSYS M6526cdn KX" -print-settings "simplex,1,bin=Kassette 1" "%1"

REM if the page count is 1 then do not run second pass for second bin
if "%pagecount%" = "1" goto done
SumatraPDF -print-to "Kyocera ECOSYS M6526cdn KX" -print-settings "simplex,2-99,bin=Kassette 2" "%1"
:done
andrew

Sorry guys

That has nothing to do with the initial question! With a batch-file or && are always genarating two printjobs

GitHubRulesOK

Hi Andrew
Agreed this is not an answer to your request for two settings
However it is an attempt to get around the immediate requirement for two different settings

CarstenM

Good morning!

@andrew

eg: --print-settings “1,bin=1,2,3=bin=2”

Your suggestion to use different trays does not work for me, so I’ve been looking for a solution.

@GitHubRulesOK
I also tried a bit and found a solution with pdfinfo. My code now contains:

for /F "tokens=2" %%n in ('pdfinfo %1^|find "Pages:"') do set /a PageCount=%%n
SumatraPDF -print-to "Kyocera ECOSYS M6526cdn KX" -print-settings "simplex,1,bin=Kassette 1" %1
if not %PageCount%==1 (
SumatraPDF -print-to "Kyocera ECOSYS M6526cdn KX" -print-settings "simplex,2-%PageCount%,bin=Kassette 2" %1
)
exit


It’s the same approach as yours and works as it should!
Thank you again

GitHubRulesOK

@CarstenM
Thanks for the positive feedback and what conclusion works for you since it is always useful for others to see the discussion towards a reasonable outcome even if it is not their “perfect solution” that way others can attempt similar steps towards their own goal / solution