About Printers - Research Report on Cumulative Number of Printing Times

About Printers - Research Report on Cumulative Number of Printing Times

At this stage, the printing function used on the web side is based on the window.print() method exposed to the outside world in webApi. This fn does not return anything, and besides this, webApi has no other interfaces related to the printing module.
but! Provides window.print() monitoring methods, window.onafterprint and window.onbeforeprint.
When using the window.print() method to print, a print selection box will pop up.
insert image description here
Whether you choose to print or cancel, window.Onafterprint will be triggered, and fn will return an Event object.
insert image description here
It can be seen that as far as the returned Event object is concerned, all the parameters seen are the same. If this method is used to calculate the number of prints, it will be impossible to distinguish whether the user clicked cancel or clicked print.

As far as the current information is concerned, it should be impossible to realize whether the user clicks to cancel or print through WebAPI.
If it is necessary to know whether the user clicked print, this may require the use of a third-party plug-in.
Researched a component http://www.lodop.net/;
to use this component, users generally need to download and install a plug-in before using the corresponding printing function.

insert image description here
Third-party components have their own printing rules, and the existing printing functions certainly do not apply.
insert image description here
The third-party component provides corresponding callbacks such as whether the printing is successful or not.

Supongo que te gusta

Origin blog.csdn.net/m0_37138425/article/details/122976043
Recomendado
Clasificación