@measurequick/measurequick-report-generator 1.2.43 → 1.2.45
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
|
@@ -5,10 +5,10 @@ import * as photos6 from '../base-64/photos6.js';
|
|
|
5
5
|
import * as base64 from '../base-64/icons.js';
|
|
6
6
|
import * as util from '../util.js';
|
|
7
7
|
|
|
8
|
-
export async function getReport(payload) {
|
|
8
|
+
export async function getReport(payload) { console.log("PAYLOAD " + JSON.stringify(payload));
|
|
9
9
|
|
|
10
10
|
const mqLogoBytes = util._base64ToArrayBuffer(base64.mqLogo);
|
|
11
|
-
let maxPhotosPerPage = payload.meta.pdf_settings.maxPhotosPerPage;
|
|
11
|
+
let maxPhotosPerPage = payload.meta.pdf_settings.maxPhotosPerPage ? payload.meta.pdf_settings.maxPhotosPerPage : 2;
|
|
12
12
|
|
|
13
13
|
// Layout Configuration
|
|
14
14
|
let docs = [], forms = [], page = photos6, pSize = "Small";
|
|
@@ -22,7 +22,8 @@ export async function getReport(payload) { // console.log(payload);
|
|
|
22
22
|
|
|
23
23
|
// Process All Photos
|
|
24
24
|
let docIndex = 0;
|
|
25
|
-
let photos = payload.photos
|
|
25
|
+
let photos = payload.photos;
|
|
26
|
+
console.log(JSON.stringify(photos));
|
|
26
27
|
if (photos && Object.keys(photos) && Object.keys(photos).length > 0) {
|
|
27
28
|
let s3ReferenceIds = Object.keys(photos);
|
|
28
29
|
let arrPhotos = [];
|
|
@@ -50,8 +51,8 @@ export async function getReport(payload) { // console.log(payload);
|
|
|
50
51
|
forms[docIndex].getTextField("Header").setText(`Project Photos`);
|
|
51
52
|
}
|
|
52
53
|
let imageToSet;
|
|
53
|
-
if (photo.base64.includes("image/jpeg")) imageToSet = await docs[docIndex].embedJpg(util._base64ToArrayBuffer(photo.base64));
|
|
54
|
-
else if (photo.base64.includes("image/png")) imageToSet = await docs[docIndex].embedPng(util._base64ToArrayBuffer(photo.base64));
|
|
54
|
+
if ((photo.base64 && photo.base64.includes("image/jpeg")) || photo.fileType == 'jpg') imageToSet = await docs[docIndex].embedJpg(util._base64ToArrayBuffer(photo.base64));
|
|
55
|
+
else if ((photo.base64 && photo.base64.includes("image/png")) || photo.fileType == 'png') imageToSet = await docs[docIndex].embedPng(util._base64ToArrayBuffer(photo.base64));
|
|
55
56
|
if (imageToSet) forms[docIndex].getButton(`photo${pSize}${photoPosition}`).setImage(imageToSet);
|
|
56
57
|
photoPosition++;
|
|
57
58
|
let caption = photo.section;
|