Utility to render CEE (Wtf is this?) document due to XML exported from CE3X.
It will appear something like this:
npm i --save cee-render
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'
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'
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>`
- Node 8
- Typescript
- ES6
- Puppeteer
- Sass
- Postcss + CSS Next
- Babel
- Jest
- Gulp
- TSlint
- Express (developing purposes)
- Handlebars
- xml-js
npm run test
npm run test:watch
Atención este comando sólo funciona si el proyecto está trackeado con GIT.
npm run build
npm run publish:server