Closed changavila closed 5 years ago
hi @changavila I have the same requirement, did you find any solution?
Hi @demsey2,
This is possible by using .command('convert')
then from this convert it toBuffer('PDF' , function(err,buffer)
. Then from buffer you can write this to file, or upload buffer to s3 in my case.
You will have to use imagemagick here rather than using the graphicsmagick. To do this you must initialize graphicsmagick to:
const gm = require('gm').subClass({ imageMagick: true });
thanks a lot
@changavila Off topic but can you help me understand how you got gm to work on lambda? I have added the binaries and pointed the appPath to it but I get the error message that "binaries can't be found"
Sorry for the very delayed reply.
@puneeth8994 I think you don't need to add the binaries, since the AWS lambda has already imageMagick in it.
So i have a AWS lambda that gets the PDF buffer of the file from s3, and flattens the pdf to images, and write it back to the pdf the uploads it to S3. But with this, i can only process one page at a time. Is it possible to process all the pages at once then retrieve the all pages flattened in one PDF buffer?
This is my sample code snippet: