jasper reports - How to remove unnecessary wrapping in PDF, generated using JasperReports (jrxml)? -


i using jasper report generating pdf report. use following textfield configuration in jrxml file.

<textfield isstretchwithoverflow="true" isblankwhennull="true">                     <reportelement uuid="ec0e2f1f-82d6-46fd-ba68-394be7f6b015" positiontype="float" stretchtype="relativetotallestobject" isprintrepeatedvalues="false" mode="transparent" x="0" y="0" width="100" height="16" isprintinfirstwholeband="true" isprintwhendetailoverflows="true"/>                     <box toppadding="2" leftpadding="5" bottompadding="0" rightpadding="0">                         <pen linecolor="#757575"/>                         <toppen linewidth="0.0"/>                         <leftpen linewidth="1.0"/>                         <bottompen linewidth="1.0"/>                         <rightpen linewidth="0.0"/>                     </box>                     <textelement textalignment="left" verticalalignment="top" markup="none">                         <font size="11"/>                         <paragraph linespacing="single"/>                     </textelement>                     <textfieldexpression><![cdata[$f{firstname}]]></textfieldexpression>                 </textfield> 

when export pdf, show me records given in below screen-shot. see in first record, there no single character in second row. though behaving text wrapping. think there must solution. please me if resolved issue.
here giving link whole pdf file.

jasper report exported pdf file screen-sht

the sample pdf uses font helvetica (supplied pdf viewer) surely not used jasperreports when generically pre-compiling report.

if different fonts (having different font metrics) used this, fields in output may turn out big or small. thus, i'd advice explicitly set font, , using both fontname , pdffontname attributes indicating same ttf font. alternatively can done more cleanly using jasperreports font extensions. cf. jasperreports - fonts sample details.

fontname , pdffontname

e.g., assuming working in windows environment , have appropriate permissions (otherwise adapt path point copy of font), can use arial this:

<textfield isstretchwithoverflow="true" isblankwhennull="true">     <reportelement positiontype="float" stretchtype="relativetotallestobject" isprintrepeatedvalues="false" mode="transparent" x="0" y="0" width="100" height="16" isprintinfirstwholeband="true" isprintwhendetailoverflows="true" uuid="e4335197-b9f6-4d24-9ea0-ef582bcc8393"/>     <box toppadding="2" leftpadding="5" bottompadding="0" rightpadding="0">         <pen linecolor="#757575"/>         <toppen linewidth="1.0"/>         <leftpen linewidth="1.0"/>         <bottompen linewidth="1.0"/>         <rightpen linewidth="1.0"/>     </box>     <textelement textalignment="left" verticalalignment="top" markup="none">         <font fontname="arial" size="11" pdffontname="c:\windows\fonts\arial.ttf" ispdfembedded="true"/>     </textelement>     <textfieldexpression><![cdata[$f{firstname}]]></textfieldexpression> </textfield> 

pdf special case in jasperreports because in contrast other output formats (which use system fonts) pdf viewers foremost use 1 of standard 14 fonts every pdf viewer must supply or fonts embedded in respective pdf document; therefore, pdf file generation differs bit.

font extensions

the cleaner approach requires write file defining font families relevant information, e.g.

<?xml version="1.0" encoding="utf-8"?> <fontfamilies>     <fontfamily name="verdana">         <normal>admin/plugins/ireport/config/fonts/verdana.ttf</normal>         <bold>admin/plugins/ireport/config/fonts/verdanab.ttf</bold>         <italic>admin/plugins/ireport/config/fonts/verdanai.ttf</italic>         <bolditalic>admin/plugins/ireport/config/fonts/verdanaz.ttf</bolditalic>         <pdfencoding>identity-h</pdfencoding>         <pdfembedded>true</pdfembedded>     </fontfamily> </fontfamilies> 

(the fonts referenced file (verdana*.ttf) part of microsoft "truetype core fonts web" collection. license agreement use can found in eula.html can (as of 2011-04-01) found @ http://www.microsoft.com/typography/fontpack/eula.htm.)

then need tell jasperreports font extensions retrieve information file described in the jasperreports font extension sample, i.e. providing jasperreports_extension.properties file in root package containing

net.sf.jasperreports.extension.registry.factory.simple.font.families=net.sf.jasperreports.engine.fonts.simplefontextensionsregistryfactory  net.sf.jasperreports.extension.simple.font.families.dejavu=my_path/fonts.xml  

(the pointed-to fonts.xml file mentioned above.)


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -