@measurequick/measurequick-report-generator 1.5.178 → 1.5.180

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.5.178",
3
+ "version": "1.5.180",
4
4
  "description": "Generates PDF documents for various measureQuick applications.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -56,23 +56,26 @@ export async function getReport(payload) {
56
56
  if (isNCI) {
57
57
  const nciLogoImage = await pdfDoc.embedPng(util._base64ToArrayBuffer(base64.nciLogo));
58
58
  const pages = pdfDoc.getPages();
59
- const firstPage = pages[0];
60
- // Get the ProfilePicture button position from the form field
59
+ // Get the ProfilePicture button widgets (may be on multiple pages)
61
60
  const profilePictureButton = form.getButton("ProfilePicture");
62
61
  const widgets = profilePictureButton.acroField.getWidgets();
63
- const rect = widgets[0].getRectangle();
64
- // Draw NCI logo at the profile picture position, 15% larger
65
- const logoWidth = rect.width * 1.15;
66
- const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
67
- // Center the logo in the original field area
68
- const x = rect.x + (rect.width - logoWidth) / 2;
69
- const y = rect.y + (rect.height - logoHeight) / 2;
70
- firstPage.drawImage(nciLogoImage, {
71
- x: x,
72
- y: y,
73
- width: logoWidth,
74
- height: logoHeight,
75
- });
62
+ // Draw NCI logo on each page that has the ProfilePicture widget
63
+ for (let i = 0; i < widgets.length; i++) {
64
+ const rect = widgets[i].getRectangle();
65
+ const page = pages[i] || pages[0];
66
+ // Draw NCI logo at the profile picture position, 15% larger
67
+ const logoWidth = rect.width * 1.15;
68
+ const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
69
+ // Center the logo in the original field area
70
+ const x = rect.x + (rect.width - logoWidth) / 2;
71
+ const y = rect.y + (rect.height - logoHeight) / 2;
72
+ page.drawImage(nciLogoImage, {
73
+ x: x,
74
+ y: y,
75
+ width: logoWidth,
76
+ height: logoHeight,
77
+ });
78
+ }
76
79
  // Still set company logo
77
80
  if (companyImage) {
78
81
  form.getButton("HalfWidthLogo").setImage(companyImage);
@@ -320,7 +320,8 @@ export async function getReport(payload) {
320
320
  let form = t == 0 ? formPg1 : formPg2;
321
321
  let test = payload.tests[t].testInfo;
322
322
  // Add source property to test object for tool icon lookup
323
- test.source = payload.tests[t].source || {};
323
+ // Source is stored in testInfo.source, not at the test root level
324
+ test.source = payload.tests[t].testInfo.source || payload.tests[t].source || {};
324
325
  form.getTextField("Header").setText(`${sectionLabel}Measurement Details`);
325
326
 
326
327
  if (payload.meta.cName)
@@ -132,23 +132,26 @@ export async function getReport(payload, _test) {
132
132
  if (isNCI) {
133
133
  const nciLogoImage = await pdfDoc.embedPng(util._base64ToArrayBuffer(base64.nciLogo));
134
134
  const pages = pdfDoc.getPages();
135
- const firstPage = pages[0];
136
- // Get the ProfilePicture button position from the form field
135
+ // Get the ProfilePicture button widgets (may be on multiple pages)
137
136
  const profilePictureButton = form.getButton("ProfilePicture");
138
137
  const widgets = profilePictureButton.acroField.getWidgets();
139
- const rect = widgets[0].getRectangle();
140
- // Draw NCI logo at the profile picture position, 15% larger
141
- const logoWidth = rect.width * 1.15;
142
- const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
143
- // Center the logo in the original field area
144
- const x = rect.x + (rect.width - logoWidth) / 2;
145
- const y = rect.y + (rect.height - logoHeight) / 2;
146
- firstPage.drawImage(nciLogoImage, {
147
- x: x,
148
- y: y,
149
- width: logoWidth,
150
- height: logoHeight,
151
- });
138
+ // Draw NCI logo on each page that has the ProfilePicture widget
139
+ for (let i = 0; i < widgets.length; i++) {
140
+ const rect = widgets[i].getRectangle();
141
+ const page = pages[i] || pages[0];
142
+ // Draw NCI logo at the profile picture position, 15% larger
143
+ const logoWidth = rect.width * 1.15;
144
+ const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
145
+ // Center the logo in the original field area
146
+ const x = rect.x + (rect.width - logoWidth) / 2;
147
+ const y = rect.y + (rect.height - logoHeight) / 2;
148
+ page.drawImage(nciLogoImage, {
149
+ x: x,
150
+ y: y,
151
+ width: logoWidth,
152
+ height: logoHeight,
153
+ });
154
+ }
152
155
  // Still set company logo
153
156
  if (companyImage) {
154
157
  form.getButton("HalfWidthLogo").setImage(companyImage);
@@ -120,23 +120,26 @@ export async function getReport(payload, _test) {
120
120
  if (isNCI) {
121
121
  const nciLogoImage = await pdfDoc.embedPng(util._base64ToArrayBuffer(base64.nciLogo));
122
122
  const pages = pdfDoc.getPages();
123
- const firstPage = pages[0];
124
- // Get the ProfilePicture button position from the form field
123
+ // Get the ProfilePicture button widgets (may be on multiple pages)
125
124
  const profilePictureButton = form.getButton("ProfilePicture");
126
125
  const widgets = profilePictureButton.acroField.getWidgets();
127
- const rect = widgets[0].getRectangle();
128
- // Draw NCI logo at the profile picture position, 15% larger
129
- const logoWidth = rect.width * 1.15;
130
- const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
131
- // Center the logo in the original field area
132
- const x = rect.x + (rect.width - logoWidth) / 2;
133
- const y = rect.y + (rect.height - logoHeight) / 2;
134
- firstPage.drawImage(nciLogoImage, {
135
- x: x,
136
- y: y,
137
- width: logoWidth,
138
- height: logoHeight,
139
- });
126
+ // Draw NCI logo on each page that has the ProfilePicture widget
127
+ for (let i = 0; i < widgets.length; i++) {
128
+ const rect = widgets[i].getRectangle();
129
+ const page = pages[i] || pages[0];
130
+ // Draw NCI logo at the profile picture position, 15% larger
131
+ const logoWidth = rect.width * 1.15;
132
+ const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
133
+ // Center the logo in the original field area
134
+ const x = rect.x + (rect.width - logoWidth) / 2;
135
+ const y = rect.y + (rect.height - logoHeight) / 2;
136
+ page.drawImage(nciLogoImage, {
137
+ x: x,
138
+ y: y,
139
+ width: logoWidth,
140
+ height: logoHeight,
141
+ });
142
+ }
140
143
  // Still set company logo
141
144
  if (companyImage) {
142
145
  safeSetImage(form, "HalfWidthLogo", companyImage);
@@ -133,23 +133,26 @@ export async function getReport(payload, _test) {
133
133
  if (isNCI) {
134
134
  const nciLogoImage = await pdfDoc.embedPng(util._base64ToArrayBuffer(base64.nciLogo));
135
135
  const pages = pdfDoc.getPages();
136
- const firstPage = pages[0];
137
- // Get the ProfilePicture button position from the form field
136
+ // Get the ProfilePicture button widgets (may be on multiple pages)
138
137
  const profilePictureButton = form.getButton("ProfilePicture");
139
138
  const widgets = profilePictureButton.acroField.getWidgets();
140
- const rect = widgets[0].getRectangle();
141
- // Draw NCI logo at the profile picture position, 15% larger
142
- const logoWidth = rect.width * 1.15;
143
- const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
144
- // Center the logo in the original field area
145
- const x = rect.x + (rect.width - logoWidth) / 2;
146
- const y = rect.y + (rect.height - logoHeight) / 2;
147
- firstPage.drawImage(nciLogoImage, {
148
- x: x,
149
- y: y,
150
- width: logoWidth,
151
- height: logoHeight,
152
- });
139
+ // Draw NCI logo on each page that has the ProfilePicture widget
140
+ for (let i = 0; i < widgets.length; i++) {
141
+ const rect = widgets[i].getRectangle();
142
+ const page = pages[i] || pages[0];
143
+ // Draw NCI logo at the profile picture position, 15% larger
144
+ const logoWidth = rect.width * 1.15;
145
+ const logoHeight = logoWidth * (nciLogoImage.height / nciLogoImage.width);
146
+ // Center the logo in the original field area
147
+ const x = rect.x + (rect.width - logoWidth) / 2;
148
+ const y = rect.y + (rect.height - logoHeight) / 2;
149
+ page.drawImage(nciLogoImage, {
150
+ x: x,
151
+ y: y,
152
+ width: logoWidth,
153
+ height: logoHeight,
154
+ });
155
+ }
153
156
  // Still set company logo
154
157
  if (companyImage) {
155
158
  safeSetImage(form, "HalfWidthLogo", companyImage);