Open JaneSjs opened 8 months ago
I used the following code:
if(question instanceof QuestionSignaturePadModel) {
return this.currentDownloadType === "pdf" && !!dataCell ? `<img-${question.signatureWidth}-${question.signatureHeight}>${dataCell}` : questionName;
}
in the accessorDownload
function.
And this code in the defaultDownloadOptions
:
didParseCell: function(data) {
if (data && data.cell.raw.content) {
const hasImagePrefix = (data.cell.raw.content || "").substring(0, 5) === "<img-";
if(hasImagePrefix) {
data.cell.height = 200;
}
}
},
willDrawCell: function(data) {
if (data && data.cell.raw.content) {
const hasImagePrefix = (data.cell.raw.content || "").substring(0, 5) === "<img-";
if(hasImagePrefix) {
const imagePreficIndex = data.cell.raw.content.indexOf(">");
const imageUrl = data.cell.raw.content.substring(imagePreficIndex+1);
if(!!imageUrl) {
const dims = data.cell.raw.content.substring(5, imagePreficIndex).split("-");
// var dim = data.cell.height - data.cell.padding("vertical");
doc.addImage(imageUrl, data.cell.x, data.cell.y, Number.parseInt(dims[0]), Number.parseInt(dims[1]));
data.cell.contentWidth = data.cell.width;
data.cell.contentHeight = Number.parseInt(dims[1]);
data.row.maxCellHeight = Object.keys(data.row.cells).reduce((a, key) => Math.max(a, data.row.cells[key].height), 0);
data.row.height = data.row.maxCellHeight;
return false;
}
}
}
}
But I still have the problem: table row height still remains large (as it was calculated for lerge base64 text). Right now I've not found a quick solution for it.
https://github.com/surveyjs/survey-analytics/blob/d4d8887a2d0f5f6c4840cc3870dbb671d5052e10/src/tables/tabulator.ts#L239
User Issue: T15237 - COMO DESCARGAR LAS PDF Y EXCEL CON IMAGENES https://surveyjs.answerdesk.io/internal/ticket/details/T15237
Tabulator appears as follows:
Current output after exporting a Tabulator to PDF:
Expected output: signature images appear in PDF.