Coder Social home page Coder Social logo

rf-api-url2pdf's Introduction

Deprecated! Please use url2pdf3 which uses up to date technology and is mantained!

rf-api-url2pdf

Create a pdf from a website via given url, return the pdf file content as buffer. Take snapshots of multiple sites and merge the pdfs, when an array of urls is passed.

Getting Started

npm install rf-api-url2pdf

Init the service

var services: {
   getPdf: require('rf-api-url2pdf').start({
      saveDir: '/pdfTmp' // path where the pdfs are stored
   }).getPdf
}

Use the service

// simple example
service.getPdf( 'http://www.ebay.de', function(err, pdfBuffer){
   console.log(pdfBuffer);
})

// take a snapshot of multiple sites and join the pdfs
var urls = ['http://www.ebay.de', 'http://www.google.com'];

service.getPdf(urls, function(err, pdfBuffer){
   console.log(pdfBuffer);
})

// with rf-api
API.post('/pdf', function(req, res){
   service.getPdf('http://www.test.com', res.send);
})


// options
var options = {
   saveDir: '/exportTemp'  // optional alternativ path to create pdfs
   loadTimeout: 3000,      // timeout in [ms] to wait till site should be loaded
   onlyFilePath: false,    // only return path to pdf files, do not read them in
   buffer: false,          // false: return file content; true: return a buffer from binary file content
   debug: true             // optional show phantom debug messages
};
service.getPdf(urls, callback, options)

Development

Install the dev tools with

npm install

Then you can runs some test cases and eslint with:

npm test

Legal Issues

  • License: MIT
  • Author: Rapidfacture GmbH

rf-api-url2pdf's People

Contributors

felixfurtmayr avatar rf-alex avatar web-mi avatar

Watchers

Uli Köhler avatar James Cloos avatar  avatar Regina Galambos avatar  avatar

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.