@legalplace/prerenderx
v3.8.2
Published
PrerenderX
Maintainers
Keywords
Readme
PrerenderX v1.0.0
Install
yarn add git+https://git.legalplace.eu/legalplace/prerenderx.git#1.0.0Usage
import { Prerender } from 'prerenderx';
const model = {}; // Your v3 (non final) model
const ovc = {options: {}, variables: {}}; // Your OVC
const prerender = new Prerender(modelV3, ovc);
// Getting documents index
const documentsIndex = prerender.getDocumentsIndex();
// Getting all documents
const documents = Object.keys(documentsIndexes).map((hash) => prerender.getDocument(hash))Return formats
Prerender.getDocument returns two different types:
- In case document is an output it returns a plaintext
- In case document is a pdf form it returns an object with this definition:
{
id: string
inputs: {
// Key is input's id
// Value is input's value
[key: string]: string
}
boxes: {
// Key is box's id
// Value is box's value
[key: string]: string
}
}How to determine whether a document is an output or a pdf form
Note
- Outputs should be sent to the worker to generate DOCX & PDF files
- Pdf forms should be filled with pdfjson and the original pdf
import { Prerender } from 'prerenderx';
const model = {}; // Your v3 (non final) model
const ovc = {options: {}, variables: {}}; // Your OVC
const prerender = new Prerender(modelV3, ovc);
// Getting documents index
const documentsIndex = prerender.getDocumentsIndex();
// Extracting PDF Forms documents only
const pdfFormsDocuments = documentsIndex.filter((documentDescription) => Prerender.isPdfForm(documentDescription))
// Extracting outputs documents only
const outputDocuments = documentsIndex.filter((documentDescription) => Prerender.isOutput(documentDescription))