6

Anyone knows how to print a file without showing print preview in cross browsers, API or libraries like jQuery or javascript or else.

  • Print a content without print preview (just silent print)
  • Print once, when softcopy is printed then the softcopy is expired because I want to avoid reprint the softcopy more than one by the user for security reason, especially if that is receipt is for reimburstment.

that is simple or not?

Reason why we won't show the print preview because there is possibility that user could

  • screenshot the file then photoshop the file values
  • change the contents
  • can duplicate copy

In that way it is difficult to monitor who printed the sensitive file in online.

光 Hikari No kun
  • 418
  • 1
  • 5
  • 27
  • Silent print to what? The default printer? In that case what's stopping me from installing a Postscript or PDF printer and simply printing to get a reusable PostScript or PDF file? Allowing a web site to start printing a file silently (without any user interaction which is now the print preview dialog) would be a very bad idea. – David van Driessche Jun 01 '15 at 09:06
  • Why, because I'm right? Perhaps you should explain why you're commenting like that, we might both learn something. – David van Driessche Jun 03 '15 at 12:09
  • Sorry for you if you think that is bad idea but @DavidvanDriessche in this case the reason why we won't show the print preview because there is possibility that user could, screenshot the file then photoshop the file values, change the contents, can duplicate copy, i want to monitor the REPRINTING OF RECEIPTS. The authorized users may change the values that's why it's so sensitive i just want one time printing of receipt. – 光 Hikari No kun Jun 04 '15 at 03:38
  • I actually understood your question the first time but my comment remains valid. First of all, printing inherently has the risk of having your document printed to a PostScript or PDF file. Any Mac computer has a "Save as PDF file" possibility in the Print Preview dialog from any application. So much for security. And secondly - whatever YOUR particular purpose - allowing a web site to print without user interaction (silently), which was your question, is a security risk and SHOULD NOT work. Ever. The answer you say is correct doesn't print silently and it doesn't solve your security problem. – David van Driessche Jun 04 '15 at 05:07

1 Answers1

1

Printing from a web page is always with user interaction. However, you can prevent the document from being displayed. Shown here is the HTML5 control from my company's XtremeDocumentStudio .NET product. http://www.gnostice.com/nl_article.asp?id=291&t=Print_without_preview_using_XtremeDocumentStudio_NETs_HTML5_document_viewer_control

Animation showing print without preview

gn1
  • 526
  • 2
  • 5
  • That's it, but i will try this method before i accept this answer – 光 Hikari No kun Jun 02 '15 at 02:16
  • Any other suggestion? because i don't use .net, i'm using liferay for this method – 光 Hikari No kun Jun 02 '15 at 02:23
  • 1
    You can host it on a subdomain on another server. Document-processing is IO intensive. If you have a lot of documents to be displayed, then a separate server is recommended. – gn1 Jun 03 '15 at 03:51
  • I only have 1 document to be displayed. How is this possible? I not using .NET. I'm using liferay (JAVA). – 光 Hikari No kun Jun 04 '15 at 03:46
  • 1
    We have a Java PDF library that can do it. However, it will also require end-users to have have JRE installed and the Java plugin installed in the web browser. – gn1 Jun 05 '15 at 03:20