Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function pdfExportAdapter(boards = [], intl) {
const docDefinition = {
pageSize: 'A4',
pageOrientation: 'landscape',
content: []
};
const lastBoardIndex = boards.length - 1;
const content = await boards.reduce(async (prev, board, i) => {
const prevContent = await prev;
const breakPage = i !== lastBoardIndex;
const boardPDFData = await generatePDFBoard(board, intl, breakPage);
return prevContent.concat(boardPDFData);
}, Promise.resolve([]));
docDefinition.content = content;
const pdfObj = pdfMake.createPdf(docDefinition);
if (pdfObj) {
if (isCordova()) {
requestCvaWritePermissions();
pdfObj.getBuffer(buffer => {
var blob = new Blob([buffer], { type: 'application/pdf' });
const name = 'Download/board.pdf';
writeCvaFile(name, blob);
});
} else {
// On a browser simply use download!
pdfObj.download(EXPORT_CONFIG_BY_TYPE.pdf.filename);
}
}
}
const createPdf = () => {
const pdf = pdfMake;
pdf.vfs = pdfFonts.pdfMake.vfs;
pdfMake.createPdf(docDefinition).download();
};
fontSize: 12,
lineHeight: 1.1
},
subTitle2: {
fontSize: 12
},
contentTitle:{
fontSize: 12
}
},
defaultStyle: {
fontSize: 11
}
}
const pdfDocGenerator = pdfMake.createPdf(docDefinition);
pdfDocGenerator.getDataUrl((dataUrl) => {
this.setState({
pdfData: dataUrl
});
let formData = new FormData();
var blob = dataURItoBlob(dataUrl);
formData.append("file", blob, `WC_${Connection[0].acknowledgementNumber || '0'} + .pdf`);
formData.append("tenantId", localStorage.getItem('tenantId'));
formData.append("module", "wc");
let {
setLoadingStatus
} = this.props;
renderPdf = (md) => {
const pdf = pdfMake.createPdf(new DocDefinition(md));
pdf.getDataUrl((dataUrl) => {
this.setState({ pdfContent: dataUrl });
});
this.props.onRendered(pdf);
}
fontSize: 12,
lineHeight: 1.1
},
subTitle2: {
fontSize: 12
},
contentTitle:{
fontSize: 12
}
},
defaultStyle: {
fontSize: 11
}
}
const pdfDocGenerator = pdfMake.createPdf(docDefinition);
pdfDocGenerator.getDataUrl((dataUrl) => {
this.setState({
pdfData: dataUrl
});
let formData = new FormData();
var blob = dataURItoBlob(dataUrl);
formData.append("file", blob, `WC_${Connection[0].acknowledgementNumber || '0'} + .pdf`);
formData.append("tenantId", localStorage.getItem('tenantId'));
let {
setLoadingStatus
} = this.props;
var errorFunction = function(err) {
fontSize: 12,
lineHeight: 1.1
},
subTitle2: {
fontSize: 12
},
contentTitle:{
fontSize: 12
}
},
defaultStyle: {
fontSize: 11
}
}
const pdfDocGenerator = pdfMake.createPdf(docDefinition);
pdfDocGenerator.getDataUrl((dataUrl) => {
this.setState({
pdfData: dataUrl
});
let formData = new FormData();
var blob = dataURItoBlob(dataUrl);
formData.append("file", blob, `TL_${license.licenseNumber || '0'} + .pdf`);
formData.append("tenantId", localStorage.getItem('tenantId'));
formData.append("module", constants.TRADE_LICENSE_FILE_TAG);
let {
setLoadingStatus
} = this.props;
},
subTitle: {
fontSize: 13
},
contentTitle:{
fontSize: 12
}
},
defaultStyle: {
fontSize: 11
}
};
let {setLoadingStatus} = this.props;
const pdfDocGenerator = pdfMake.createPdf(docDefinition);
pdfDocGenerator.getDataUrl((dataUrl) => {
this.setState({
pdfData: dataUrl
});
setLoadingStatus('hide');
});
}
]
}
],
styles: {
title: {
fontSize: 15,
bold:true,
lineHeight:1.1
}
},
defaultStyle: {
fontSize: 11
}
}
const pdfDocGenerator = pdfMake.createPdf(docDefinition);
pdfDocGenerator.getDataUrl((dataUrl) => {
this.setState({
pdfData: dataUrl
});
let formData = new FormData();
var blob = dataURItoBlob(dataUrl);
formData.append("file", blob, `LEGAL_${data.code}+_VAKALATNAMA.pdf`);
formData.append("tenantId", localStorage.getItem('tenantId'));
formData.append("module", "LEGAL");
Api.commonApiPost("/filestore/v1/files",{},formData).then(function(response)
{
var noticeObj = {};
noticeObj['caseNo'] = data.summon.caseNo;
bold:true,
lineHeight: 1.2
},
subTitle: {
fontSize: 13
},
contentTitle:{
fontSize: 12
}
},
defaultStyle: {
fontSize: 11
}
};
const pdfDocGenerator = pdfMake.createPdf(docDefinition);
let {setLoadingStatus} = this.props;
var errorFunction = function(err) {
_this.props.errorCallback(err.message);
};
pdfDocGenerator.getDataUrl((dataUrl) => {
this.setState({
pdfData: dataUrl
});
let formData = new FormData();
var blob = dataURItoBlob(dataUrl);
formData.append("file", blob, `${license.applicationNumber || 0}_Rejection_Letter.pdf`);
formData.append("tenantId", _this.getTenantId());
exportPdf() {
if (!this.props.atom) return;
const docDefinition = wonUtils.createDocumentDefinitionFromPost(
this.props.atom
);
if (docDefinition) {
pdfMake.vfs = pdfFonts.pdfMake.vfs;
pdfMake.createPdf(docDefinition).download();
}
}