I have a program that runs via IIE and was build using IntraWeb components. Now I have a invoice to print and I can't figure out how to get the report to print on my local printer. Any help would be greatly appreciated.
This is a piece of html code we are using in our automated ticket machines to print a ticket (this works with no problems over 12.000.000 times a year). We are using the build in active x control to print the ticket? In our case we did not the customer to have to push a print button and we did not want the select printer box to pop up. If this is usefull to you please feel free to use it. the code between the [[ and ]] are our own tag system.
function loadPage() { var sUrl = "[[WWWDIR]]TestTicket?&LNG=[[LNG]]&COMP=[[COMP]]" ; DHTMLED.ShowDetails = false; DHTMLED.BrowseMode = true; DHTMLED.loadUrl(sUrl) ; Start_Timer(); printPage() ; }
function printPage() { if (DHTMLED.Busy) { setTimeout("printPage()", 500) ; return; } DHTMLED.PrintDocument(false) ; }
function GoBack () { var url = "[[XPAGE:ATM1:FEATSEL:HOME:0]]&LNG=[[LNG]]&DATE=[[DATE]]"; parent.location.href = url; }
var tStart = null; var timerID = 0;
function Start_Timer() { tStart = new Date(); timerID = setTimeout("Update_Timer()", 1000); }
function Update_Timer() { if (timerID) clearTimeout(timerID); if (!tStart) tStart = new Date(); var tDate = new Date(); var tDiff = tDate.getTime() - tStart.getTime(); tDate.setTime(tDiff); if (tDate.getSeconds() < 10) timerID = setTimeout("Update_Timer()", 1000); else GoBack(); }
We have a similar requirement but could not get an effective solution still. We need to first generate a report then export it to HTML or PDF using Pragnaan's export devices and then it needs to be printed directly without the user hitting the print button. Currently we are only able to export the report and display it on the client's browser and then the user there has to print it manually. We want to avoid this and directly print it to the printer connected to the client's browser. While the below code supposedly does that I am not able to understand it. Can you please explain it in more detail? Do I need to write a new activeX control? Is there any other way to do it?
I took a look at both their components sets, but can't figure out how they work with IntraWeb. In the Intraweb app I still have to calculate the report and then direct it to one of the devices above and I can't find any examples of how to do this using IntraWeb.
Recently (yesterday) we did even add code that doesn't print the page when the page could not be composed.
for other people wanting to know what you can do with DHTMLED, just import the active-x control into delphi and you will see a lot in the object inspector or just look 'while programming' to the properties.
Comments
to print a ticket (this works with no problems over 12.000.000 times a
year).
We are using the build in active x control to print the ticket? In our case
we did not the customer to have to push a print button and we did not want
the select printer box to pop up.
If this is usefull to you please feel free to use it.
the code between the [[ and ]] are our own tag system.
function loadPage() {
var sUrl = "[[WWWDIR]]TestTicket?&LNG=[[LNG]]&COMP=[[COMP]]" ;
DHTMLED.ShowDetails = false;
DHTMLED.BrowseMode = true;
DHTMLED.loadUrl(sUrl) ;
Start_Timer();
printPage() ;
}
function printPage() {
if (DHTMLED.Busy) {
setTimeout("printPage()", 500) ;
return;
}
DHTMLED.PrintDocument(false) ;
}
function GoBack () {
var url = "[[XPAGE:ATM1:FEATSEL:HOME:0]]&LNG=[[LNG]]&DATE=[[DATE]]";
parent.location.href = url;
}
var tStart = null;
var timerID = 0;
function Start_Timer() {
tStart = new Date();
timerID = setTimeout("Update_Timer()", 1000);
}
function Update_Timer() {
if (timerID) clearTimeout(timerID);
if (!tStart) tStart = new Date();
var tDate = new Date();
var tDiff = tDate.getTime() - tStart.getTime();
tDate.setTime(tDiff);
if (tDate.getSeconds() < 10)
timerID = setTimeout("Update_Timer()", 1000);
else
GoBack();
}
We need to first generate a report then export it to HTML or PDF using
Pragnaan's export devices and then it needs to be printed directly without
the user hitting the print button. Currently we are only able to export the
report and display it on the client's browser and then the user there has to
print it manually. We want to avoid this and directly print it to the
printer connected to the client's browser.
While the below code supposedly does that I am not able to understand it.
Can you please explain it in more detail? Do I need to write a new activeX
control? Is there any other way to do it?
Thanks in advance,
Vikram
I took a look at both their components sets, but can't figure out how they
work with IntraWeb. In the Intraweb app I still have to calculate the
report
and then direct it to one of the devices above and I can't find any examples
of how to do this using IntraWeb.
Thanks
Ed
Several people in the IntraWeb newsgroups have discussed using RB to produce
'reports'. I suggest you ask there.
Regards
Stuart
--
Stuart Seath
Seath Computer Services
(mailto:stuart.seath@seath.co.uk)
I just replied to your email about using the routines to export to PDF (to
file and to stream).
Let us know if you have further questions.
--
Girish Patil
Pragnaan Software
www.pragnaan.com
Recently (yesterday) we did even add code that doesn't print the page when
the page could not be composed.
for other people wanting to know what you can do with DHTMLED, just import
the active-x control into delphi and you will see a lot in the object
inspector or just look 'while programming' to the properties.
Harry