webimgpdf-convert

0.0.1 • Public • Published

webimgpdf-convert

网页,html,pdf,图片互转

Dependencies

使用前安装配置phantomjs环境

安装请参考 http://phantomjs.org/download

Installation

npm

npm install webimgpdf-convert

yarn

yarn add webimgpdf-convert 

Usage

const path = require('path');
const wip = require('webimgpdf-convert');
const web = 'https://www.baidu.com';
 
const pdf = path.join(process.cwd(),'a.pdf');
const img = path.join(process.cwd(),'a.jpg');
const html = path.join(process.cwd(),'a.html');
 
//将网页转成pdf
wip.webToPdf(web, pdf);
 
//将网页转成img
wip.webToImg(web, img);
 
//将html转成pdf
wip.htmlToPdf(html, pdf);
 
//将html转成img
wip.htmlToImg(html, img);

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i webimgpdf-convert

      Weekly Downloads

      3

      Version

      0.0.1

      License

      ISC

      Unpacked Size

      5.61 kB

      Total Files

      10

      Last publish

      Collaborators

      • zhuanglunzhi