Direct Printing

Hi,
Need to print directly to the default printer attached to the user PC either from the Print button in the top menu or preferably a button in the code. By direct printing i mean no dialog box.
Any ideas are very much appreciated. The page to be printed only consists of few lines of text.
Thanks

See http://www.gdgsoft.info/htmlexe-discussion/how-disable-the-choose-printer-dialog-box-during-the-t2572.html?hilit=no%20print%20dialog
and the documentation

[quote=“gdgsupport”]See http://www.gdgsoft.info/htmlexe-discussion/how-disable-the-choose-printer-dialog-box-during-the-t2572.html?hilit=no%20print%20dialog
and the documentation[/quote]

Thanks… did that and managed to make the menu Print button to print directly to the default printer skipping the printer dialog box. Now the client is asking to do direct printing on loading the report page, that is, no need to show the report on screen but print it directly by something like window.onload window.print but this will still use the printer dialog box even after using:
exo_setglobalvariable(‘hedirectprint’,‘1’,‘true’);
exo_setglobalvariable(‘showpagesetup’,‘0’,‘true’);
exo_setglobalvariable(‘overridedefoptions’,‘1’,‘true’);

believe the client idea is good as there are too many clicks!!

do you have any idea how to do this, please?

Thanks for your support.
Regards,
Ron

In the mean time, i did the following procedure and this is printing the page before the current one and is showing the dialog box will print automatically without pressing any keys. hope i managed to explain well :slight_smile:
can you please let me know what i am doing wrong?

procedure directPrint;
begin
setglobalvar(“showpagesetup”,“0”,true);
setglobalvar(“overridedefoptions”,“1”,true);
PrintPages(1,1,false);
end;

Thanks,
ron

I forgot to ask: are you using Chromium or Trident engine?

Trident engine. Managed to solve the dialog box issue, that is, not showing but the problem is that when calling this code it will not print the current page from where the code is called but a previous one!!

How are you calling your HEScript directPrint procedure? Maybe it is not in the correct event, and is triggered before the webpage you want to print is correctly configured.

am calling this in the PHP code in the last part of the page that i need to print:

exo_runhescriptcom(“directPrint.directPagePrint”,"");

directPrint is the name of the new script i did and directPagePrint is the name of the procedure (code shown before)

BTW… have changed the name of the procedure from directPrint to directPagePrint. did this so that the name of the script and the name of the procedure will be different!!
thanks

It’s not the problem: you are calling the script from a PHP script. This means that the page has to be printed while you are generating its HTML code… Thus, it’s the previous page that is printed.

Solution: call your “directPrint.directPagePrint” procedure from JavaScript. Wait for the document to be fully loaded and execute your procedure. You can easily do this with JQuery for instance.
To call your procedure with JavaScript, see the documentation.

Hi I had similar problems. Except that instead of printing the previous page bu the printers prints my parent window.

I actually had this direct print script using javascript on my popup windows. But it only prints my parent window. Is there a solution for this?

Hi,

I’m trying this great tool named ExeOutPut for PHP, because I’m very interested to buy a copy.
I’m facing a print problem and I’m not able to solve it.
I didn’t found any example how can I print a page directly to printer, and this example in this post didn’t work out for me.
Does the javascript function window.print() work on ExeOutput for PHP ? If it doesn’t work, What is the way to print directly ?
Sorry bother you, friends. Unfortunately, I don’t have any idea how to do it.
Thanks in advanced.
Regards.

The window.print() function works. Or you can use php print functions, as described in this topic or with some search: