0.1.5 • Published 11 years ago
pdfmiweb-pdf-client v0.1.5
pdfmiweb-pdf-client
Client for Node.js to use pdfmiweb API service. For more informacion go to http://pdfmiweb.com/api
##Usage:
npm install pdfmiweb-pdf-client
var PDFClient = require('pdfmiweb-pdf-client');
var PDF = new PDFClient("http://api.pdfmiweb.com", "[[YOUR APPID]]", "[[YOUR APIKEY]]")
###Creating PDFs
Only creates PDFs in API server. for get it use PDF.get()
PDF.create({webPage: "http://www.google.com"}, function (errCreate, resCreate) {
if (resCreate.body) {
console.log("API says PDF has been created :)");
} else {
console.log("API says PDF has not been created :(");
}
});
###Getting PDFs
//You can get a PDF as stream and do what you want:
PDF.get({webPage: "http://www.google.com"}, function (res, stream) {
//Its an stream, do what you want!
});
//Or use in tandem with `PDF.save()` to store locally:
PDF.get({webPage: "http://www.google.com"}, function (res, stream) {
PDF.save(stream, "path/to/save/a-name-for-this.pdf", function (errSave, filepath) {
if (errSave) throw errSave;
console.log("PDF has been written in " + filepath);
});
});