Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

alejandrofdiaz/cee-render

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published