boletos-ademitech 1.0.4 → 1.0.5
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/lib/boleto/gerador-de-boleto.js +18 -16
- package/package.json +1 -1
|
@@ -599,19 +599,13 @@ var GeradorDeBoleto = (function () {
|
|
|
599
599
|
const linhaDigitavel = GeradorDeLinhaDigitavel(codigoDeBarras, banco);
|
|
600
600
|
|
|
601
601
|
async function normalizeImageToJpegBuffer(image) {
|
|
602
|
-
return sharp(image)
|
|
603
|
-
.flatten({ background: '#FFFFFF' })
|
|
604
|
-
.jpeg({
|
|
605
|
-
quality: 100,
|
|
606
|
-
mozjpeg: false
|
|
607
|
-
})
|
|
608
|
-
.toBuffer();
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
async function normalizeQrCodeToPngBuffer(image) {
|
|
612
602
|
if (Buffer.isBuffer(image)) {
|
|
613
603
|
return sharp(image)
|
|
614
|
-
.
|
|
604
|
+
.flatten({ background: '#FFFFFF' })
|
|
605
|
+
.jpeg({
|
|
606
|
+
quality: 100,
|
|
607
|
+
mozjpeg: false
|
|
608
|
+
})
|
|
615
609
|
.toBuffer();
|
|
616
610
|
}
|
|
617
611
|
|
|
@@ -619,12 +613,20 @@ var GeradorDeBoleto = (function () {
|
|
|
619
613
|
const base64 = image.split(',')[1];
|
|
620
614
|
|
|
621
615
|
return sharp(Buffer.from(base64, 'base64'))
|
|
622
|
-
.
|
|
616
|
+
.flatten({ background: '#FFFFFF' })
|
|
617
|
+
.jpeg({
|
|
618
|
+
quality: 100,
|
|
619
|
+
mozjpeg: false
|
|
620
|
+
})
|
|
623
621
|
.toBuffer();
|
|
624
622
|
}
|
|
625
623
|
|
|
626
624
|
return sharp(image)
|
|
627
|
-
.
|
|
625
|
+
.flatten({ background: '#FFFFFF' })
|
|
626
|
+
.jpeg({
|
|
627
|
+
quality: 100,
|
|
628
|
+
mozjpeg: false
|
|
629
|
+
})
|
|
628
630
|
.toBuffer();
|
|
629
631
|
}
|
|
630
632
|
|
|
@@ -706,7 +708,7 @@ var GeradorDeBoleto = (function () {
|
|
|
706
708
|
);
|
|
707
709
|
|
|
708
710
|
// Gerar QR code e adicionar ao PDF
|
|
709
|
-
const qrCodeImage = await
|
|
711
|
+
const qrCodeImage = await normalizeImageToJpegBuffer(boleto.getQrCode());
|
|
710
712
|
|
|
711
713
|
pdf.image(
|
|
712
714
|
qrCodeImage,
|
|
@@ -1085,7 +1087,7 @@ var GeradorDeBoleto = (function () {
|
|
|
1085
1087
|
|
|
1086
1088
|
pdf.font('negrito')
|
|
1087
1089
|
.fontSize(args.tamanhoDaFonteDoTitulo)
|
|
1088
|
-
.text('Código de Baixa', args.ajusteX + 370, args.ajusteY + tituloDaSetimaLinha +
|
|
1090
|
+
.text('Código de Baixa', args.ajusteX + 370, args.ajusteY + tituloDaSetimaLinha + 182, {
|
|
1089
1091
|
lineBreak: false,
|
|
1090
1092
|
width: 294,
|
|
1091
1093
|
align: 'left'
|
|
@@ -1093,7 +1095,7 @@ var GeradorDeBoleto = (function () {
|
|
|
1093
1095
|
|
|
1094
1096
|
pdf.font('negrito')
|
|
1095
1097
|
.fontSize(args.tamanhoDaFonteDoTitulo)
|
|
1096
|
-
.text('Autenticação Mecânica', args.ajusteX + 360, args.ajusteY + tituloDaSetimaLinha +
|
|
1098
|
+
.text('Autenticação Mecânica', args.ajusteX + 360, args.ajusteY + tituloDaSetimaLinha + 192, {
|
|
1097
1099
|
lineBreak: false,
|
|
1098
1100
|
width: 294,
|
|
1099
1101
|
align: 'left'
|