WAP4 EB Printing API Keep the printer open between pages

// Expert user has replied.
S Scott MacLean 3 years 7 months ago
2 1 0

I can search and find a printer, connect to the printer, and print to the printer.  What I need to do is keep the printer open and print to it on subsequent pages as well.
 
How do I do that?  How do I keep the printer object accessible on another page without re-doing the printer search?
 
Does setDefault have anything to do with it?  Is there another way?
 
Thanks,
Scott

Please Register or Login to post a reply

1 Replies

R Rajiv Kashyap

Hi MacLean,

HTML5 local storage can be used to achieve this ,where web storage, web applications can store data locally within the user's browser and all pages, from one origin, can store and access the same data.

To get this working,you need to do setItem item on your main/first page of the application as localStorage.setItem('printerObj', printers_array[i]);
and in the similar ways you need to getItem on all the subsequent pages wherever you need to access the printer as localStorage.getItem('printerObj');
This will help you to search, connect and can be used to print from any other pages till you are not closing the application.
Note : If you are changing any setting you need to start again the entire process of printer again i.e (search,connect and print).

Thanks,
Rajiv

CONTACT
Can’t find what you’re looking for?