ebta-workflow-prod 4.0.9 → 4.0.11

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,7 +1,7 @@
1
1
  {
2
2
  "name": "ebta-workflow-prod",
3
3
  "private": false,
4
- "version": "4.0.9",
4
+ "version": "4.0.11",
5
5
  "description": "",
6
6
  "license": "UNLICENSED",
7
7
  "author": "",
@@ -242,10 +242,10 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
242
242
  const image3url = 'https://cdn.jsdelivr.net/npm/ebta-resources/resources/prints/dbyd.png'
243
243
  const imageBarurl = 'https://cdn.jsdelivr.net/npm/ebta-resources/resources/prints/Scalebar.png'
244
244
  const imageNorthUrl = 'https://cdn-icons-png.flaticon.com/512/3236/3236586.png'
245
+ const image10kmurl = 'https://ebta.maps.arcgis.com/sharing/rest/content/items/c15211b9826549f69a13c3f3d32a841b/resources/resources/prints/speedlimit10PNG.png'
245
246
  let image10Buffer, image1Buffer, image2Buffer, image3Buffer
246
247
 
247
248
  if (inputs.template == 'VMP') {
248
- const image10kmurl = 'https://ebta.maps.arcgis.com/sharing/rest/content/items/c15211b9826549f69a13c3f3d32a841b/resources/vmp_symbols/speedlimit10.svg'
249
249
  image10Buffer = await this.fetchData(image10kmurl);
250
250
  console.log('Image10 fetched successfully');
251
251
  }
@@ -272,13 +272,13 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
272
272
  let newPage = doc.getPage(0)
273
273
  let imgBase64 = imgBase64Array[i]
274
274
  let imageBuffer = this.base64ToArrayBuffer(imgBase64);
275
- console.log(`Image ${i} data processed successfully`);
276
275
  let image;
277
276
  if (imgBase64.startsWith('data:image/png;base64,')) {
278
277
  image = await doc.embedPng(imageBuffer);
279
278
  } else if (imgBase64.startsWith('data:image/jpeg;base64,') || imgBase64.startsWith('data:image/jpg;base64,')) {
280
279
  image = await doc.embedJpg(imageBuffer);
281
280
  }
281
+ console.log(`Main Image ${i} data processed successfully`);
282
282
  let image1, image2, image3, image10
283
283
  if (inputs.template == 'VMP') {
284
284
  image10 = await doc.embedPng(image10Buffer);
@@ -611,24 +611,26 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
611
611
  }
612
612
  }
613
613
  console.log('Text Fields removal successful')
614
- //draw a QR Code image only when Qr URL is given && QR image not given
614
+
615
+
615
616
  const boldFont = await doc.embedFont(StandardFonts.HelveticaBold);
616
617
 
617
618
  if (inputs.template == 'VMP') {
618
619
  newPage.drawText('Maximum Speed 10KM/h within Work Area', {
619
- x: 28,
620
+ x: (28+150),
620
621
  y: 145,
621
622
  size: 10.5,
622
623
  color: rgb(255, 255, 255), // White color
623
- font: boldFont,
624
+ font: font,
624
625
  });
625
626
  newPage.drawText('Maximum Speed 10KM/h within Work Area', {
626
- x: 28,
627
+ x: (28+151),
627
628
  y: 145,
628
629
  size: 10,
629
630
  color: rgb(255, 0, 0), // red color
630
631
  font: boldFont,
631
632
  });
633
+ console.log('speed limit text inserted')
632
634
  }
633
635
 
634
636
  if (inputs.buttonLink && inputs.buttonLink.length > 0) {
@@ -654,11 +656,9 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
654
656
  font: boldFont,
655
657
  });
656
658
 
657
-
658
659
  const existingAnnots = newPage.node.lookup(PDFName.of('Annots'));
659
660
  let annotationsArray = existingAnnots instanceof PDFArray ? existingAnnots : doc.context.obj([]);
660
661
 
661
-
662
662
  const linkAnnotation = doc.context.register(
663
663
  doc.context.obj({
664
664
  Type: 'Annot',
@@ -676,8 +676,11 @@ export default class PDFMapGeneratorActivity implements IActivityHandler {
676
676
  annotationsArray.push(linkAnnotation);
677
677
  // Set the updated annotations array back to the page
678
678
  newPage.node.set(PDFName.of('Annots'), annotationsArray);
679
+ console.log('EBTA button inserted')
679
680
  }
680
681
 
682
+
683
+ //draw a QR Code image only when Qr URL is given && QR image not given
681
684
  if (inputs.QrUrl && inputs.QrUrl.length > 0 && (inputs.QrCodeImage == undefined)) {
682
685
  //QR Code
683
686
  // eslint-disable-next-line @typescript-eslint/no-var-requires