@measurequick/measurequick-report-generator 1.5.26 → 1.5.27
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
|
@@ -2,6 +2,8 @@ import { PDFDocument } from 'pdf-lib';
|
|
|
2
2
|
import * as base64 from '../base-64/icons.js';
|
|
3
3
|
import * as pdf from '../base-64/nci-report.js';
|
|
4
4
|
import * as systemInfoPage from './system-info-page.js';
|
|
5
|
+
import * as photosReport from './photos-report.js';
|
|
6
|
+
import * as photosReportS3 from './photos-report-s3.js';
|
|
5
7
|
import * as util from '../util.js';
|
|
6
8
|
|
|
7
9
|
export async function getReport(payload, _test) {
|
|
@@ -9,6 +11,7 @@ export async function getReport(payload, _test) {
|
|
|
9
11
|
// fetch and load form
|
|
10
12
|
const formPdfBytes = util._base64ToArrayBuffer(pdf.base64);
|
|
11
13
|
const pdfDoc = await PDFDocument.load(formPdfBytes);
|
|
14
|
+
var errors = [];
|
|
12
15
|
|
|
13
16
|
// fetch resources
|
|
14
17
|
const iconRangeGreenBytes = util._base64ToArrayBuffer(base64.iconRangeGreen);
|
|
@@ -445,8 +448,8 @@ export async function getReport(payload, _test) {
|
|
|
445
448
|
let photosReportBase64 = (payload.meta.pdf_settings.includePhotos && payload.meta.photo_count > 0) ? await selectedPhotosReport.getReport(payload) : false;
|
|
446
449
|
const photosReportDoc = photosReportBase64 ? await PDFDocument.load(util._base64ToArrayBuffer(photosReportBase64.data)) : false;
|
|
447
450
|
for (let i = 0; (photosReportDoc && i < photosReportDoc.getPages().length); i++) {
|
|
448
|
-
const [_photosReport] = await
|
|
449
|
-
|
|
451
|
+
const [_photosReport] = await pdfDoc.copyPages(photosReportDoc, [i]);
|
|
452
|
+
pdfDoc.insertPage(pdfDoc.getPages().length, _photosReport);
|
|
450
453
|
}
|
|
451
454
|
} catch (error) {
|
|
452
455
|
errors.push(`Photos: ${error}`);
|