Sumatra PDF is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR reader for Windows

Print Page using command line -print-settings "fit" remove top page spaces

I am trying to print a A4 pdf to a receipt printer with the paper size ex: 80mmx3000mm.

But when i print using command line it will center the pdf with a huge margin on top.

Is there a way to print without creating this space on top and fit the pdf to the printer page width???


3000 thats a long banner typo ?

You give me many unknowns
SumatraPDF version
Computer default paper area (e.g. I suspect it is A4 since you are quoting mm), it is that you are possibly having to defeat at command line

I suggest if it is single/few pages at a time then use the current 64 bit daily portable will do
a) only current daily 64bit version has significantly more paperkind control
b) in common with all versions since 3.0 the image working output is large but you are looking at smaller pages, thus it will be much easier to set those below previous A6 restriction.

command line settings can now include paper=A8 or paperkind=199 etc.
read print pdf with cmd command line and paper not A4 format · Issue #1834 then follow the link to #1812 for the more lengthy discussion but tl;dr look for the printerinformation tool it really is a great help.

You can even build and define your own custom papersizes as loosly explained later in comment-732309809 but they will have form numbers specific to each computer so less portable unless you write your own printer definition scripts to use with generic windows printui.

It is not a typo :grinning:

OK not a typo but trying to grasp the intermediate steps and desired outcome
FIT or SHRINK is likely to centre in the tall page as shown, to get it only at top then try none

Looking at the driver the default “should be” 104 x 300 (not the max 3000)

IF the desire is to print at the start of a 104mmx3000mm page then the “top” printer margin needs to be 0 and “bottom” printer margin 2853 or thereabouts ?

That needs to be defined in windows as a custom form for that printer with any name such as “kite tail”, then on CLI you can use paper=“kite tail”

HOWEVER if the desire is to only FEED a small page at start of 3m roll then the printers page size needs to be defined within 112mm x 150 or so depending on gripper margins

I don’t have a printer or suitable viewer do you have a link for xsoft documento ?

Yes you are right in everything.

But my problem is that i can print a page that is shorter (250mm minimum) or taller (there is no max size) it depends on the number of lines on the document.

For this particular printer and some brothers they only work with specific paper sizes (this printer the paper form name must end with [W40])

Before i print with sumatra i change the paper form size by code to the size i need but in this printer sometimes it loses the default paper size when i make that change (i don’t know why because i don’t change the paper form id).

If i set the paper form to 3000 and print the page at the top without the blank margin, the printer will only print the document without the bottom space.

That is why i was asking for a way to print without the top margin.


Without a means to view the output, I cannot see all the results of any changes
You show a pdf of result that suggests you are using a prn>pdf converter ?

That should not be a problem for the command line ? paper “A4 reduced [W40]” should be possible to define

That may be Windows printer nanny that always tidies up when your not looking.

Tell print manager to NOT manage printer settings, and let you decide what is default.

Set the W40 as default printer and its default page size “should” stick on next reboot.

I am not totally clear what you mean here, after print you WANT the extra 2850 mm to roll out ? IF so that is a printer FF Directive that would need an extra

copy xxx com1: (where xxx is a file with the correct control codes)

A 30 year old trick we used in DOS/Mac print shops HOWEVER beware the drivers “PAPER SAVING” check box is designed to NOT waste paper.

In sumatra if i print to a paper that has 3000, it will always center at the middle of the paper, and the printer will print ex 1200mm of blank paper, before it prints the document.

If i print the document from somewhere else, and set the document to be align to the top, the printer will not print any blank space, after the document. (this is what i was looking for to do in sumatra)

This question was, if in sumatra i was able to align to the top the print job, because this way i didn’t needed to change the paper size.

In this printer the default paper size (in the printer driver) i don’t know how it is saved.

If i remove a paper form and add a new one (by code) with the same name the printer loses the default paper size (but it works in the x86 version of the driver :thinking:).

If i update the paper form (by code) the printer sometimes loses the default paper size (but its working “most” of the times) (this is the way i am currently using it :exploding_head:).

SumatraPDF printing is “basic” it asks for the paper size then fits/shrinks/noscale to that given paper size (there is no positioning only rotate) the "defalt paper is the first size it gets and with GUI printing that can be altered but for CLI it needs the paper name to change size.

Position is determined by the driver paper margins hence my suggestion to use a large bottom margin.

With paper saving switched ON the printer should stop at the bottom of the print BUT SumatraPDF is probably filling that bottom area with white space, that would generally be good enough for sheet feed but on roll feed is unlikely to stop.

It is important in this case that a custom page size is used.

But I cant test how to force that without some means to see the results.

I cannot find a viewer for the Woosim Esc/P output (it is not recognised as epson code)
How did you get a pdf above showing the print in middle of a PDF page?

How did you make the pdf ? above which shows the printer output in middle of a 3000 PDF page?
Using MSpdf printer with 3000 page would NOT be same as 3000 roll printer in sheet cutting mode.

it is possible to SET different printer preferences then STORE each of those settings and reapply the required choice via command line just prior to CLI print so the result can be more consistent for each setting.
e.g. see Command Line Printer Control (

I can change with page size. So set it to A6 (or similar) then /Ss (save as)

RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n "woosim porti-w40" /a "A6.dat"

change page to for example A4 and /Ss (save as)

RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Ss /n "woosim porti-w40" /a "A4.dat"

then I can test each in turn to check it is working with /Sr (restore) and view preferences with /e

RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "woosim porti-w40" /a "a6.dat"
RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /e /n "woosim porti-w40"
RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "woosim porti-w40" /a "a4.dat"
RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /e /n "woosim porti-w40"
RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "woosim porti-w40" /a "a6.dat"
RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /e /n "woosim porti-w40"

then at run time I can use either #=4 or 6

RUNDLL32.EXE PRINTUI.DLL,PrintUIEntry /Sr /n "woosim porti-w40" /a "A#.dat"
Sumatrapdf.......-print-to "woosim porti-w40".....................

NOTE the shorter format
printui.exe /Sr /n "woosim porti-w40" /a "A#.dat"
does not work for me as unelevated user so beware UAC rights

let me give you sample documents

Has you can see each pdf has different sizes.
I cant work with predefined sizes, because each document has its own size.

My system is currently working
But with this particular printer and some brother only works most of the times

I was looking for a way to print without changing the paper form size, and one option was to align the print to the top.

SumatraPDF is not targeted at printing but viewing so relies hevily on defined pages.

The only way left I can think of is to try to ensure there is minimal interference.

IF the source INPUT is variable pages at true scale i.e… 104mm wide (or less) and ALWAYS taller than wide (but you started your query with A4 which would need a previous scaling step first to constrain at a reduced width)
THEN in advanced setting ENSURE

PrinterDefaults [
	PrintScale = none

then try command line

sumatrapdf -print-to "*roll printer*" -print-settings "noscale,portrait" "C:\Mytest file.pdf"

none and noscale should reduce attempting to fit to a page