Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jsPDF adjust the text-line spacing

In the jsPDF's documentation I can't find a method or a function to increase space between text-lines. I was wondering if somebody knowledgeable would nod mind sharing a bit of his/her knowledge :). Thanks much.

like image 915
Nactus Avatar asked Aug 29 '13 23:08

Nactus


1 Answers

You can also add parameters in the jsPDF constructor:

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

From jsPDF code (function 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
like image 160
Henrik Perrochon Avatar answered Sep 18 '22 00:09

Henrik Perrochon