All Projects → carboneio → carbone

carboneio / carbone

Licence: Apache-2.0 license
Fast and simple report generator, from JSON to pdf, xslx, docx, odt...

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to carbone

Carbone
Fast and simple report generator, from JSON to pdf, xslx, docx, odt...
Stars: ✭ 487 (-39.88%)
Mutual labels:  multilingual, template-engine, libreoffice, pdf-generation
opentbs
With OpenTBS you can merge OpenOffice - LibreOffice and Ms Office documents with PHP using the TinyButStrong template engine. Simple use OpenOffice - LibreOffice or Ms Office to edit your templates : DOCX, XLSX, PPTX, ODT, OSD, ODP and other formats. That is the Natural Template philosophy.
Stars: ✭ 48 (-94.07%)
Mutual labels:  template-engine, libreoffice, microsoft-office
Etherpad Lite
Etherpad: A modern really-real-time collaborative document editor.
Stars: ✭ 11,937 (+1373.7%)
Mutual labels:  libreoffice, pdf-generation
Fastreport
Free Open Source Reporting tool for .NET6/.NET Core/.NET Framework that helps your application generate document-like reports
Stars: ✭ 1,688 (+108.4%)
Mutual labels:  pdf-generation, report-generator
Aws Lambda Libreoffice
85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli
Stars: ✭ 145 (-82.1%)
Mutual labels:  libreoffice, pdf-generation
Elefant
Elefant, the refreshingly simple PHP CMS and web framework.
Stars: ✭ 188 (-76.79%)
Mutual labels:  multilingual, template-engine
api2pdf.php
PHP client library for the Api2Pdf.com REST API - Convert HTML to PDF, URL to PDF, Office Docs to PDF, Merge PDFs, HTML to Image, URL to Image, HTML to Docx, HTML to Xlsx, PDF to HTML, Thumbnail preview of office files
Stars: ✭ 42 (-94.81%)
Mutual labels:  libreoffice, pdf-generation
Task2pdf
Kanboard - Task2PDF
Stars: ✭ 48 (-94.07%)
Mutual labels:  pdf-generation
designing-with-libreoffice
The work to translate Designing with LibreOffice book into traditional Chinese.
Stars: ✭ 17 (-97.9%)
Mutual labels:  libreoffice
alfresco-share-online-edition-addon
Online edition with Libreoffice in Alfresco Share
Stars: ✭ 15 (-98.15%)
Mutual labels:  libreoffice
esh
Simple templating engine based on shell.
Stars: ✭ 165 (-79.63%)
Mutual labels:  template-engine
Version3
Version 3 of Chem4Word - A Chemistry Add-In for Microsoft Word
Stars: ✭ 53 (-93.46%)
Mutual labels:  microsoft-office
convert-document
A docker container for LibreOffice and unoconv, used to generate PDF files from office-type documents.
Stars: ✭ 53 (-93.46%)
Mutual labels:  libreoffice
FastReport.Documentation
FastReport Open Source Documentation
Stars: ✭ 81 (-90%)
Mutual labels:  report-generator
clj-pdf-markdown
Library for rendering markdown to clj-pdf data-structure syntax.
Stars: ✭ 20 (-97.53%)
Mutual labels:  pdf-generation
easy-resume
🎉 A less is more online resume editor!
Stars: ✭ 116 (-85.68%)
Mutual labels:  pdf-generation
CellReport
CellReport 是一个netcore实现的、以复杂统计报表为核心目标的制作、运行工具。支持数据看板、大屏制作。你可以使用数据库、excel文件、api服务、已有报表等为数据源,通过内置的集合函数组织数据,以类excel界面设计最终呈现结果。
Stars: ✭ 196 (-75.8%)
Mutual labels:  report-generator
i18n-language.js
i18n-language.js is Simple i18n language with Vanilla Javascript
Stars: ✭ 21 (-97.41%)
Mutual labels:  multilingual
babl
JSON templating on steroids
Stars: ✭ 29 (-96.42%)
Mutual labels:  template-engine
pypugjs
PugJS syntax adapter for Django, Jinja2 and Mako templates
Stars: ✭ 237 (-70.74%)
Mutual labels:  template-engine

CarboneJS

npm badge npm badge carbone version badge
documentation badge minizip badge docker badge github fork badge

Fast, Simple and Powerful report generator in any format PDF, DOCX, XLSX, ODT, PPTX, ODS, XML, CSV using your JSON data as input !

README language: 🇨🇳 简体中文, 🇺🇸 English

NEWS ⚡️

Some people ask us if the community edition is still maintained. Yes, of course! Lately we have prioritized our development for the Enterprise Edition. We have made a lot of code refactoring in Carbone v4. And we need some time to change the method to update the community edition. It will be done this summer 2022. Feel free to contact us on the chat if you need further information on https://carbone.io/

Table of content

Features

  • Extremely simple : Use only LibreOffice™, OpenOffice™ or Microsoft Office™ to draw your report
  • Unlimited design : The limit is your document editor: pagination, headers, footers, tables...
  • Convert documents : thanks to the integrated document converter
  • Unique template engine : Insert JSON-like markers {d.companyName} directly in your document
  • Flexible : Use any XML documents as a template: docx, odt, ods, xlsx, html, pptx, odp, custom xml files...
  • Future-proof : A powerful XML-agnostic algorithm understands what to do without knowing XML document specifications
  • Multilingual : One template, multiple languages. Update translation files automatically
  • Format data : Use built-in date and number formatters or create your own in Javascript
  • Fast : Manage multiple LibreOffice threads for document conversion, optimized code generation for each report

How it works?

Carbone is a mustache-like template engine {d.companyName}.

Template language documentation : https://carbone.io/documentation.html

  • The template can be any XML-document coming from LibreOffice™ or Microsoft Office™ (ods, docx, odt, xslx...)
  • The injected data must be a JSON object or array, coming directly from your existing APIs for example

Carbone 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. Carbone is working only on the server-side.

Minimum Requirements

  • NodeJS 10.x+
  • Runs on OSX, Linux (servers and desktop), and Windows

Optional

  • 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.

Getting started

Basic sample

1 - Install it

  npm install carbone

2 - Copy-paste this code in a new JS file, and execute it with node

  const fs = require('fs');
  const carbone = require('carbone');

  // Data to inject
  var data = {
    firstname : 'John',
    lastname : 'Doe'
  };

  // Generate a report using the sample template provided by carbone module
  // This LibreOffice template contains "Hello {d.firstname} {d.lastname} !"
  // Of course, you can create your own templates!
  carbone.render('./node_modules/carbone/examples/simple.odt', data, function(err, result){
    if (err) {
      return console.log(err);
    }
    // write the result
    fs.writeFileSync('result.odt', result);
  });

PDF generation, document conversion

Carbone uses efficiently LibreOffice to convert documents. Among all tested solutions, it is the most reliable and stable one in production for now.

Carbone does a lot of thing for you behind the scene:

  • starts LibreOffice in "server-mode": headless, no User Interface loaded
  • manages multiple LibreOffice workers to maximize performance (configurable number of workers)
  • automatically restarts LibreOffice worker if it crashes or does not respond
  • job queue, re-try conversion three times if something bad happen
1 - install LibreOffice
on OSX
on Ubuntu Server & Ubuntu desktop

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:

  # remove all old version of LibreOffice
  sudo apt remove --purge libreoffice*
  sudo apt autoremove --purge

  # Download LibreOffice debian package. Select the right one (64-bit or 32-bit) for your OS.
  # Get the latest from http://download.documentfoundation.org/libreoffice/stable
  # or download the version currently "carbone-tested":
  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

  # Install required dependencies on ubuntu server for LibreOffice 7.0+
  sudo apt install libxinerama1 libfontconfig1 libdbus-glib-1-2 libcairo2 libcups2 libglu1-mesa libsm6

  # Uncompress package
  tar -zxvf LibreOffice_7.0.4.2_Linux_x86-64_deb.tar.gz
  cd LibreOffice_7.0.4.2_Linux_x86-64_deb/DEBS

  # Install LibreOffice
  sudo dpkg -i *.deb

  # If you want to use Microsoft fonts in reports, you must install the fonts
  # Andale Mono, Arial Black, Arial, Comic Sans MS, Courier New, Georgia, Impact,
  # Times New Roman, Trebuchet, Verdana,Webdings)
  sudo apt install ttf-mscorefonts-installer

  # If you want to use special characters, such as chinese ideograms, you must install a font that support them
  # For example:
  sudo apt install fonts-wqy-zenhei
2 - generate PDF

And now, you can use the converter, by passing options to render method.

Don't panic, only the first conversion is slow because LibreOffice must starts Once started, LibreOffice stays on to make new conversions faster

  var data = {
    firstname : 'John',
    lastname : 'Doe'
  };

  var options = {
    convertTo : 'pdf' //can be docx, txt, ...
  };

  carbone.render('./node_modules/carbone/examples/simple.odt', data, options, function(err, result){
    if (err) return console.log(err);
    fs.writeFileSync('result.pdf', result);
    process.exit(); // to kill automatically LibreOffice workers
  });

More examples

Nested repetition in a docx document and spreadsheet
  var data = [
    {
      movieName : 'Matrix',
      actors    : [{
        firstname : 'Keanu',
        lastname  : 'Reeves'
      },{
        firstname : 'Laurence',
        lastname  : 'Fishburne'
      },{
        firstname : 'Carrie-Anne',
        lastname  : 'Moss'
      }]
    },
    {
      movieName : 'Back To The Future',
      actors    : [{
        firstname : 'Michael',
        lastname  : 'J. Fox'
      },{
        firstname : 'Christopher',
        lastname  : 'Lloyd'
      }]
    }
  ];

  carbone.render('./node_modules/carbone/examples/movies.docx', data, function(err, result){
    if (err) return console.log(err);
    fs.writeFileSync('movies_result.docx', result);
  });

  carbone.render('./node_modules/carbone/examples/flat_table.ods', data, function(err, result){
    if (err) return console.log(err);
    fs.writeFileSync('flat_table_result.ods', result);
  });

API Reference

To check out the api reference and the documentation, visit carbone.io.

Command line tools

To checkout out the Carbone CLI documentation, visit carbone.io

Issues

If you're facing any issues, search a similar issue to ensure it doesn't already exist on Github. Otherwhise, create an issue to help us.

Roadmap

The roadmap is pinned on the github issues list.

Performance

Report generation speed (without network latency), using a basic one-page DOCX template:

  • ~ 10 ms / report without document conversion (analyzing, injection, rendering)
  • ~ 50 ms / report with a PDF conversion (100 loops, 3 LibreOffice workers, without cold-start)

On a MacBook Pro Mid-2015, 2,2 Ghz i7, 16Go.

Licenses and editions

There are two editions of Carbone:

  • Carbone Community Edition is available freely under the Apache v2 license
  • Carbone Enterprise Edition (hosted and on-premise) includes extra features like a user interface.

We want to follow the model of Gitlab. The free version must be and must stay generous.

Philosophy

Our ultimate goal

2% percent of our hosted solution revenues will go to charity in three domains: open source software we love, education and environment.

We already know that beneficiaries will be, at least ❤️

  • LibreOffice foundation
  • PostgreSQL foundation
  • An innovative child school in France

Contributors

Thanks to all Carbone contributors (random order)

  • Florian Bezagu
  • Matthieu Robin
  • Arnaud Lelièvre
  • Maxime Vincent
  • Enzo Ghemard
  • Jordan Nourry
  • Etienne Rouillard
  • Guillaume Chevaux
  • Fabien Bigant
  • Maxime Magne
  • Vincent Bertin
  • Léo Labruyère
  • Aurélien Kermabon
  • Steeve Payraudeau
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].