javascript - jsPDF调整文本行间距

标签 javascript jquery jspdf

在 jsPDF 的 documentation 中我找不到增加文本行之间空间的方法或函数。我想知道是否有知识渊博的人会点头分享他/她的一些知识:)。非常感谢。

最佳答案

你也可以在jsPDF构造函数中添加参数:

file = new jsPDF({orientation: "p", lineHeight: 1.5)})

来自 jsPDF 代码(函数 jsPDF(orientation, unit, format, compressPdf)):

var options = {};

if (typeof orientation === 'object') {
    options = orientation;

    orientation = options.orientation;
    unit = options.unit || unit;
    format = options.format || format;
    compressPdf = options.compress || options.compressPdf || compressPdf;
}

// Default options
unit = unit || 'mm';
format = format || 'a4';
orientation = ('' + (orientation || 'P')).toLowerCase();

var format_as_string = ('' + format).toLowerCase(),
    compress = !!compressPdf && typeof Uint8Array === 'function',
    textColor = options.textColor || '0 g',
    drawColor = options.drawColor || '0 G',
    activeFontSize = options.fontSize || 16,
    lineHeightProportion = options.lineHeight || 1.15,
    lineWidth = options.lineWidth || 0.200025; // 2mm

关于javascript - jsPDF调整文本行间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18522323/

相关文章:

javascript - 如果其中的 header 标记为空,则隐藏一个 div?

javascript - 如何使用 Node Express JS 获取完整的 url 并发送到其他 js 页面

javascript - 在 Node.js 中顺序运行代码

jquery - 如何使轮播在此 Shopify 主题中自动滚动?

javascript - Ajax 响应不会在 php while 循环中更新

javascript - jspdf/pdfmake 创建 PDF 与将页面打印为 PDF 的好处?

angular - CodeSandBox:Angular:错误类型错误:html2canvas_1.default 不是函数

javascript - 网站如何使元素在所有设备上的缩放比例相同并在缩放时缩放?

Javascript jQuery 插件 DataTables 取消选择元素

angular6 - 如何将角度页面导出为多页 pdf