Comments (2)
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.
from pdf2image.
Related Issues (20)
- Api params for options?
- .setGMClass(true).bulk(-1, false) HOT 1
- Can not use fromPath with an absolute url HOT 1
- Command failed: gm convert: Unable to open file (C:\Windows\TEMP\gmQXbr1D) [No such file or directory]. HOT 4
- Pdf buffer to image buffer
- More info about params HOT 2
- Error write epipe Windows 10 HOT 5
- Density option is broken. HOT 3
- YOU DONT NEED THIS LIBRARY HOT 1
- bulk in version 2.2.0 HOT 2
- Convert buffer to base64 HOT 2
- Timestamp included in the base64 response HOT 1
- problem canvas HOT 3
- stream operator isn't terminated by valid EOL HOT 3
- Breaking Types HOT 1
- Error on processing more than 10 pages HOT 2
- Get image the same dimension as pdf HOT 2
- width and height should be allowed to be excluded (no defaults) HOT 1
- Unable to create image buffer from pdf buffer HOT 6
- Remove .page-number from the saved filename HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf2image.