I have been using the pdf generator plugin for a long time and it has helped me a lot.
But recently I have had some problems when the user changes the font size of the cell phone.
it happens that the pdf suffers with the change. When phone font increases, pdf font also increases and this causes layout clipping.
As for the app, I used the phonegap-plugin-mobile-accessibility plugin to ignore the Mobile Font changes and it worked. But still the source of the pdf when generated suffers from the changes.
follow my source below.
function PDFGenerator(fileName, folder, pdfhtml_conteudo, div_return) {
var fileName = fileName;
var options = {
documentSize: 'A4',
type: 'base64'
};
var pdfhtml = pdfhtml_conteudo;
pdf.fromData(pdfhtml, options)
.then(function (base64) {
// To define the type of the Blob
var contentType = "application/pdf";
// if cordova.file is not available use instead :
//var folderpath = "file:///storage/emulated/0/Download/"; //PASTA Download Armazenamento Interno
//var folderpath = cordova.file.externalRootDirectory + "/" + folder + ""; //PASTA Download Armazenamento Interno
//var folderpath = cordova.file.applicationDirectory + "/arquivos_pdf/" ; //PASTA www/app
if (Device_Type === 1) {
var folderpath = cordova.file.externalDataDirectory; //PASTA 'Android/data/com.eptusrondonia.einstein_sales/files/einstein_sales.db
} else {
var folderpath = cordova.file.tempDirectory; //PASTA TEMP IOS
}
savebase64AsPDF(folderpath, fileName, base64, contentType, div_return);
})
.catch((err) => alert(err));
Hello friends.
I have been using the pdf generator plugin for a long time and it has helped me a lot.
But recently I have had some problems when the user changes the font size of the cell phone.
it happens that the pdf suffers with the change. When phone font increases, pdf font also increases and this causes layout clipping.
As for the app, I used the phonegap-plugin-mobile-accessibility plugin to ignore the Mobile Font changes and it worked. But still the source of the pdf when generated suffers from the changes.
follow my source below.
function PDFGenerator(fileName, folder, pdfhtml_conteudo, div_return) {
}
pdfhtml_conteudo = `
`;
Note that the css I use directly in the html content. I tried to import like this:
var payload = _.template(pdfhtml_conteudo);
pdf.fromData(payload({css_file: cssFile}),
but I was not successful.