Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Export PDF - Font size
Ephasme
Hi,
I'm on a project and we use BIRT as reporting tool. One of our report is designed for the customer and has to be neat. So we want it to be exportable as PDF document and to be exactly the same as the HTML document.
Today I failed in there because the font size is absolutely not consistent beetwen the two formats.
To get a proper font size in the PDF I have to set the size to 4 pt in the rptdesign. It make the work very difficult because I can't see the text.
Any solution ?
Find more posts tagged with
Comments
kclark
Are you wanting to set the font size to 4 with the PDF output only or all outputs?
Ephasme
<p>Hi, thanks for your answer</p><p> </p><p>I want it just for the PDF output.</p><p>Because with the fontsize as 4 in HTML it's too small</p><p> </p><p>AND, in the report designer, it's too small too... I can't work.</p>
kclark
<p>In the onCreate of the table displaying the text you could detect the output format of the report and change the font size using this</p><pre class="_prettyXprint">if(reportContext.getHttpServletRequest().getAttribute("attributeBean").format == "pdf") { this.getStyle().fontSize = "8pt";}else{ this.getStyle().fontSize = "12pt";}</pre>
Ephasme
<p>Hi ! Thanks for your answers.</p><p> </p><p>You understood well what I wanted except that the font size modification has to be applied to the entire report.</p><p> </p><p>Could I put your code at the report script level ?</p><p> </p><p>Thanks.</p>
lnix
<p>Just a note, if you need the HTML and PDF to be exactly the same, but sure to use Fixed Layout on the report and not Auto Layout.</p>
kclark
<p><a data-ipb='nomediaparse' href='
http://www.birt-exchange.org/devshare/_/designing-birt-reports/539-birt-dynamically-choose-css-file'>Take
a look at this devshare</a>. You could create a style and then apply it to the entire report depending on the output like above. That way you don't need to add the code for each report item. It would look something like this</p><pre class="_prettyXprint">if(reportContext.getHttpServletRequest().getAttribute("attributeBean").format == "pdf") { dh = reportContext.getDesignHandle(); cssh = dh.openCssStyleSheet(/*your style*/); dh.addCss(cssh);}else{ // add another style here if you want for non PDF outputs}</pre>