Forum moved here!

Home / Command line printing is misaligned

Kor

Greetings!

I’m having this little problem, maybe I’m doing something wrong, I don’t know, but when I print a PDF file using the dialog it works well, but when I send it through command line I’ve got it misaligned.

Here’s my scenario: My generated PDF file is 85mm x 55mm. It must be printed on a card that size. Using the dialog window, it prints it correctly. But printed through command line, it doesn’t.

My command line is: SumatraPDF.exe -print-to-default -print-settings “fit” <PDF_FILE_HERE>

I guess FIT is the option I need it. I changed it into the SumatraPDF-settings.txt as well in the section PrinterDefaults [PrintScale = shrink] (this is the default I changed it to “fit”)

Unfortunatelly nothing seems to be working. I’d appreciate any assistance you may provide.

Thank you.

GitHubRulesOK

Generally everything should be alright, however
for a non standard (not letter or A4) paper it is important that the “default printer” is set to the custom size as in basic terms when SumatraPDF tells Windows to “fit to page” Windows looks at the paper size and responds accordingly, otherwise if Windows is set to say A4 by default problems arise.
equally if SumatraPDF tries to not scale and the page is Letter size there will likely be a mismatch on where the data is placed thus often missing the desired smaller print window (pun)

an often used business trick is to have a duplicate print driver set by default to to the desired “custom” page so in your case name it 85x55 then use -print-to 85x55 for those jobs and leave the default for others to mess with

Kor

Thank you for taking time in answering my post.

The thing is that the default printer is a specific printer that prints only cards. So, there’s a standard for the paper, which in this case, is a plastic card with the dimensions previously set. My gerenerated PDF has the exact dimensions. I guess, maybe, I need to create a customized paper in the Windows Printer Server and set it as Standard for the printer. Anyways, I’ll just keep trying to solve this.

Once again, thank you.

GitHubRulesOK

@Kor given the PDF page and default print page should be matched at the same size,
I would first replace the “fit” on the command line with “noscale” and see if that works

Kor

@GitHubRulesOK The “noscale” worked! Thanks man!