I have a system where I need to print a PDF when I click the button.
The url is constructed according to the shipping ID, so dynamically, I use an iframe that will load the data, and when loaded, I call a function to print what is in iframe
.
I'm doing this:
$scope.imprimir = function imprimir (protocolo_id) {
if (imprimir.carregando) return;
var url_protocolo = '/protocolos/imprimir/' + protocolo_id;
imprimir.carregando = true;
angular.element('#imprimir_protocolo').attr('src', url_protocolo).on('load', function () {
var frame = $window.frames['imprimir_protocolo'];
frame.focus();
frame.print();
delete imprimir.carregando;
$scope.$apply();
})
}
In the line where I am calling frame.focus()
, when I use Firefox, the following error is appearing:
Permission denied to access property "print"