Home » Archived » BIRT » How to do Client Printing and delete xml source file
How to do Client Printing and delete xml source file [message #740039] |
Tue, 18 October 2011 04:54 |
cbr125x Messages: 34 Registered: July 2011 |
Member |
|
|
i have some questions, hopefully u can help me.
1. when user want to print the report, user can click "Print Report" button. then window pop up will show, user must choose print format in PDF or HTML.
is it possible we do not show this Pop up window, and directly print with html format or PDF format?
2. when we choose print with HTML format, then pop up window will show with html report inside, can we close this window after printing the report? or can we do not show this HTML report window when we print?
3. Actually i use ASP.NET and using BIRT as the report application to show my report.
ussually when i generate report with Crystal Report, i send Datatable object as the source of the report, now in BIRT i convert the datatable to XML and use this temporary XML file as the source of the report. is it possible to delete this XML file after the report is generated? if possible, can u tell me how to do that?
Many thanks for u BIRT Expert..
[Updated on: Tue, 18 October 2011 04:55] Report message to a moderator
|
|
|
Re: How to do Client Printing and delete xml source file [message #740541 is a reply to message #740039] |
Tue, 18 October 2011 16:12 |
|
1 - You can change the javascript functions that are used in the viewer
to make the Dialog automatically submit, which will launch the windows
print dialog. Look in the webcontent\birt\ajax\ui\dialog direcotry and
open the BirtPrintReportDialog.js file. Call the okPres in the preShow
function as shown below.
__preShow: function()
{
// disable the toolbar buttons
birtUtility.setButtonsDisabled ( "toolbar", true );
// disable the Navigation Bar buttons
birtUtility.setButtonsDisabled ( "navigationBar", true );
this.__okPress();
}
2 - Not sure how you would do this.
3 - I have not tried this but in the afterClose event you could try
something like:
try{
importPackage(Packages.java.io);
f = new File(fileName);
f.delete();
} catch (e) {
//do nothing
}
Jason
On 10/18/2011 12:54 AM, cbr125x wrote:
> i have 2 questions, hopefully u can help me.
>
> 1. when user want to print the report, user can click "Print Report"
> button. then window pop up will show, user must choose print format in
> PDF or HTML.
> is it possible we do not show this Pop up window, and directly print
> with html format or PDF format?
> 2. when we choose print with HTML format, then pop up window will show
> with html report inside, can we close this window after printing the
> report? or can we do not show this HTML report window when we print?
>
> 3. Actually i use ASP.NET and using BIRT as the report application to
> show my report.
> ussually when i generate report with Crystal Report, i send Datatable
> object as the source of the report, now in BIRT i convert the datatable
> to XML and use this temporary XML file as the source of the report. is
> it possible to delete this XML file after the report is generated? if
> possible, can u tell me how to do that?
>
> Many thanks for u BIRT Expert..
|
|
|
Re: How to do Client Printing and delete xml source file [message #741074 is a reply to message #740541] |
Wed, 19 October 2011 06:46 |
cbr125x Messages: 34 Registered: July 2011 |
Member |
|
|
Hi Jason,
1. i put this.__okPress(); in the script, but i got javascript error in mask.js.
hide: function()
{
if(this.zIndexStack.length == 1)
{
this._updateElements(this._baseElements, true);
Element.hide( this.__mask );
this.zIndexStack.pop();
this.zIndexCurrent = this.zIndexBase;
}
else
{
//i think i got error here
this.zIndexCurrent = this.zIndexStack.pop();
this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
}
}
when i comment
this.zIndexCurrent = this.zIndexStack.pop();
this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
the error gone, but the pop up window won't close.
3. i got error to in line :
f.delete();
error message : missing name after. operator
can u suggest me the solution?
Thx
Jason Weathersby wrote on Tue, 18 October 2011 12:121 - You can change the javascript functions that are used in the viewer
to make the Dialog automatically submit, which will launch the windows
print dialog. Look in the webcontent\birt\ajax\ui\dialog direcotry and
open the BirtPrintReportDialog.js file. Call the okPres in the preShow
function as shown below.
__preShow: function()
{
// disable the toolbar buttons
birtUtility.setButtonsDisabled ( "toolbar", true );
// disable the Navigation Bar buttons
birtUtility.setButtonsDisabled ( "navigationBar", true );
this.__okPress();
}
2 - Not sure how you would do this.
3 - I have not tried this but in the afterClose event you could try
something like:
try{
importPackage(Packages.java.io);
f = new File(fileName);
f.delete();
} catch (e) {
//do nothing
}
Jason
On 10/18/2011 12:54 AM, cbr125x wrote:
> i have 2 questions, hopefully u can help me.
>
> 1. when user want to print the report, user can click "Print Report"
> button. then window pop up will show, user must choose print format in
> PDF or HTML.
> is it possible we do not show this Pop up window, and directly print
> with html format or PDF format?
> 2. when we choose print with HTML format, then pop up window will show
> with html report inside, can we close this window after printing the
> report? or can we do not show this HTML report window when we print?
>
> 3. Actually i use ASP.NET and using BIRT as the report application to
> show my report.
> ussually when i generate report with Crystal Report, i send Datatable
> object as the source of the report, now in BIRT i convert the datatable
> to XML and use this temporary XML file as the source of the report. is
> it possible to delete this XML file after the report is generated? if
> possible, can u tell me how to do that?
>
> Many thanks for u BIRT Expert..
|
|
|
Re: How to do Client Printing and delete xml source file [message #741440 is a reply to message #741074] |
Wed, 19 October 2011 14:34 |
|
What version are you using? I tried this with 3.7 and did not get any
error.
The file.delete seems to have an issue conflicting with the JavaScript
delete operator. You will either have to implement your delete
operation in a Java Event Handler or just write a class that deletes the
file and add it to the birt classpath and call it from your script.
For Java event handlers read over this:
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php#javaevents
Jason
On 10/19/2011 2:47 AM, cbr125x wrote:
> Hi Jason, 1. i put this.__okPress(); in the script, but i got javascript
> error in mask.js.
> hide: function()
> {
> if(this.zIndexStack.length == 1)
> {
> this._updateElements(this._baseElements, true);
> Element.hide( this.__mask );
> this.zIndexStack.pop();
> this.zIndexCurrent = this.zIndexBase;
> }
> else
> {
> //i think i got error here
> this.zIndexCurrent = this.zIndexStack.pop();
> this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
> }
> }
> when i comment this.zIndexCurrent = this.zIndexStack.pop();
> this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
> the error gone, but the pop up window won't close.
>
>
> 3. i got error to in line :
> f.delete();
> error message : missing name after. operator
>
> can u suggest me the solution?
> Thx
>
> Jason Weathersby wrote on Tue, 18 October 2011 12:12
>> 1 - You can change the javascript functions that are used in the
>> viewer to make the Dialog automatically submit, which will launch the
>> windows print dialog. Look in the webcontent\birt\ajax\ui\dialog
>> direcotry and open the BirtPrintReportDialog.js file. Call the okPres
>> in the preShow function as shown below.
>>
>> __preShow: function()
>> {
>> // disable the toolbar buttons
>> birtUtility.setButtonsDisabled ( "toolbar", true );
>>
>> // disable the Navigation Bar buttons
>> birtUtility.setButtonsDisabled ( "navigationBar", true );
>> this.__okPress();
>> }
>>
>> 2 - Not sure how you would do this.
>>
>> 3 - I have not tried this but in the afterClose event you could try
>> something like:
>>
>> try{
>> importPackage(Packages.java.io);
>> f = new File(fileName);
>> f.delete();
>> } catch (e) {
>> //do nothing
>> }
>>
>> Jason
>>
>>
>> On 10/18/2011 12:54 AM, cbr125x wrote:
>> > i have 2 questions, hopefully u can help me.
>> >
>> > 1. when user want to print the report, user can click "Print Report"
>> > button. then window pop up will show, user must choose print format in
>> > PDF or HTML.
>> > is it possible we do not show this Pop up window, and directly print
>> > with html format or PDF format?
>> > 2. when we choose print with HTML format, then pop up window will show
>> > with html report inside, can we close this window after printing the
>> > report? or can we do not show this HTML report window when we print?
>> >
>> > 3. Actually i use ASP.NET and using BIRT as the report application to
>> > show my report.
>> > ussually when i generate report with Crystal Report, i send Datatable
>> > object as the source of the report, now in BIRT i convert the datatable
>> > to XML and use this temporary XML file as the source of the report. is
>> > it possible to delete this XML file after the report is generated? if
>> > possible, can u tell me how to do that?
>> >
>> > Many thanks for u BIRT Expert..
>
>
|
|
|
Re: How to do Client Printing and delete xml source file [message #741896 is a reply to message #741440] |
Thu, 20 October 2011 01:58 |
cbr125x Messages: 34 Registered: July 2011 |
Member |
|
|
I use BIRT Viewer 3.7 and Eclipse Helios 2.6.2 for the design.
i try to describe what i found when i tried to debug it, maybe you can find hint.
like I said, i thought i got error in hide function
hide: function()
{
if(this.zIndexStack.length == 1)
{
this._updateElements(this._baseElements, true);
Element.hide( this.__mask );
this.zIndexStack.pop();
this.zIndexCurrent = this.zIndexBase;
}
else
{
this.zIndexCurrent = this.zIndexStack.pop();
this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
}
}
I alert this.zIndexStack.length, the result is 0
I alert this.zIndexCurrent, the result is undefined.
For Java event handlers, I don't quite understand.
but i'll try to learn it first
Thanks
Jason Weathersby wrote on Wed, 19 October 2011 10:34What version are you using? I tried this with 3.7 and did not get any
error.
The file.delete seems to have an issue conflicting with the JavaScript
delete operator. You will either have to implement your delete
operation in a Java Event Handler or just write a class that deletes the
file and add it to the birt classpath and call it from your script.
For Java event handlers read over this:
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php#javaevents
Jason
On 10/19/2011 2:47 AM, cbr125x wrote:
> Hi Jason, 1. i put this.__okPress(); in the script, but i got javascript
> error in mask.js.
> hide: function()
> {
> if(this.zIndexStack.length == 1)
> {
> this._updateElements(this._baseElements, true);
> Element.hide( this.__mask );
> this.zIndexStack.pop();
> this.zIndexCurrent = this.zIndexBase;
> }
> else
> {
> //i think i got error here
> this.zIndexCurrent = this.zIndexStack.pop();
> this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
> }
> }
> when i comment this.zIndexCurrent = this.zIndexStack.pop();
> this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
> the error gone, but the pop up window won't close.
>
>
> 3. i got error to in line :
> f.delete();
> error message : missing name after. operator
>
> can u suggest me the solution?
> Thx
>
> Jason Weathersby wrote on Tue, 18 October 2011 12:12
>> 1 - You can change the javascript functions that are used in the
>> viewer to make the Dialog automatically submit, which will launch the
>> windows print dialog. Look in the webcontent\birt\ajax\ui\dialog
>> direcotry and open the BirtPrintReportDialog.js file. Call the okPres
>> in the preShow function as shown below.
>>
>> __preShow: function()
>> {
>> // disable the toolbar buttons
>> birtUtility.setButtonsDisabled ( "toolbar", true );
>>
>> // disable the Navigation Bar buttons
>> birtUtility.setButtonsDisabled ( "navigationBar", true );
>> this.__okPress();
>> }
>>
>> 2 - Not sure how you would do this.
>>
>> 3 - I have not tried this but in the afterClose event you could try
>> something like:
>>
>> try{
>> importPackage(Packages.java.io);
>> f = new File(fileName);
>> f.delete();
>> } catch (e) {
>> //do nothing
>> }
>>
>> Jason
>>
>>
>> On 10/18/2011 12:54 AM, cbr125x wrote:
>> > i have 2 questions, hopefully u can help me.
>> >
>> > 1. when user want to print the report, user can click "Print Report"
>> > button. then window pop up will show, user must choose print format in
>> > PDF or HTML.
>> > is it possible we do not show this Pop up window, and directly print
>> > with html format or PDF format?
>> > 2. when we choose print with HTML format, then pop up window will show
>> > with html report inside, can we close this window after printing the
>> > report? or can we do not show this HTML report window when we print?
>> >
>> > 3. Actually i use ASP.NET and using BIRT as the report application to
>> > show my report.
>> > ussually when i generate report with Crystal Report, i send Datatable
>> > object as the source of the report, now in BIRT i convert the datatable
>> > to XML and use this temporary XML file as the source of the report. is
>> > it possible to delete this XML file after the report is generated? if
>> > possible, can u tell me how to do that?
>> >
>> > Many thanks for u BIRT Expert..
>
>
|
|
|
Re: How to do Client Printing and delete xml source file [message #742531 is a reply to message #741896] |
Thu, 20 October 2011 15:23 |
|
Instead of modifying the viewer can you add a text element to the report
and set its type to html and enter the following:
<script language="JavaScript">
function wPrint()
{
birtEventDispatcher.broadcastEvent( birtEvent.__E_PRINT );
var pdfrad = document.getElementById("printAsPDF");
pdfrad.checked = true;
var btndv = document.getElementById("printReportDialogokButton");
var bnar=btndv.getElementsByTagName("input");
var btn = bnar[0];
btn.click();
}
function printDelay()
{
setTimeout("wPrint()", 1000);
}
printDelay();
</script>
Jason
On 10/19/2011 9:58 PM, cbr125x wrote:
> I use BIRT Viewer 3.7 and Eclipse Helios 2.6.2 for the design.
> i try to describe what i found when i tried to debug it, maybe you can
> find hint.
> like I said, i thought i got error in hide function
> hide: function()
> {
> if(this.zIndexStack.length == 1)
> {
> this._updateElements(this._baseElements, true);
> Element.hide( this.__mask );
> this.zIndexStack.pop();
> this.zIndexCurrent = this.zIndexBase;
> }
> else
> {
> this.zIndexCurrent = this.zIndexStack.pop();
> this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length -1];
> }
> }
>
> I alert this.zIndexStack.length, the result is 0
> I alert this.zIndexCurrent, the result is undefined.
>
> For Java event handlers, I don't quite understand.
> but i'll try to learn it first
>
> Thanks
>
>
> Jason Weathersby wrote on Wed, 19 October 2011 10:34
>> What version are you using? I tried this with 3.7 and did not get any
>> error.
>>
>> The file.delete seems to have an issue conflicting with the JavaScript
>> delete operator. You will either have to implement your delete
>> operation in a Java Event Handler or just write a class that deletes
>> the file and add it to the birt classpath and call it from your script.
>>
>> For Java event handlers read over this:
>> http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php#javaevents
>>
>>
>> Jason
>>
>> On 10/19/2011 2:47 AM, cbr125x wrote:
>> > Hi Jason, 1. i put this.__okPress(); in the script, but i got
>> javascript
>> > error in mask.js.
>> > hide: function()
>> > {
>> > if(this.zIndexStack.length == 1)
>> > {
>> > this._updateElements(this._baseElements, true);
>> > Element.hide( this.__mask );
>> > this.zIndexStack.pop();
>> > this.zIndexCurrent = this.zIndexBase;
>> > }
>> > else
>> > {
>> > //i think i got error here
>> > this.zIndexCurrent = this.zIndexStack.pop();
>> > this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length
>> -1];
>> > }
>> > }
>> > when i comment this.zIndexCurrent = this.zIndexStack.pop();
>> > this.__mask.style.zIndex = this.zIndexStack[this.zIndexStack.length
>> -1];
>> > the error gone, but the pop up window won't close.
>> >
>> >
>> > 3. i got error to in line :
>> > f.delete();
>> > error message : missing name after. operator
>> >
>> > can u suggest me the solution?
>> > Thx
>> >
>> > Jason Weathersby wrote on Tue, 18 October 2011 12:12
>> >> 1 - You can change the javascript functions that are used in the
>> >> viewer to make the Dialog automatically submit, which will launch the
>> >> windows print dialog. Look in the webcontent\birt\ajax\ui\dialog
>> >> direcotry and open the BirtPrintReportDialog.js file. Call the okPres
>> >> in the preShow function as shown below.
>> >>
>> >> __preShow: function()
>> >> {
>> >> // disable the toolbar buttons
>> >> birtUtility.setButtonsDisabled ( "toolbar", true );
>> >>
>> >> // disable the Navigation Bar buttons
>> >> birtUtility.setButtonsDisabled ( "navigationBar", true );
>> >> this.__okPress();
>> >> }
>> >>
>> >> 2 - Not sure how you would do this.
>> >>
>> >> 3 - I have not tried this but in the afterClose event you could try
>> >> something like:
>> >>
>> >> try{
>> >> importPackage(Packages.java.io);
>> >> f = new File(fileName);
>> >> f.delete();
>> >> } catch (e) {
>> >> //do nothing
>> >> }
>> >>
>> >> Jason
>> >>
>> >>
>> >> On 10/18/2011 12:54 AM, cbr125x wrote:
>> >> > i have 2 questions, hopefully u can help me.
>> >> >
>> >> > 1. when user want to print the report, user can click "Print Report"
>> >> > button. then window pop up will show, user must choose print
>> format in
>> >> > PDF or HTML.
>> >> > is it possible we do not show this Pop up window, and directly print
>> >> > with html format or PDF format?
>> >> > 2. when we choose print with HTML format, then pop up window will
>> show
>> >> > with html report inside, can we close this window after printing the
>> >> > report? or can we do not show this HTML report window when we print?
>> >> >
>> >> > 3. Actually i use ASP.NET and using BIRT as the report
>> application to
>> >> > show my report.
>> >> > ussually when i generate report with Crystal Report, i send
>> Datatable
>> >> > object as the source of the report, now in BIRT i convert the
>> datatable
>> >> > to XML and use this temporary XML file as the source of the
>> report. is
>> >> > it possible to delete this XML file after the report is
>> generated? if
>> >> > possible, can u tell me how to do that?
>> >> >
>> >> > Many thanks for u BIRT Expert..
>> >
>> >
>
>
|
|
| |
Re: How to do Client Printing and delete xml source file [message #748274 is a reply to message #742949] |
Mon, 24 October 2011 15:49 |
|
I just tried this in 3.7 with the viewer deployed to tomcat and using
the frameset mapping and it worked fine. Are you using the /frameset
mapping?
Jason
On 10/20/2011 9:39 PM, cbr125x wrote:
> Hi Jason,
> when I run the report in Eclipse, it got no error,
> but when i run in tomcat with BIRT Viewer, i got error
> "birtEventDispatcher is undefined". actually what you suggest is true,
> but i want the window print only show when user click the print button.
> Thx, sorry for disturbing you again.
>
>
> Jason Weathersby wrote on Thu, 20 October 2011 11:23
>> Instead of modifying the viewer can you add a text element to the
>> report and set its type to html and enter the following:
>>
>> <script language="JavaScript">
>> function wPrint()
>> {
>> birtEventDispatcher.broadcastEvent( birtEvent.__E_PRINT );
>>
>> var pdfrad = document.getElementById("printAsPDF");
>> pdfrad.checked = true;
>> var btndv = document.getElementById("printReportDialogokButton");
>> var bnar=btndv.getElementsByTagName("input");
>> var btn = bnar[0];
>> btn.click();
>>
>> }
>> function printDelay()
>> {
>> setTimeout("wPrint()", 1000);
>> }
>> printDelay();
>> </script>
>>
>>
>> Jason
>> >
>
>
|
|
|
Re: How to do Client Printing and delete xml source file [message #751434 is a reply to message #748274] |
Wed, 26 October 2011 04:02 |
cbr125x Messages: 34 Registered: July 2011 |
Member |
|
|
Yes, i used frameset, can u attach the example u made Jason? Thanks
Jason Weathersby wrote on Mon, 24 October 2011 11:49I just tried this in 3.7 with the viewer deployed to tomcat and using
the frameset mapping and it worked fine. Are you using the /frameset
mapping?
Jason
On 10/20/2011 9:39 PM, cbr125x wrote:
> Hi Jason,
> when I run the report in Eclipse, it got no error,
> but when i run in tomcat with BIRT Viewer, i got error
> "birtEventDispatcher is undefined". actually what you suggest is true,
> but i want the window print only show when user click the print button.
> Thx, sorry for disturbing you again.
>
>
> Jason Weathersby wrote on Thu, 20 October 2011 11:23
>> Instead of modifying the viewer can you add a text element to the
>> report and set its type to html and enter the following:
>>
>> <script language="JavaScript">
>> function wPrint()
>> {
>> birtEventDispatcher.broadcastEvent( birtEvent.__E_PRINT );
>>
>> var pdfrad = document.getElementById("printAsPDF");
>> pdfrad.checked = true;
>> var btndv = document.getElementById("printReportDialogokButton");
>> var bnar=btndv.getElementsByTagName("input");
>> var btn = bnar[0];
>> btn.click();
>>
>> }
>> function printDelay()
>> {
>> setTimeout("wPrint()", 1000);
>> }
>> printDelay();
>> </script>
>>
>>
>> Jason
>> >
>
>
|
|
|
Re: How to do Client Printing and delete xml source file [message #752706 is a reply to message #751434] |
Wed, 26 October 2011 13:42 |
|
Here it is.
Jason
On 10/26/2011 12:02 AM, cbr125x wrote:
> Yes, i used frameset, can u attach the example u made Jason? Thanks
>
> Jason Weathersby wrote on Mon, 24 October 2011 11:49
>> I just tried this in 3.7 with the viewer deployed to tomcat and using
>> the frameset mapping and it worked fine. Are you using the /frameset
>> mapping?
>>
>> Jason
>>
>> On 10/20/2011 9:39 PM, cbr125x wrote:
>> > Hi Jason,
>> > when I run the report in Eclipse, it got no error,
>> > but when i run in tomcat with BIRT Viewer, i got error
>> > "birtEventDispatcher is undefined". actually what you suggest is true,
>> > but i want the window print only show when user click the print button.
>> > Thx, sorry for disturbing you again.
>> >
>> >
>> > Jason Weathersby wrote on Thu, 20 October 2011 11:23
>> >> Instead of modifying the viewer can you add a text element to the
>> >> report and set its type to html and enter the following:
>> >>
>> >> <script language="JavaScript">
>> >> function wPrint()
>> >> {
>> >> birtEventDispatcher.broadcastEvent( birtEvent.__E_PRINT );
>> >>
>> >> var pdfrad = document.getElementById("printAsPDF");
>> >> pdfrad.checked = true;
>> >> var btndv = document.getElementById("printReportDialogokButton");
>> >> var bnar=btndv.getElementsByTagName("input");
>> >> var btn = bnar[0];
>> >> btn.click();
>> >>
>> >> }
>> >> function printDelay()
>> >> {
>> >> setTimeout("wPrint()", 1000);
>> >> }
>> >> printDelay();
>> >> </script>
>> >>
>> >>
>> >> Jason
>> >> >
>> >
>> >
>
>
-
Attachment: printtst.zip
(Size: 2.59KB, Downloaded 305 times)
|
|
|
Re: How to do Client Printing and delete xml source file [message #753948 is a reply to message #752706] |
Mon, 31 October 2011 06:54 |
cbr125x Messages: 34 Registered: July 2011 |
Member |
|
|
hi Jason,
I still get the same error when use your report example.
i think i will try to download the new one of the BIRT Viewer and try again.
Jason Weathersby wrote on Wed, 26 October 2011 09:42Here it is.
Jason
On 10/26/2011 12:02 AM, cbr125x wrote:
> Yes, i used frameset, can u attach the example u made Jason? Thanks
>
> Jason Weathersby wrote on Mon, 24 October 2011 11:49
>> I just tried this in 3.7 with the viewer deployed to tomcat and using
>> the frameset mapping and it worked fine. Are you using the /frameset
>> mapping?
>>
>> Jason
>>
>> On 10/20/2011 9:39 PM, cbr125x wrote:
>> > Hi Jason,
>> > when I run the report in Eclipse, it got no error,
>> > but when i run in tomcat with BIRT Viewer, i got error
>> > "birtEventDispatcher is undefined". actually what you suggest is true,
>> > but i want the window print only show when user click the print button.
>> > Thx, sorry for disturbing you again.
>> >
>> >
>> > Jason Weathersby wrote on Thu, 20 October 2011 11:23
>> >> Instead of modifying the viewer can you add a text element to the
>> >> report and set its type to html and enter the following:
>> >>
>> >> <script language="JavaScript">
>> >> function wPrint()
>> >> {
>> >> birtEventDispatcher.broadcastEvent( birtEvent.__E_PRINT );
>> >>
>> >> var pdfrad = document.getElementById("printAsPDF");
>> >> pdfrad.checked = true;
>> >> var btndv = document.getElementById("printReportDialogokButton");
>> >> var bnar=btndv.getElementsByTagName("input");
>> >> var btn = bnar[0];
>> >> btn.click();
>> >>
>> >> }
>> >> function printDelay()
>> >> {
>> >> setTimeout("wPrint()", 1000);
>> >> }
>> >> printDelay();
>> >> </script>
>> >>
>> >>
>> >> Jason
>> >> >
>> >
>> >
>
>
|
|
| | | | |
Re: How to do Client Printing and delete xml source file [message #1015730 is a reply to message #1015314] |
Fri, 01 March 2013 23:30 |
|
It would probably be better to use something like jQuery for both of these features but you could try something like:
<script>
function wPrint()
{
birtEventDispatcher.broadcastEvent( birtEvent.__E_EXPORT_REPORT );
var btndv =document.getElementById("exportReportDialogokButton");
var bnar=btndv.getElementsByTagName("input");
var btn = bnar[0];
var formatselect = document.getElementById("exportFormat");
selectedItem = formatselect[formatselect.selectedIndex];
selectedItem.value = "pdf";
btn.click();
}
function printDelay()
{
var _this = this;
setTimeout(function() { wPrint(); }, 3000);
}
printDelay();
</script>
I the only thing I do not like is putting in the delays.
Jason
|
|
| | | |
Goto Forum:
Current Time: Fri Nov 08 22:22:48 GMT 2024
Powered by FUDForum. Page generated in 0.04843 seconds
|