0

I need to print pdf silently in kiosk.

So far I was printing webpage and it worked fine:

//print plugin
<script src="js/jQuery-printPage-plugin/jquery.printPage.js" type="text/javascript"></script>

//definition
$(".btnPrint").printPage({
url: "adres of page to print",
attr: "href",
message:"Please wait."            

});

$(".btnPrint").trigger("click"); //I simulate user clicking print button

(Also I added silent print in firefox about:config to hide print dialog. (similar to chrome --kiosk-printing))

The problem is that pdf won't print.

SecurityError: Permission denied to access property "print" on cross-origin object

I don't need to use this plugin, any working plugin will be ok. I have found a lot of stuff all over the internet concerning the problem, but none is work for me - I tried various solutions in chrome/ff 1) creating new window (won't include pdf directly, need to use iframe/embed), printing via object or iframe. 2) On chrome I cant even get pdf printed from iframe at all (I get blank iframe) 3) firefox I can't print iframe contents with pdf inside (whole page that contain pdf will print, but I multiple page pdf will be cropped).

Please have in mind that I'm in total control of the kiosk (windows 7), and I can use any browser, install any additional software.

baron_bartek
  • 1,073
  • 2
  • 20
  • 39
  • Wait, you were able to print pages without print dialogue? This sounds like a security breach, what prevents the random page I accessed on net from printing 10000 pages on my printer? Doesn't sound like something you should be able to do. Could it be they patched the security hole? – DanteTheSmith Jan 26 '18 at 11:37
  • It's not somthing they patched, becouse I can print webpage ok, and I have never tried pdf before. – baron_bartek Jan 26 '18 at 11:52
  • Also kiosk is in intranet and does not acces anything except my app. – baron_bartek Jan 26 '18 at 12:01
  • Maybe it is but still it sounds odd that something could print onto printer or PDF without any kind of save PDF popup or print confirmation. What is then to prevent some malicious app using same code as you do from filling up my hard drive with PDF files. Even worse what prevents it from printing executable txt files and trying to replace key system files in order to get em run upon restart – DanteTheSmith Jan 26 '18 at 12:42
  • You suggest, that all the kiosks (hospitals, offices, everywhere) are not really 100% safe. You're propably right - and you don't really need to hack them, you can simply break the lock (I had to do this once when the key was lost) - but this doesn't really bring me closer to find solution to my problem. – baron_bartek Jan 26 '18 at 13:19

1 Answers1

0

As usually latelly I answear to myself :P this is how I did it: FPDF+FPDI autoprint (not really answear to a question but working alternative in this problem)

baron_bartek
  • 1,073
  • 2
  • 20
  • 39