robertsv Posted March 26, 2008 Share Posted March 26, 2008 Hello :) I have a problem running Jasperreports on Websphere 6.0.0.1 (Linux). In windows there is no such problem.By certain amount of the data blank lines are generated.I tried to embed a font into a PDF document. If I check the document properties it looks that font is successfully embedded. But anyway the blank lines are generated! What could be the problem? Any ideas, solutions?This is how I embed a font into a PDF document:1)add propertie isPdfEmbedded ="true" to font tag and remove the property pdfFontName, fontName is "SansSerif".Code:<textElement textAlignment="Left"> <font fontName="SansSerif" size="8" isBold="true" isPdfEmbedded ="true"/></textElement> 2)in Java code: Code:[code]// font map: java font -> pdf fontMap fontMap = new HashMap();// normal fontfontMap.put(new FontKey("SansSerif", false, false), new PdfFont(fontFile, "Cp1252", true, false, false));// bold fontfontMap.put(new FontKey("SansSerif", true, false), new PdfFont(fontFile.toString(), "Cp1252", true, true, false));// italic fontfontMap.put(new FontKey("SansSerif", false, true), new pdfFont(fontFile.toString(), "Cp1252", true, false, true));// bold and italicfontMap.put(new FontKey("SansSerif", true, true), new PdfFont(fontFile.toString(), "Cp1252", true, true, true));exporter.setParameter(JRExporterParameter.FONT_MAP, fontMap);exporter.exportReport(); Link to comment Share on other sites More sharing options...
lucianc Posted March 26, 2008 Share Posted March 26, 2008 This usually happens when the PDF font does not match the Java font. Make sure you read this FAQ. Regards,Lucian Link to comment Share on other sites More sharing options...
EagleEye666666 Posted June 13, 2008 Share Posted June 13, 2008 Similar problem here. I have read the FAQ and adding setting the linebreakpolicy property to true on report level(if i understand it right, this means putting it to the map likeCode:model.put(JRPdfExporterParameter.FORCE_LINEBREAK_POLICY, true);so maybe correct me if iam wrong.) I think the big problem is here the IBM J9 VM and it's differences. From another post i have taken your code and created a servlet what gives me a report page as a JPG back. There it's a completely different font. but later the PDF generated by server has same font, but also doesnt show the text. Iam stuck on this problem for very long time now. Iam glad if you could help. Link to comment Share on other sites More sharing options...
EagleEye666666 Posted June 13, 2008 Share Posted June 13, 2008 I think the problem is the font the Java AWT is using for the reports... I do not understand/know how jasperreports is really compiling and working on the stuff, but as far as i understand it hangs together with the AWT. So there are 2 possibilities. not available font, because its a server so there arent a lot truetype fonts installed. second a more specific problem within the IBM J9 VM and differences to the normal java ... It's quite frustraiting this topic :( Link to comment Share on other sites More sharing options...
EagleEye666666 Posted June 13, 2008 Share Posted June 13, 2008 weeks of fighting around. it's done.. added the missing font to the IBM J9 VM JRE folder... AppServer/java/jre/lib/fonts and its working. The jpg is looking fine now, so i guess the PDF will look good as well. But can you a bit explain me how does Jasperreports works with the Java AWT ?? the normal explanation on the page doesn't help to fix such problem...and iam interested in this topic. thanks. *happy* finally weekend :D Link to comment Share on other sites More sharing options...
lucianc Posted June 16, 2008 Share Posted June 16, 2008 EagleEye666666 wrote:But can you a bit explain me how does Jasperreports works with the Java AWT ?? the normal explanation on the page doesn't help to fix such problem...and iam interested in this topic. I assume you've read this FAQ. I'm not sure what kind of explanation you expect. Maybe you have more specific questions. To summarize the interaction between JR and AWT fonts: JasperReports uses the fontName attribute as font name/family (as in TextAttribute.FAMILY) to load a Java/AWT font. This font is used to measure the text in the text field/static text element, and decide how much of the text fits, or how much does the text field need to stretch to fit the entire text. One specific item to note is that if AWT doesn't find the exact fontName requested, it would silently return a default font (which will be used to measure the text). Regards,Lucian Link to comment Share on other sites More sharing options...
EagleEye666666 Posted June 16, 2008 Share Posted June 16, 2008 hehe well thanks, i have read it, but i must admit not carefully enough. I somehow read over the first part and thought that setting the linebreak policy would solve the problem. But hej I got it now.So JR is only using the AWT for the fontName and measuring the text? I thought it's also using other components.Your posts and support is helping really a lot, I want to thank you for all your work in here. Even i had to fight a lot with problems here and there(especially iReport and it's bugs here and there, are annoying). But Iam satisfied with the results :) this counts i think. Once more thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now