node-pdf-image icon indicating copy to clipboard operation
node-pdf-image copied to clipboard

Handling Streams instead/complementary of files

Open rbecheras opened this issue 10 years ago • 5 comments

Get a readable stream (pdf) and return an other readable (png) to let developer pipe it in the writable of its choice.

I am working on it for my own need, but it need a re-design of the core abstracting the conversion and providing methods to configure input and output types (files or streams).

Did you already worked on it or not at all ? Do you want pull requests when I will achieve it, or you prefer it stay in my fork ?

rbecheras avatar Jul 01 '15 09:07 rbecheras

Or do you want we release it together ?

rbecheras avatar Jul 01 '15 09:07 rbecheras

I'm very sorry for my late response @rbecheras. I've taken a bit long holiday.

Streaming input/output is a very good idea. I've not worked on that, but patches are welcome!

BTW, I found a module imagemagick-stream (https://github.com/eivindfjeldstad/imagemagick-stream), which may meet your need. Have you checked?

mooz avatar Jul 20 '15 01:07 mooz

What happend to this? @mooz @rbecheras?

Does this library support stream processing?

I like to use it in combination with multer s3 stream upload to generate a preview of an PDF as thumbnail. Is this anyhow possible?

manuelfink avatar Feb 03 '17 20:02 manuelfink

Just for the benefit of others coming here with a similar requirement, I used the following (imperfect) process for getting a Buffer into pdf-image and working with the output via temp-write:

const fs = require('fs');
const tempWrite = require('temp-write');
const PDFImage = require("pdf-image").PDFImage;
const filepath = tempWrite.sync('unicorn');

const Body = new Buffer(...)

fs.writeFileSync(filepath, Body);
var PDFImage = require("pdf-image").PDFImage;
var pdfImage = new PDFImage(filepath, options);

pdfImage.convertPage(0).then(function (imagePath) {...

shanehandley avatar Jul 06 '17 03:07 shanehandley

@manuelfink Hey:) Have you found a good solution for your use-case, I currently face the same issue.

tobiasgruber-at avatar Feb 27 '19 15:02 tobiasgruber-at