Page Print

6

Good morning, I wonder if there is any way to count how many times a particular page (html) has been printed. I know we can count the times that a modal was opened with the click of the button, in the same modal I have a button to print (the content of it), but I need to count how many times that content was actually printed. Is this possible?

    
asked by anonymous 28.01.2016 / 11:32

1 answer

3

No.

You can just count how many times the user has clicked your print button. If this is enough: the same way you increment the modal open counter, you can increment the click counter of the print button. You can do something like this:

HTML:

<button id="botaoPraImprimir" type="button">Imprimir</button>
<input type="hidden" id="contadorDeImpressoes" value="0"> 

Javascript, with jQuery:

var $contadorImpressoes = $("#contadorImpressoes");
$("#botaoPraImprimir").on("click", function () {
    let valorAtual = parseInt($contadorImpressoes).val();
    $contadorImpressoes.val(valorAtual + 1);
});

Note that this will count how many times the print button of your modal has been printed. So you know how many times the user had the intention to print .

The print button in the browser's print dialog is not accessible via code - and there is no browser print event that you can capture or intercept. You can not count how many times a document was actually printed , or how many copies were made .

    
25.07.2017 / 14:07