New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ht-pdf

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ht-pdf

use phantomjs and use image in header content

latest
Source
npmnpm
Version
1.0.12
Version published
Maintainers
1
Created
Source

#使用说明

var pdf = require("ht-pdf");

头部 底部 img 必须是 base64

pdf.create(html,options).toFile(filename,callback);
pdf.create(html,options).toBuffer(callback);

callback has two argument 1、错误 2、pdf 3、pdf 的 张数

var pdf = require("../");
var fs = require("fs");
var html = fs.readFileSync(__dirname+"/a.html").toString();
var opts = {
	width: "1060px",
	height: "1500px",
	type: "pdf",
	phantomPath: "/usr/local/bin/phantomjs",
	margin: {
		top: "30px",
		left: "35px",
		right: "15px",
		bottom: "0px"
	},
	timeout: 15000,
	header: {
		height: "315px",
		contents: null
	},
	footer: {
		height: "124px",
		contents: null
	}
};

pdf.create(html, opts).toBuffer(function(err,res,total){
	console.log(total)
})

###1.0.10 增加新页码字段 {{pagenum}} 从1开始

###1.0.7

增加了起始页码 影响字段{{page}} options.start = 10 默认是 0

###1.0.5 获得 html 结构中 所有 class="getHeight" 的 clientHeight;

   pdf.create(html,opts).getHeight(function(){
	console.log(arguments);
})

Keywords

pdf

FAQs

Package last updated on 21 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts