html2canvas和jspdf模糊,低分辨率图像jspdf和Html2Canvas

我们在jsPDF和HTML2canvas的帮助下创建PDF。但图像分辨率有点高。低分辨率图像jspdf和Html2Canvas

有没有什么办法让使用jQuery,JavaScript中,jsPDF低分辨率图像和html2canvas

function addElement(element, doc, opt, newPage, callback) {

var thiscreen = element;

//Get the original background color.

var originalBGColor = thiscreen.style.backgroundColor;

//Change the background color of the element to desired color.

if (opt.bgColor)

thiscreen.style.backgroundColor = opt.bgColor;

var options = options || {};

options.elements = [thiscreen];

//Increment the in-progress counter.

counter++;

console.log('adding' + counter);

console.log(element);

//The complete callback method.

options.complete = setTimeout(function(images) {

//Decrement the in-progress counter since the image is successfully generated..

counter--;

console.log('complete' + counter);

console.log(element);

var queue = html2canvas.Parse(thiscreen, images, options),

canvas = html2canvas.Renderer(queue, options);

//Reset the background color.

thiscreen.style.backgroundColor = originalBGColor;

//Add the generated image to PDF document.

doc.addImage(canvas.toDataURL(), 'png', opt.x, opt.y, opt.width, opt.height);

//Call the callback method if any

if (callback) {

callback();

}

}, 500);

//Conver the html to PNG using html2canvas util.

html2canvas.Preload(thiscreen, options);

}

2016-01-21

Mukesh

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值