@measurequick/measurequick-report-generator 1.2.103 → 1.2.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measurequick/measurequick-report-generator",
3
- "version": "1.2.103",
3
+ "version": "1.2.104",
4
4
  "description": "Generates PDF documents for various MeasureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,9 @@
1
1
  import {
2
- PDFDocument
2
+ PDFDocument,
3
+ PDFFont,
4
+ StandardFonts
3
5
  } from 'pdf-lib';
6
+ // import fontkit from '@pdf-lib/fontkit';
4
7
  import * as base64 from '../base-64/icons.js';
5
8
  import * as pdf from '../base-64/corrective-measures-page.js';
6
9
  import * as pdf2 from '../base-64/corrective-measures-page-2.js';
@@ -99,34 +102,41 @@ export async function getReport(payload) {
99
102
  }
100
103
 
101
104
  form.getTextField(`Block3-Title`).setText(payload.system_data.title3);
102
- let caIndex = 0;
103
- let header;
104
- for (let colNum = 1; colNum < 4; colNum++) {
105
- let row = 1;
106
- let caMeas = payload.system_data.block3[caIndex];
107
- if (caMeas && header == caMeas.ref) {
108
- form.getTextField(`CA-Col${colNum}-Row${row}-Bold`).setText(`${caMeas.ref} (Cont.)`);
109
- row++;
110
- }
111
- for (let rowNum = row; rowNum < 24; rowNum++) {
112
- caMeas = payload.system_data.block3[caIndex];
113
- if (caMeas && (payload.meta.report_type == 'CorrectiveMeasures' || (payload.meta.report_type == 'FullReport' && caMeas.ref != 'Condensate Drain System' && caMeas.ref != 'Outdoor Equipment' && caMeas.ref != 'Indoor Equipment' && caMeas.ref != 'Cooling Efficiency'))) {
114
- if (header !== caMeas.ref) {
115
- if (rowNum + 2 > 23) {
116
- colNum++;
117
- rowNum = 1;
118
- } else {
119
- if (rowNum != 1) rowNum++;
120
- form.getTextField(`CA-Col${colNum}-Row${rowNum}-Bold`).setText(caMeas.ref);
121
- rowNum++;
122
- }
123
- }
124
- header = caMeas.ref;
125
- form.getTextField(`CA-Col${colNum}-Row${rowNum}`).setText(caMeas.label);
126
- caIndex++;
127
- } else caIndex++;
128
- }
129
- }
105
+
106
+ // let caIndex = 0;
107
+ // let header;
108
+ // for (let colNum = 1; colNum < 4; colNum++) {
109
+ // let row = 1;
110
+ // let caMeas = payload.system_data.block3[caIndex];
111
+ // if (caMeas && header == caMeas.ref) {
112
+ // form.getTextField(`CA-Col${colNum}-Row${row}-Bold`).setText(`${caMeas.ref} (Cont.)`);
113
+ // row++;
114
+ // }
115
+ // for (let rowNum = row; rowNum < 24; rowNum++) {
116
+ // caMeas = payload.system_data.block3[caIndex];
117
+ // if (caMeas && (payload.meta.report_type == 'CorrectiveMeasures' || (payload.meta.report_type == 'FullReport' && caMeas.ref != 'Condensate Drain System' && caMeas.ref != 'Outdoor Equipment' && caMeas.ref != 'Indoor Equipment' && caMeas.ref != 'Cooling Efficiency'))) {
118
+ // if (header !== caMeas.ref) {
119
+ // if (rowNum + 2 > 23) {
120
+ // colNum++;
121
+ // rowNum = 1;
122
+ // } else {
123
+ // if (rowNum != 1) rowNum++;
124
+ // form.getTextField(`CA-Col${colNum}-Row${rowNum}-Bold`).setText(caMeas.ref);
125
+ // rowNum++;
126
+ // }
127
+ // }
128
+ // header = caMeas.ref;
129
+ // form.getTextField(`CA-Col${colNum}-Row${rowNum}`).setText(caMeas.label);
130
+ // caIndex++;
131
+ // } else caIndex++;
132
+ // }
133
+ // }
134
+
135
+ let loremIpsum = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
136
+
137
+ let width = font.widthOfTextAtSize(loremIpsum, 12);
138
+ form.getTextField(`Text1`).setText(loremIpsum);
139
+ form.getTextField(`Text2`).setText(width+"");
130
140
 
131
141
  form.flatten();
132
142
  return await pdfDoc.saveAsBase64({