{"_id":"@alvaromq/carbone","_rev":"1-41b8907a5803321533e3c2d0be766c27","name":"@alvaromq/carbone","dist-tags":{"latest":"3.3.0"},"versions":{"3.3.0":{"name":"@alvaromq/carbone","description":"Fast, Simple and Powerful report generator. Injects JSON and produces PDF, DOCX, XLSX, ODT, PPTX, ODS, ...!","version":"3.3.0","bin":{"carbone":"bin/carbone"},"main":"./lib","author":{"name":"David Grelaud"},"license":"Apache-2.0","homepage":"https://carbone.io","keywords":["report","document","pdf","xslx","docx","odt","ods","json"],"scripts":{"test":"node ./node_modules/mocha/bin/mocha test --timeout 100000 --exit","lint":"eslint ./lib/**.js ./test/**.js ./formatters/**.js","lint:fix":"eslint ./lib/**.js ./test/**.js ./formatters/**.js --fix","postpublish":"PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag $PACKAGE_VERSION && git push origin $PACKAGE_VERSION && git push github-origin $PACKAGE_VERSION"},"dependencies":{"dayjs":"=1.10.4","debug":"=4.1.1","timsort":"=0.3.0","which":"=2.0.2","yauzl":"=2.10.0","yazl":"=2.5.1"},"devDependencies":{"eslint":"=7.7.0","mocha":"=8.1.3"},"engines":{"node":">= 10.15.0"},"gitHead":"999918b966e9fa7d766c88d5dbda2cff92dcafd7","_id":"@alvaromq/carbone@3.3.0","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-dO3Kg8mwlQp0gqdBiYYUJ5e9Y3wnEAO5oPZ+0v3yhz3RuZ/a65rB1Ah0+G/RxsUNqjdgjF+GY2I7AGEFbkn8NA==","shasum":"6aed26c336c5a0e1f7223593886258097dfbeddd","tarball":"https://registry.npmjs.org/@alvaromq/carbone/-/carbone-3.3.0.tgz","fileCount":36,"unpackedSize":777084,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg58VlCRA9TVsSAnZWagAACqUQAINibOqoPwXjvRnBgSxJ\nVSpfs8cpoiOfDWq2CxbQ22Dy0SEogvxrWLoNbK8h7DkMXKbaVKtW1+P9hS2I\ng3q84661+yAWrz+JQFwXWHXt3//o/DO/p0dVDKCVYZpU9axTloDheJIkCZoD\nks/YLAOPLvY4o+ljlXjGzYH5YE7PtTGxs0WHlsZRThBTuAymfbuNOPGNGA8E\npTII0NT4rraULR5T2h9V4XEnKaScAKOqUauzUJgBUvSShhsjkfXOXSvGi06A\nCt/YgJoFRElkBGElSSVAGk0aK8GYcCgBz2gQMe+17LuCkcWtJDtHAstrFmD5\nZEpd+V3wQCs5dk6+eTv7n8O7mCX3c5hi3sL9AzDVLwTp1xk53ag2OncYC5mM\nhVlakHH7WHAFOGAkafsmy+44R7e0woHQn6eXcGhtbqi9UU8IxMyli4jAPOOb\nygd0k4aHVRPt76nYkPwad1wy5LYzxpg05sPErzNmIb/PLpWgwBncmvHAxN0p\ntWVvAtlG1npIoAS7hTCfJ0xxBLp77aMXfFKOm8y9RGtXsAHCfcw6EoGdFxMg\nTMC0jM1nIM5xMWY5kXza+16iWv2AmGB+oV+QdvdG+t79Iq0WJjyZbwcIRj7j\ngpvUj6DBlKMiJdwKfaxGdWGepRnSv9ENlfMBZ4A/DFb1xLFjl3VggJt4F/y1\naHwn\r\n=sdBt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAbbN4/WtU0lB5xO/hsMUexAsaHeBQWOtsJ1yMHx7TLwAiEA4LopIFsaG2ZgeK/UvAjM3yoRr2u5qj9i5Qyp5o1Kjcw="}]},"_npmUser":{"name":"alvaromq","email":"alvaro.mamani.qp@gmail.com"},"directories":{},"maintainers":[{"name":"alvaromq","email":"alvaro.mamani.qp@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/carbone_3.3.0_1625802084682_0.12250694044903176"},"_hasShrinkwrap":false}},"time":{"created":"2021-07-09T03:41:24.601Z","3.3.0":"2021-07-09T03:41:24.817Z","modified":"2022-04-04T13:41:46.213Z"},"maintainers":[{"name":"alvaromq","email":"alvaro.mamani.qp@gmail.com"}],"description":"Fast, Simple and Powerful report generator. Injects JSON and produces PDF, DOCX, XLSX, ODT, PPTX, ODS, ...!","homepage":"https://carbone.io","keywords":["report","document","pdf","xslx","docx","odt","ods","json"],"author":{"name":"David Grelaud"},"license":"Apache-2.0","readme":"<p align=\"center\">\n  <a href=\"https://carbone.io/\" target=\"_blank\">\n    <img alt=\"CarboneJS\" width=\"100\" src=\"https://carbone.io/img/favicon.png\">\n  </a>\n</p>\n\n<p align=\"center\">\n<a href=\"https://www.npmjs.com/package/carbone\">\n    <img src=\"https://badgen.net/npm/dt/carbone\" alt=\"npm badge\">\n  </a>\n  <a href=\"https://www.npmjs.com/package/carbone\">\n    <img src=\"https://badgen.net/npm/dm/carbone\" alt=\"npm badge\">\n  </a>\n  <a href=\"https://www.npmjs.com/package/carbone\">\n    <img src=\"https://badgen.net/npm/v/carbone\" alt=\"carbone version badge\">\n  </a><br/>\n  <a href=\"https://carbone.io/documentation.html\">\n    <img src=\"https://readthedocs.org/projects/ansicolortags/badge/?version=latest\" alt=\"documentation badge\">\n  </a>\n  <a href=\"https://bundlephobia.com/result?p=carbone\">\n    <img src=\"https://badgen.net/bundlephobia/minzip/carbone\" alt=\"minizip badge\">\n  </a>\n  <a href=\"https://hub.docker.com/r/carbone/carbone-env-docker\">\n    <img src=\"https://badgen.net/docker/pulls/carbone/carbone-env-docker?icon=docker\" alt=\"docker badge\">\n  </a>\n  <a href=\"https://github.com/carboneio/carbone\">\n    <img src=\"https://badgen.net/github/forks/carboneio/carbone?icon=github\" alt=\"github fork badge\">\n  </a>\n</p>\n\n\n\n<p><b>Fast, Simple and Powerful report generator</b> in any format PDF, DOCX, XLSX, ODT, PPTX, ODS, XML, CSV using your JSON data as input !</p>\n\nREADME language: 🇨🇳 [简体中文](./doc/README.zh-cn.md), 🇺🇸 [English](README.md)\n\n## Table of content\n\n<!-- MarkdownTOC -->\n\n- [Features](#features)\n- [How it works?](#how-it-works)\n- [Minimum Requirements](#minimum-requirements)\n    - [Optional](#optional)\n- [Getting started](#getting-started)\n  - [Basic sample](#basic-sample)\n  - [PDF generation, document conversion](#pdf-generation-document-conversion)\n- [More examples](#more-examples)\n- [API Reference](#api-reference)\n- [Command line tools](#command-line-tools)\n- [Issues](#issues)\n- [Roadmap](#roadmap)\n- [Performance](#performance)\n- [Licenses and editions](#licenses-and-editions)\n- [Philosophy](#philosophy)\n- [Contributors](#contributors)\n\n<!-- /MarkdownTOC -->\n\n## Features\n\n  - **Extremely simple** : Use only LibreOffice™, OpenOffice™ or Microsoft Office™ to draw your report\n  - **Unlimited design** : The limit is your document editor: pagination, headers, footers, tables...\n  - **Convert documents** : thanks to the integrated document converter\n  - **Unique template engine** : Insert JSON-like markers `{d.companyName}` directly in your document\n  - **Flexible** : Use any XML documents as a template: docx, odt, ods, xlsx, html, pptx, odp, custom xml files...\n  - **Future-proof** : A powerful XML-agnostic algorithm understands what to do without knowing XML document specifications\n  - **Multilingual** : One template, multiple languages. Update translation files automatically\n  - **Format data** : Use built-in date and number formatters or create your own in Javascript\n  - **Fast** : Manage multiple LibreOffice threads for document conversion, optimized code generation for each report\n\n## How it works?\n\nCarbone is a mustache-like template engine `{d.companyName}`.\n\nTemplate language documentation : https://carbone.io/documentation.html\n\n- The template can be any XML-document coming from LibreOffice™ or Microsoft Office™  (ods, docx, odt, xslx...)\n- The injected data must be a JSON object or array, coming directly from your existing APIs for example\n\nCarbone analyzes your template and inject data in the document. The generated document can be exported as is, or converted to another format (PDF, ...) using LibreOffice if it is installed on the system.\nCarbone is working only on the server-side.\n\n\n## Minimum Requirements\n\n- NodeJS 10.x+\n- Runs on OSX, Linux (servers and desktop), and Windows\n\n#### Optional\n\n- LibreOffice server if you want to use the document converter and generate PDF. Without LibreOffice, you can still generate docx, xlsx, pptx, odt, ods, odp, html as long as your template is in the same format.\n\n\n## Getting started\n\n### Basic sample\n\n1 - Install it\n\n```bash\n  npm install carbone\n```\n\n2 - Copy-paste this code in a new JS file, and execute it with node\n\n```javascript\n  const fs = require('fs');\n  const carbone = require('carbone');\n\n  // Data to inject\n  var data = {\n    firstname : 'John',\n    lastname : 'Doe'\n  };\n\n  // Generate a report using the sample template provided by carbone module\n  // This LibreOffice template contains \"Hello {d.firstname} {d.lastname} !\"\n  // Of course, you can create your own templates!\n  carbone.render('./node_modules/carbone/examples/simple.odt', data, function(err, result){\n    if (err) {\n      return console.log(err);\n    }\n    // write the result\n    fs.writeFileSync('result.odt', result);\n  });\n```\n\n### PDF generation, document conversion\n\nCarbone uses efficiently LibreOffice to convert documents. Among all tested solutions, it is the most reliable and stable one in production for now.\n\nCarbone does a lot of thing for you behind the scene:\n\n- starts LibreOffice in \"server-mode\": headless, no User Interface loaded\n- manages multiple LibreOffice workers to maximize performance (configurable number of workers)\n- automatically restarts LibreOffice worker if it crashes or does not respond\n- job queue, re-try conversion three times if something bad happen\n\n\n##### 1 - install LibreOffice\n\n###### on OSX\n\n- Install LibreOffice normally using the stable version from https://www.libreoffice.org/\n\n###### on Ubuntu Server & Ubuntu desktop\n\n> Be careful, LibreOffice which is provided by the PPA libreoffice/ppa does not bundled python (mandatory for Carbone). The best solution is to download the LibreOffice Package from the official website and install it manually:\n\n```bash\n  # remove all old version of LibreOffice\n  sudo apt remove --purge libreoffice*\n  sudo apt autoremove --purge\n\n  # Download LibreOffice debian package. Select the right one (64-bit or 32-bit) for your OS.\n  # Get the latest from http://download.documentfoundation.org/libreoffice/stable\n  # or download the version currently \"carbone-tested\":\n  wget https://downloadarchive.documentfoundation.org/libreoffice/old/7.0.4.2/deb/x86_64/LibreOffice_7.0.4.2_Linux_x86-64_deb.tar.gz\n\n  # Install required dependencies on ubuntu server for LibreOffice 7.0+\n  sudo apt install libxinerama1 libfontconfig1 libdbus-glib-1-2 libcairo2 libcups2 libglu1-mesa libsm6\n\n  # Uncompress package\n  tar -zxvf LibreOffice_7.0.4.2_Linux_x86-64_deb.tar.gz\n  cd LibreOffice_7.0.4.2_Linux_x86-64_deb/DEBS\n\n  # Install LibreOffice\n  sudo dpkg -i *.deb\n\n  # If you want to use Microsoft fonts in reports, you must install the fonts\n  # Andale Mono, Arial Black, Arial, Comic Sans MS, Courier New, Georgia, Impact,\n  # Times New Roman, Trebuchet, Verdana,Webdings)\n  sudo apt install ttf-mscorefonts-installer\n\n  # If you want to use special characters, such as chinese ideograms, you must install a font that support them\n  # For example:\n  sudo apt install fonts-wqy-zenhei\n```\n\n##### 2 - generate PDF\n\nAnd now, you can use the converter, by passing options to render method.\n\n> Don't panic, only the first conversion is slow because LibreOffice must starts\n> Once started, LibreOffice stays on to make new conversions faster\n\n```javascript\n  var data = {\n    firstname : 'John',\n    lastname : 'Doe'\n  };\n\n  var options = {\n    convertTo : 'pdf' //can be docx, txt, ...\n  };\n\n  carbone.render('./node_modules/carbone/examples/simple.odt', data, options, function(err, result){\n    if (err) return console.log(err);\n    fs.writeFileSync('result.pdf', result);\n    process.exit(); // to kill automatically LibreOffice workers\n  });\n```\n\n\n## More examples\n\n##### Nested repetition in a docx document and spreadsheet\n\n```javascript\n\n  var data = [\n    {\n      movieName : 'Matrix',\n      actors    : [{\n        firstname : 'Keanu',\n        lastname  : 'Reeves'\n      },{\n        firstname : 'Laurence',\n        lastname  : 'Fishburne'\n      },{\n        firstname : 'Carrie-Anne',\n        lastname  : 'Moss'\n      }]\n    },\n    {\n      movieName : 'Back To The Future',\n      actors    : [{\n        firstname : 'Michael',\n        lastname  : 'J. Fox'\n      },{\n        firstname : 'Christopher',\n        lastname  : 'Lloyd'\n      }]\n    }\n  ];\n\n  carbone.render('./node_modules/carbone/examples/movies.docx', data, function(err, result){\n    if (err) return console.log(err);\n    fs.writeFileSync('movies_result.docx', result);\n  });\n\n  carbone.render('./node_modules/carbone/examples/flat_table.ods', data, function(err, result){\n    if (err) return console.log(err);\n    fs.writeFileSync('flat_table_result.ods', result);\n  });\n```\n\n\n## API Reference\n\nTo check out the **[api reference](https://carbone.io/api-reference.html#carbone-js-api)** and the **[documentation](https://carbone.io/documentation)**, visit [carbone.io](http://carbone.io).\n\n\n## Command line tools\n\nTo checkout out the Carbone CLI documentation, visit [carbone.io](https://carbone.io/api-reference.html#cli)\n\n## Issues\n\nIf you're facing any issues, search a similar issue to ensure it doesn't already exist on [Github](https://github.com/carboneio/carbone/issues). Otherwhise, [create an issue to help us](https://github.com/carboneio/carbone/issues/new/choose).\n\n## Roadmap\n\nThe roadmap is pinned on the github issues list.\n\n## Performance\n\nReport generation speed (without network latency), using a basic one-page DOCX template:\n\n  - ~ `10 ms / report` without document conversion (analyzing, injection, rendering)\n  - ~ `50 ms / report` with a PDF conversion (100 loops, 3 LibreOffice workers, without cold-start)\n\nOn a MacBook Pro Mid-2015, 2,2 Ghz i7, 16Go.\n\n## Licenses and editions\n\nThere are two editions of Carbone:\n\n- Carbone Community Edition is available freely under the **Apache v2 license**\n- Carbone Enterprise Edition (hosted and on-premise) includes extra features like a user interface.\n\nWe want to follow the model of Gitlab. **The free version must be and must stay generous.**\n\n\n## Philosophy\n\n> Our ultimate goal\n\n2% percent of our hosted solution revenues will go to charity in three domains: open source software we love, education and environment.\n\nWe already know that beneficiaries will be, at least :heart:\n- LibreOffice foundation\n- PostgreSQL foundation\n- An innovative child school in France\n\n## Contributors\n\nThanks to all Carbone contributors (random order)\n\n  - Florian Bezagu\n  - Matthieu Robin\n  - Arnaud Lelièvre\n  - Maxime Vincent\n  - Enzo Ghemard\n  - Jordan Nourry\n  - Etienne Rouillard\n  - Guillaume Chevaux\n  - Fabien Bigant\n  - Maxime Magne\n  - Vincent Bertin\n  - Léo Labruyère\n  - Aurélien Kermabon\n  - [Steeve Payraudeau](https://github.com/steevepay)","readmeFilename":"README.md"}