Open TanguyDuponchelle opened 2 years ago
Hi @Dr-NULL , yes i have the same problem, any idea?
Hi:
I'm trying to reproduce the error, but i don't have problems using the library. I need more details about your projects:
tsconfig.json
?If this can help for your, my tsconfig.json
in my testing project is this:
{
"compilerOptions": {
"target": "ES2022",
"module": "CommonJS",
"rootDir": "./src",
"outDir": "./dist",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": "Node",
"strict": true
}
}
In my case, using windows 10, and node v16.13.0, the definitions works as expected: https://user-images.githubusercontent.com/44485010/160396393-bab781a7-6d63-418d-97fd-9fb1a52ed134.mp4
Re, thx for your quick reply, I'm not using typescript, I tried a simple js file that I launch with node, i'm just testing it before implementing it in my electron project.
I tried again with an example similar to yours, but I still have the issue :
As soon as I remove it, I can print :o
I don't have any clue from where it comes...
My index.js :
const {CmdPrinter, CmdQueue} = require('cmd-printer')
const path = require('path')
const os = require('os')
const folder = path.join(os.homedir(), "Desktop")
const filename = path.join(folder, '27.pdf')
async function main() {
const printers = await CmdPrinter.getAll()
const printerId = printers.find(x => x.name === 'DP-DS620')
const cmd = new CmdQueue({
orientation: 'landscape',
printTo: printerId
});
await cmd.print([filename])
}
main()
My package.json :
{
"name": "nodeprintertest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"cmd-printer": "^1.1.0"
}
}
The problem doesn't seems to be related about typescript...
"Desktop"
)..\sumatra-pdf-x64.exe -silent -print-to "DP-DS620" -print-settings "landscape" ".\27.pdf"
Tell me if this works.
I tried :
.\sumatra-pdf-x64.exe -silent -print-to "DP-DS620" -print-settings "landscape" ".\27.pdf"
It didn't work,
when I removed the print settings it printed :o
I tried another setting ( "monochrome") and it worked
I also tried with another printer ( just in case, but it didn't work either)
The problem seems to be SumatraPDF, try this:
"sumatra-pdf.exe"
."Desktop"
folder..\sumatra-pdf.exe -silent -print-to "DP-DS620" -print-settings "landscape" ".\27.pdf"
If the problem will be solved, I'll launch an update with the latest SumatraPDF binaries.
Also, if is possible, send me the file do you want to print.
Hello, I tried with current release, it still has same issue. I tried with different files (jpg, png, pdf) I always have the same issue : I can't use landscape or portrait options.
That's weird, because I can print in landscape using this library as well I can print in same configuration using SumatraPDF command line interface. Try with SumatraPDF executable file with this file: done.pdf
well I can print with the .exe but when I change the orientation it remains the same print (maybe it's because this printer is a photo printer) paper format is 6x4
Do you have another printer to test? I use this package to print PDF in label printers and I don't have problen changing the orientation of the document.
Hello, i've some troubles to set a custom orientation 'portrait' or 'landscape' in my print settings.
Do you have any idea, why can't i set it?
currently working on windows 10, node v16.14.2