The requirement was to develop an Web application, who get connect to the database for information about the viewed documents. This documents are shown at the web application for printing them on the client's printer automatically without any engagement from the user. My first attempt was to develop an native web application and try the functionality local on my machine before it would be deployed to the test server. First i have to search, how i could get the information about the printers installed at the user’s os and then who to interact with them silently. During a little search attempt i found a solution for both requirements, which i looked. The first demo version of the Web application was ready to deploy. At this time i thought i was easy and i have finished my task.
But the first request to my Web application shows my some differences. There were no local installed user printers to choose and i could print anything out. I had to go back to the development and research some other solution from my current knowledge. After some hours of search, many form entries are shown me some solutions i had to try. The main reason points out of the forum entries, and this was the secure policy “same domain policy” i groped about in. This means, that my client could connect to another website from a javascript call. Other results show me many libraries to manipulate or create some pdf documents but not simple to load and print. One simple solution were to get the path of the document at runtime and then press automatically the print button of such an element. I tried it out but in ASP.net each handle event has invoked an reload of the web page so i lost my furthure informations.
At least i trip over an forum entry, where the author also has struggled with such a problem, and he came to the result, that i has to be a third party application, which process the printing. So I developed such an application who has a own host server which hosts an webservice, which i could connect from my web application at runtime via JQuery. For this i had to prepare such method who has as input parameter my document informations and creates an IFrame, which source is my local hosted web service. If you remember, ASP.net reloads the page after successfully processed the event, i had to collect all informations and put them over the URL Get method to the webservice. So i had a new limit about 2048 characters for the URL to send. At the end i take that restriction, and i still happy with the result, that I’m only allowed to print 50 documents per time.