Hi,
I’m trying to print a screenshot of the APP using Cordova Print Plugin with this method:
Note that I added 1px red border to see div’s limits.
/**
* printScreenShot method (simplified version)
* This method prints current app view.
*/
printScreenShot() {
// Capture image using cordova screenshot plugin
navigator.screenshot.save(
function(error,res) {
if(error) {
// Show error
let alert = Alert.create({
title: 'Error',
subTitle: 'Screenshot',
message: 'Some error occurred while trying to make screenshot',
buttons: ['OK']
});
this.nav.present(alert);
} else {
// Define HTML content
let fileContent:string = [
'<div style="width:100%; height: 100%; border: 1px solid red;">',
' <img style="height: 90%;" src="'+res.filePath+'" />',
'</div>'
].join('');
// FIXME: Print captured image
cordova.plugins.printer.print(fileContent, {
name:'capture.html',
landscape: true
});
}
},
'jpg', // screenshot format
95 // screenshot quality
);
}
It works well but always appears a second page to the print preview (see image):
Anyone is facing this same issue? How can I remove this second page?
PD: This error does not occur if I set the landscape parameter to false.
PD2: Sorry for my bad english.
Thanks in advance !