Closed santillaner closed 4 years ago
Hi @santillaner, You are right at the time you can only pass the Ghostscript command that use the path of the file. This is a limitation of the high level C API of Ghostscript. Anyway your proposal is very interesting so please if you have time could you post some usage examples? For the next major version was my intention use the buffer as input, but maybe we can integrate the stream api. Nick
We currently use GS, and our usage pattern is:
var gs=require("child_process").spawn("gs", "-q -sstdout=/dev/null -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=- -c .setpdfwrite -".split(" "))
//now pipe your input, maybe coming from http, to stdin:
someOutputStream.pipe(gs.stdin)
//and pipe output
gs.stdout.pipe(someInputStream)
Ok thanks for your reply. I think that the update will take some times, so when all is complete I will close the issue.
Hi,
Is the buffer option available ? I want to process a buffer (coming from an url with fetch.buffer() ), compress a PDF and output to another buffer.
Is that possible ?
Hi @glococo, it's not possible pass buffer or stream for now.
@NickNaso any progress or maybe workarounds how to make it work with buffer or stream?
@santillaner can you provide working snippet, please?
Hi @NickNaso,
Do we have buffer option available in ghostscript ? I have a pdf buffer, want to compress and return compressed pdf buffer as response.
Is that possible ?
It would be very helpful for me.
Please help me on this.
Current API seems to allow only for using filesystem for I/O. I am currently spawning GS with child_process.spawn and piping files in & out, like in:
gs -q -sstdout=/dev/null -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=- -c .setpdfwrite -
¿Is there a way to use streaming?
thnx!