Users request to print reports that are generated on the server side. These reports are sent back as PDF files. There is no need to open these files before printing them.
I am using asp.net mvc 5 with js/jq.
NOTE : I KNOW BROWSERS DOES NOT LET US TO DO THIS DUE TO SECURITY REASONS but in my case only people with access can print the report we just need to prevent them from changing the content.
I have already tried different methods but seems chrome and other popular browsers do not let websites send print requests to printer without going through the print popup(ctrl + p) on chrome.
I do not mind the print popup so the user can still initiate the print.
BUT THE PROBLEM IS THERE IS AN OPTION TO SAVE/DOWNLOAD THE FILE on the print popup(ctrl + p).
There are security issues because the user can use a PDF editor tool and change valuable information like prices, bank account details etc and print the Document.
I tried print.js (https://printjs.crabbly.com/) but it did not work as it also opens print popup and save the option to save.
Currently we send the files to a api send them to printers through api’s. But there are printers that does not support api requests.
Which makes us to make the user choose the printer from the browser and print.
I am pretty much open to any type of suggestions and solutions.
solution can be client side / server side / windows services etc anything pretty much.
Just the user should not be able to tamper with the file before printing.
EDIT:
For some Context what happened was a user changed the account details of a invoice and tried to pocket some $$.
So the management asked us to not let the user see the PDF and print it directly.
But as in the comments a DETERMINED user can still scan it can edit stuff and print again.
So i guess we cant do anything about the DETERMINED users.
But can we do something about the UN-DETERMINED users..?
The people who uses the system and have access to those invoices are old people 40+ (70s-80s people) with minimal computer knowledge so its hard to say they will get ideas to scan and edit lol.
The harder it is to change the data the less likely it will give people ideas to change it. I think that’s what the management is trying to do.
And i dont think if we can print a password protected PDF. So that approach wont work as well.
If anything doesnt work i can tell the management that. But if there is anything big or small i can do to hinder people from changing pdf content i am up to implement it.
EDIT 2 :
The solution im currently trying to implement is to Install a windows app in the users pc and send the PDF to it THROUGH the client side(browser) and print from that app.
2
Answers
The solution im currently trying to implement is to Install a windows app in the users pc and send the PDF to it THROUGH the client side(browser) and print from that app.
I see two solutions:
If you send a PDF to the user, they have access to the PDF whether there’s a "Save" button or not. You can try to encrypt the PDF, but it needs to be decrypted to get the data and then it can be manipulated. If you could program the PDF password into the printer that would work, but if the printer is also a photocopier they could print the document, cut and paste new numbers onto it, and then make a photocopy.
You also state:
Sending direct to the printer is probably the best solution you have, especially if you can get a printer that will print encrypted PDFs (most of these printers will also save local copies of the PDFs so it would need to be encrypted here as well). This doesn’t fix the photocopier problem but if you can banish every photocopier from the premises it could work. You just have to give up the idea of letting people print to other devices.