NickNaso / ghostscript4js

Ghostscript4JS binds the Ghostscript C API to the Node.JS world.
http://www.nacios.it
Apache License 2.0
68 stars 19 forks source link

.execute()\.executeSync() functions are ignoring the first parameter #59

Closed Alcoine closed 2 months ago

Alcoine commented 4 years ago

Hi there! I'm trying to execute gs with the following properties -r500 -dNOPAUSE -sDEVICE=png16m -dBATCH -o <path> <path> and I constantly getting a low resolution images. After a couple of hours, I figure out that .execute() function ignoring the first parameter (in that case -r500). I've changed the order to the following -dNOPAUSE -r500 -sDEVICE=png16m -dBATCH -o <path> <path> and the images resolution was fine. As I see in docs we have a double call of -sDevice gs.executeSync('-sDEVICE=pngalpha -o my.png -sDEVICE=pngalpha -r144 my.pdf') and that part doesn't make any sense for me either. Why we have a double -sDevice call? Is that a feature or a bug? Could someone please explain it to me? Thank you.

svrnwnsch commented 4 years ago

I can confirm that for me the first flag is ignored therefore I double the first flag. I would assume that this has to do something with the c code here https://github.com/NickNaso/ghostscript4js/blob/487c784244274cd4f19140dee774e83098f29296/src/ghostscript4js.cc#L78 which has as the first argument some integer.

Zloka commented 4 years ago

Yeah, this seems to be the case for me too. Not exactly hard to work around, but can cause quite a bit of confusion depending on what the first flag is. In my case, -dNOPAUSE was ignored, which is quite crucial for my use-case.

NickNaso commented 2 months ago

I'm closing because this isue seems to be solved now.