Link Search Menu Expand Document

getFinalAmount - Javascript-Snippets

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

getFinalAmount.desc.txt
<code>getFinalAmount</code> calculates the final amount by adding up the price of all items and the freight charges.
Inserts getFinalAmount that you can use like this: <code>${{getFinalAmount items freight}}</code>
getFinalAmount.txt
Handlebars.registerHelper('getFinalAmount', function (items, freight) {
    var total = 0;
    items.forEach(function (line) {
        total += line.quantity * line.price;
    });
    return total + freight;
});

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