Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
cbr125x  is currently offline cbr125x Friend
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 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x Friend
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: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 #741440 is a reply to message #741074] Wed, 19 October 2011 14:34 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x Friend
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: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 #742531 is a reply to message #741896] Thu, 20 October 2011 15:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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 #742949 is a reply to message #742531] Fri, 21 October 2011 01:39 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x Friend
Messages: 34
Registered: July 2011
Member
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 #748274 is a reply to message #742949] Mon, 24 October 2011 15:49 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x Friend
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: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 #752706 is a reply to message #751434] Wed, 26 October 2011 13:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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 289 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 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x Friend
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: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
>> >> >
>> >
>> >
>
>

Re: How to do Client Printing and delete xml source file [message #1014901 is a reply to message #742531] Tue, 26 February 2013 17:25 Go to previous messageGo to next message
Thomas Scacca is currently offline Thomas ScaccaFriend
Messages: 4
Registered: February 2013
Junior Member
Hi
It works on my environment
Do you have also script to atomatically execute PDF export?
Regards

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 #1015047 is a reply to message #742531] Wed, 27 February 2013 09:47 Go to previous messageGo to next message
Thomas Scacca is currently offline Thomas ScaccaFriend
Messages: 4
Registered: February 2013
Junior Member
DELETE THIS DUPLICATE POST

[Updated on: Wed, 27 February 2013 09:49]

Report message to a moderator

Re: How to do Client Printing and delete xml source file [message #1015243 is a reply to message #1015047] Wed, 27 February 2013 21:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Thomas,

How do you see this working? Do you want anytime the report is opened in the viewer that it automatically opens it in pdf?

Jason
Re: How to do Client Printing and delete xml source file [message #1015314 is a reply to message #1015243] Thu, 28 February 2013 08:14 Go to previous messageGo to next message
Thomas Scacca is currently offline Thomas ScaccaFriend
Messages: 4
Registered: February 2013
Junior Member
Hi Jason,
Yes I'd like that when BIRT Viewer windows opens with report preview, immediately system execute export PDF.
Similar to function that you create for print, but spending export PDF.
Thanks
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 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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
Re: How to do Client Printing and delete xml source file [message #1015732 is a reply to message #1015730] Fri, 01 March 2013 23:35 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You could also modify the viewer js files to add the logic or register a new js function to listen for the event and act on it then.

Jason
Re: How to do Client Printing and delete xml source file [message #1016969 is a reply to message #1015730] Fri, 08 March 2013 11:49 Go to previous messageGo to next message
Thomas Scacca is currently offline Thomas ScaccaFriend
Messages: 4
Registered: February 2013
Junior Member
Hi Jason,
your code work correctly. Thanks
What do you means when you told "I the only thing I do not like is putting in the delays"

I don't understand your advice to use "jQuery". Can I use it to bypass BIRT Viewer and create immediately a PDF File?
Re: How to do Client Printing and delete xml source file [message #1017063 is a reply to message #1016969] Fri, 08 March 2013 19:20 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I meant this delay:
setTimeout(function() { wPrint(); }, 3000);

What I meant was to include jQuery and use a callback instead. You could also just try body onload event.

Jason
Previous Topic:BIRT 4.2.2 Update Site
Next Topic:Variable bar width in bar graph
Goto Forum:
  


Current Time: Thu Mar 28 19:05:22 GMT 2024

Powered by FUDForum. Page generated in 0.02835 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top