0.2.4 • Published 6 years ago

cee-render v0.2.4

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Cee-render

Build Status

npm version

NPM

Description

Utility to render CEE (Wtf is this?) document due to XML exported from CE3X.

It will appear something like this:

CEE Label

Installation

npm i --save cee-render

Features

Etiqueta CEE a Pdf

From XML Filepath

import { getPDFFromXml } from 'cee-render';

/**
 * Method that build PDF retrieved to user from
 * data in a XML. All params are absolute paths.
 *
 * @name getPDFFromXml
 * @param {string} xmlPath
 * @param {string} pdfDest
 * @param {string} numReferencia
 * @returns {string} path where to get the pdf built to send it to user
 * default filename ${numReferencia}.pdf
 */

const xmlPath = 'path/to/input/xml/file.xml';
const pdfDest = 'output/path';
const numReferencia = '00000011110000';

console.log(getPDFFromXml(xmlPath, pdfDest, numReferencia));
//'output/path/00000011110000.xml'

From XML string

import { getPDFFromXmlString } from 'cee-render';

/**
 * Method that build PDF retrieved to user from
 * data in a string. All params are absolute paths.
 *
 * @name getPDFFromXmlString
 * @param {string} xmlString
 * @param {string} pdfDest
 * @param {string} numReferencia
 * @returns {string} path where to get the pdf built to send it to user
 * default filename ${numReferencia}.pdf
 */

const xmlString = '<xml>...</xml>';
const pdfDest = 'output/path';
const numReferencia = '00000011110000';

console.log(getPDFFromXmlString(xmlPath, pdfDest, numReferencia));
//'output/path/00000011110000.xml'

Etiqueta CEE a HTML

Devuelve un html totalmente estático (fuentes e imágenes embebidas). Es útil para servir una versión online del documento. Está optimizado y probado en Chrome.

import { getHtmlFromXmlString } from 'cee-render';

/**
 * @description Renders HTML from xml data
 * 
 * @name getHtmlFromXmlString
 * @param {string} xmlString
 * @param {string} numReferencia
 * @returns {string} Html rendered with style
 */

const xmlString = '<xml>...</xml>';
const pdfDest = 'output/path';
const numReferencia = '00000011110000';

console.log(getHtmlFromXmlString(xmlPath, pdfDest, numReferencia));
`<html> 
    <head>...</head>
    <body>...</body>
</html>`

Stack

  • Node 8
  • Typescript
  • ES6
  • Puppeteer
  • Sass
  • Postcss + CSS Next
  • Babel
  • Jest
  • Gulp
  • TSlint
  • Express (developing purposes)
  • Handlebars
  • xml-js

Scripts

Test

npm run test
npm run test:watch

Atención este comando sólo funciona si el proyecto está trackeado con GIT.

Build

npm run build

Build + Publish

npm run publish:server
0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago