Closed ghost closed 3 years ago
This module it's a wrapper for Sumatra PDF, you can check the available options through command line args here. Answering your question, Sumatra PDF doesn't provide a way to set a custom size of the paper. However, if you don't assign a predefined paper size, the module will use the paper size of the current PDF document do you want to print.
In my case for example, I have an app that prints labels with a size of 150mm x 100mm, or in some cases, a size of 100mm x 100mm. This labels are printed by Zebra label printers. Those printers have its own paper configuration (through the printer driver settings), and in my case only need to set the document and the printer, and some other parameters to adjust the content to the paper setted into the printer driver configuration panel:
import { CmdPrinter, CmdQueue } from 'cmd-printer';
export async function main(): Promise<void> {
// Get the Zebra printer
const printers = await CmdPrinter.getAll();
const printer = printers.find(x => x.name === 'Zebra Printer 01');
// Create a new CmdQueue instance
const cmd = new CmdQueue({
printTo: printer, // Set the zebra printer here
scale: 'fit' // Size adjustment
});
// Print the document
await cmd.print([ './test/100x150.pdf' ]);
}
If you need to print a document with a custom paper size:
Hi, I was wondering is it possible to provide format/slize of the paper in numeric value, like for example I want it to be 55x35mm?