@measurequick/measurequick-report-generator 1.5.76 → 1.5.78
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
|
@@ -195,8 +195,9 @@ export async function getReport(payload) {
|
|
|
195
195
|
|
|
196
196
|
// Check if nciReportDoc is properly initialized before copying pages
|
|
197
197
|
if (nciReportDoc) {
|
|
198
|
-
const [
|
|
199
|
-
if (
|
|
198
|
+
const [nciReportPage0, nciReportPage1] = await coreDoc.copyPages(nciReportDoc, [0, 1]);
|
|
199
|
+
if (nciReportPage0) coreDoc.insertPage(coreDoc.getPages().length, nciReportPage0);
|
|
200
|
+
if (nciReportPage1) coreDoc.insertPage(coreDoc.getPages().length, nciReportPage1);
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
} catch (error) {
|
|
@@ -8,7 +8,6 @@ import * as util from '../util.js';
|
|
|
8
8
|
|
|
9
9
|
export async function getReport(payload, _test) {
|
|
10
10
|
try {
|
|
11
|
-
console.log('payload',payload);
|
|
12
11
|
// fetch and load form
|
|
13
12
|
const formPdfBytes = util._base64ToArrayBuffer(pdf.base64);
|
|
14
13
|
const pdfDoc = await PDFDocument.load(formPdfBytes);
|
|
@@ -32,6 +32,7 @@ export async function getReport(payload) {
|
|
|
32
32
|
// Process All Photos
|
|
33
33
|
let docIndex = 0;
|
|
34
34
|
let photos = payload.photos.project;
|
|
35
|
+
let hasPhotos = false;
|
|
35
36
|
if (photos.unsynced && typeof photo.unsynced === 'object') delete photos.unsynced;
|
|
36
37
|
if (photos && Object.keys(photos) && Object.keys(photos).length > 0) {
|
|
37
38
|
let s3ReferenceIds = Object.keys(photos);
|
|
@@ -58,6 +59,7 @@ export async function getReport(payload) {
|
|
|
58
59
|
}
|
|
59
60
|
let imageToSet;
|
|
60
61
|
if (photo && photo.base64 && typeof photo.base64 == 'string') {
|
|
62
|
+
hasPhotos = true;
|
|
61
63
|
if (photo.base64 && photo.base64.includes("image/jpeg")) imageToSet = await docs[docIndex].embedJpg(util._base64ToArrayBuffer(photo.base64));
|
|
62
64
|
else if (photo.base64 && photo.base64.includes("image/png")) imageToSet = await docs[docIndex].embedPng(util._base64ToArrayBuffer(photo.base64));
|
|
63
65
|
}
|
|
@@ -68,7 +70,8 @@ export async function getReport(payload) {
|
|
|
68
70
|
photoPosition++;
|
|
69
71
|
prevSection = currSection;
|
|
70
72
|
}
|
|
71
|
-
|
|
73
|
+
if (hasPhotos)
|
|
74
|
+
docIndex++;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
// Prepare Deliverable
|