Link Search Menu Expand Document

breaklines - Javascript-Snippets

PDF from HTML Template sample in Javascript-Snippets demonstrating ‘breaklines’

breaklines.desc.txt
<code>breaklines</code> that converts line breaks in text into HTML line breaks for display on a webpage.
Inserts breaklines that you can use like this: <code>${{breaklines macros}}</code>
breaklines.txt
Handlebars.registerHelper('breaklines', function (text) {
    text = Handlebars.Utils.escapeExpression(text);
    text = text.replace(/(\n|\r)/gm, '<br />');
    return new Handlebars.SafeString(text);
});

PDF.co Web API: the Web API with a set of tools for documents manipulation, data conversion, data extraction, splitting and merging of documents. Includes image recognition, built-in OCR, barcode generation and barcode decoders to decode bar codes from scans, pictures and pdf.

Get your PDF.co API key here!

Download Source Code (.zip)

return to the previous page explore PDF from HTML Template endpoint