Coder Social home page Coder Social logo

File stream option about pdf2image HOT 2 CLOSED

yakovmeister avatar yakovmeister commented on June 3, 2024
File stream option

from pdf2image.

Comments (2)

yakovmeister avatar yakovmeister commented on June 3, 2024

Hi,

As of now, there's no option for you to have a Stream or Buffer as response. However, the lib already supports base64 as response. The snippet below is an example on how to convert pdf to base64 image. Please let me know if it still is not enough. Thanks.

const PDF2Pic = require("pdf2pic");

const pdf2pic = new PDF2Pic({
  density: 100,           // output pixels per inch
  savename: "untitled",   // output file name
  savedir: "./images",    // output file location
  format: "png",          // output file format
  size: "600x600"         // output size in pixels
});

pdf2pic.convertToBase64("path/to/pdf/sample.pdf").then((resolve) => {
  if (resolve.base64) {
    console.log("image converter successfully!");

    // assuming you're using some ORM to save base64 to db
    return db.model.table('users').update({id: "1", image: resolve.base64});
  }
});

from pdf2image.

DivekJohns avatar DivekJohns commented on June 3, 2024

from pdf2image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.