Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: fix jspdf versions from PR#7429 #7447

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Some change to prior PR
- revert jspdf to prior version 2.5.1
- use jspdf UMD version in fax viewers. I misconfigure in my first tries at UMD for this library.
  • Loading branch information
sjpadgett committed May 20, 2024
commit b9a3059bd5a3244cc4b542f99733778ebf9c899c
5 changes: 1 addition & 4 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,7 @@ assets:
script: jszip.min.js
jspdf:
basePath: '%assets_static_relative%/jspdf/dist/'
script: jspdf.min.js
jspdfdebug:
basePath: '%assets_static_relative%/jspdf/dist/'
script: jspdf.debug.js
script: jspdf.umd.min.js
jstiff:
basePath: '%assets_static_relative%/tiff/'
script: tiff.min.js
Expand Down
10 changes: 7 additions & 3 deletions interface/modules/custom_modules/oe-module-faxsms/messageUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,21 @@ function showPrint(base64, _contentType = 'image/tiff') {

// Function to convert images to PDF and return a base64
async function convertImagesToPdf(images, filename = 'fax-tiff-to-pdf.pdf') {
const {jsPDF} = window.jspdf;
const doc = new jsPDF();
const pageHeight = doc.internal.pageSize.getHeight();
doc.internal.write.isEvalSupported = false;
const pageHeight = doc.internal.pageSize.height;
const pageWidth = doc.internal.pageSize.width;

for (let i = 0; i < images.length; i++) {
if (i !== 0) {
doc.addPage();
}
doc.addImage(images[i], 'JPEG', 10, 10, 190, pageHeight - 20);
doc.addImage(images[i], 'JPEG', 0, 0, pageWidth, pageHeight);
}

return doc.output('datauristring').split(',')[1]; // Return only the Base64 part
// Return the PDF as base64 string
return doc.output('datauristring').split(',')[1];
}

function showDocument(_base64, _contentType = 'image/tiff') {
Expand Down
Loading
Loading