Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Printer Default Settings
SKantipudi
hello all,
enclosed below is my requirement.
it would be greatful if someone helps out .
requirement:
whenever a user clicks on the print option on the report , the default settings should point to Landscape and fit to page size.
i've tried out writing script in beforefactory method but was unable to;
and below is the code:
var renderO = reportContext.getRenderOption().getOutputFormat();
// change layout
if (renderO == "pdf"){
reportContext.getDesignHandle().getMasterPages().get(0).setProperty("orientation","landscape");
}
else if (renderO == "html")
reportContext.getDesignHandle().getMasterPages().get(0).setProperty("orientation","potrait");
Thanks,
Sailaja.K
Find more posts tagged with
Comments
Virgil Dodson
Hi Sailaja,<br />
<br />
The script you are trying to write should only work in the beforeRender method since the beforeFactory method may not be aware of the output type yet. <br />
<br />
The code I used in the beforeRender method is below.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var renderO = reportContext.getOutputFormat();
dh = reportContext.getReportRunnable().designHandle.getDesignHandle();
mp = dh.getMasterPages().get(0);
if (renderO == "pdf"){
mp.orientation = "landscape";
}
</pre>
<br />
However, in my simple testing with the BIRT 2.3.2 viewer, it seems that the export report into PDF does not seem to be calling the beforeRender method in the same way that going directly to PDF is working (You may want to log a bug for that if it is important to you). <br />
<br />
For your particular example, you can get this to work by selecting orientation of landscape in the master page properties. For HTML, the report will be generated with an automatic/flexible layout... and then exporting to PDF produces a landscape document.
Virgil Dodson
I forgot to mention, as a workaround you can remove the toolbar items you don't want (see more at this thread <a class='bbc_url' href='
http://www.birt-exchange.org/forum/eclipse-birt-newsgroup-mirror/14514-programmatically-hide-actions-birt-report-viewer-toolbar.html)'>http://www.birt-exchange.org/forum/eclipse-birt-newsgroup-mirror/14514-programmatically-hide-actions-birt-report-viewer-toolbar.html)</a>..<br
/>
<br />
...and then provide your own link in the report (or outside the report) that reruns the report as PDF.