如题,满足业务需求,生成合同啦,生成报表啦,巴拉巴拉巴拉拉~ 知道的麻烦告诉下呗~ 我只知道mht的文件可以用word打开,但是我不知道how to 生成mht啊 = =
10 回复
canvas https://github.com/learnboost/node-canvas var Canvas = require(‘canvas’) , canvas = new Canvas(400, 200, ‘pdf’) , ctx = canvas.getContext(‘2d’) , fs = require(‘fs’);
var y = 80 , x = 50;
ctx.font = '22px Helvetica’; ctx.fillText('node-canvas pdf’, x, y);
ctx.font = '10px Arial’; ctx.fillText('Just a quick example of PDFs with node-canvas lonso’, x, y += 20);
ctx.globalAlpha = .5; ctx.fillRect(x, y += 20, 10, 10); ctx.fillRect(x += 20, y, 10, 10); ctx.fillRect(x += 20, y, 10, 10);
fs.writeFile('out.pdf’, canvas.toBuffer());