Jump to content
We've recently updated our Privacy Statement, available here ×

sww

Members
  • Posts

    26
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by sww

  1. If the report parameter is of type Object, then you could pass any Java object - you will then need to use class casts etc. to access the object within the report. e.g. Code:((YourClass)$P{parameter}).callMethod()
  2. For the subreport data source expression use: new JRBeanArrayDataSource((Object[])$F{field}) Where the 'field' is of type java.lang.Object, and populate the field with the data. Or use a subdataset...
  3. And STILL this problem persists in iReport 2.0.4!!! I have the same issue - the reports DOES compile, but there is a constant 'problem' being reported. The class IS in the classpath, AND the package is being imported by the report. There is no way that I can put the application in the iReport lib directory - that's NOT a solution. A PROPER fix is LONG overdue, I'd say.
  4. In the crosstab design view you can delete any field in the header sections that you don't want to display and also you can drag the helper lines to re-size the crosstab.
  5. OK, so no responses so far. Let me re-iterate: I have a report, and at some point I define a default style for the report. I would expect the settings for this style to 'cascade' onto every/any report element for any style property not specifically defined. So, if the default fontName is now 'Tahoma', then I would expect a field that does NOT have the fontName attribute set to show 'Tahoma' in the font properties dialog. But that doesn't happen - I get SansSerif :unsure: Furthermore - it doesn't work right with crosstabs. Even if the style is applied to the crosstab, I found I also had to set the fonts etc. on the crosstab cell to get it to show right. (I know - that's not specifically an iReport issue, but it is a fact that iReport does not show the prevailing style/font. Once the default style is set, I think that it then works correctly for new report elements. I am sure this must be catching out others that are trying to work with different character sets/fonts.
  6. jasperNoob wrote: you cant use static text ... you got to use a textfield and that too u have to transform into $R{text.date} . Only then will it look for the translation in the resource bundle.It isn't surprising that people make this assumption when the iReport documentation CLEARLY states: JasperReports 0.6.2 introduced some new features for report internationalization. Internationalizing a report means making all static text set at design time (such as labels and messages) adaptable to locale options used to build the report: the report engine will print the text using the most appropriate available translation.Which does rather more than imply that staticText fields ARE i18n'ed during report generation. To have to use a textField to get i18n is rather untidy...
  7. From what I understand, the CSV exporter only supports *standard text* i.e. ASCII and does not support any international characters.
  8. lucianc wrote: Suffixes in this case can be used as font aliases, e.g. one could use Arial.Bold or Arial.Slanted as PDF font names.OK. That's one more thing cleared up. Now all I need is a simpler way to do font mappings than: Code: Map fontMap = new HashMap(); fontMap.put(new FontKey("Tahoma", false, false), new PdfFont("Tahoma" , "Cp1252", false, false, false)); fontMap.put(new FontKey("Tahoma", false, true), new PdfFont("Tahoma" , "Cp1252", false, false, true)); fontMap.put(new FontKey("Tahoma", true, false), new PdfFont("Tahoma Bold", "Cp1252", false, false, false)); fontMap.put(new FontKey("Tahoma", true, true), new PdfFont("Tahoma Bold", "Cp1252", false, false, true)); fontMap.put(new FontKey("Tahoma-ru", false, false), new PdfFont("Tahoma" , "Cp1251", false, false, false)); fontMap.put(new FontKey("Tahoma-ru", false, true), new PdfFont("Tahoma" , "Cp1251", false, false, true)); fontMap.put(new FontKey("Tahoma-ru", true, false), new PdfFont("Tahoma Bold", "Cp1251", false, false, false)); fontMap.put(new FontKey("Tahoma-ru", true, true), new PdfFont("Tahoma Bold", "Cp1251", false, false, true)); exporter.setParameter(JRExporterParameter.FONT_MAP, fontMap);and then I'd be quite satisfied :) Thanks for your replies so far.
  9. lucianc wrote: Note that when registering font directories, only font names can be used as PDF font names (and not font file names).Aha! I actually hadn't tried that... (I'd only tried accessing the fonts by file names - e.g. "tahomabd.ttf") Mind you, it seemed to manage ok finding "tahoma.ttf" - but I'm now suspecting it wasn't reading the ".ttf" as a file extension. I'm right now trying it with the font name "Tahoma Bold"... lucianc wrote: We are open to any (feasible) suggestions of improving this area.Once I've fully bottomed out all the issues, I will see if I can come up with some suggestions. For now, it would be good if there was some clear documentation on how to set up the properties for PDF_FONT_DIRS_PREFIX - I'm now using: Code:JRProperties.setProperty(JRProperties.PDF_FONT_DIRS_PREFIX+"jasper","c:/windows/fonts/" );but I only concluded from a comment in the Font sample that after the prefix it should be "jasper" - or is it an arbitrary tag? The font sample also has: Code:[code]net.sf.jasperreports.export.pdf.font.Arial.Bold=../fonts/ARIALBD.TTF net.sf.jasperreports.export.pdf.font.Arial.Slanted=../fonts/ARIALI.TTFBut there is no obvious explanation in the code (or documentation) as to how the ".Bold" or ".Slanted" [btw, the word 'Italic' would be better...] are supposed to be used. Now that I have some font mappings, things seem to be generally working, though I've had to add font registration in between report filling and the pdf export. I was originally using Code:[code]runReportToPdfFile(file, parameters, data_source) to generate the report, but I don't see how the font registration can work with that.Post edited by: sww, at: 2008/01/14 16:27
  10. OK, some progress. I tried setting the PDF font directory: Code:JRProperties.setProperty(JRProperties.PDF_FONT_DIRS_PREFIX+"jasper","c:/windows/fonts/" );And was expecting from there that would mean I could refer to font names directly, or at least by file name. e.g. Code:[code]fontMap.put(new FontKey("Tahoma", true, false), new PdfFont("Tahoma Bold" , "Cp1252", false, false, false));OR Code:[code]fontMap.put(new FontKey("Tahoma", true, false), new PdfFont("tahomabd.ttf" , "Cp1252", false, false, false));But that doesn't seem to work. Tracing through the code, at one point the JRPdfExporter class tries to load the font using Code:[code]bytes = JRLoader.loadBytesFromLocation(pdfFont.getPdfFontName(), classLoader, urlHandlerFactory);But it does NOT use the PDF_FONT_DIR as defined and hence fails to load the font. I have found that if I register the font explicitly: Code:[code]JRProperties.setProperty(JRProperties.PDF_FONT_FILES_PREFIX+"Tahoma-Bold","c:/windows/fonts/tahomabd.ttf" );Then I can later refer to it as follows: Code:[code]fontMap.put(new FontKey("Tahoma", true, false), new PdfFont("Tahoma-Bold", "Cp1252", false, false, false));and then things kinda work. It also allows 'alternate' fonts to be mapped, e.g.: Code:[code]fontMap.put(new FontKey("Tahoma-ru", false, false), new PdfFont("Tahoma" , "Cp1251", false, false, false));which then allows cyrillics to be rendered in PDF files. The whole font handling stuff is all very confusing - and the documentation doesn't really make things any clearer. I hope that the information I've posted will help some other poor souls equally lost in font-hell and that maybe, someone who has some better understanding of how it's supposed to work will actually point out where I'm going wrong!
  11. lucianc wrote: Have you read this FAQ?I have had a look at that - ok, so it appears that I should be looking to use the SAME font(name) for fontName and pdfFontName unless I want to risk 'odd' results. That's fine, except I need to use Tahoma and so far I'm not seeing italics. I've registered Tahoma as per: Code: JRProperties.setProperty(JRProperties.PDF_FONT_FILES_PREFIX+"Tahoma","c:/windows/fonts/tahoma.ttf" ); JRProperties.setProperty(JRProperties.PDF_FONT_FILES_PREFIX+"Tahoma-Bold","c:/windows/fonts/tahomabd.ttf" ); these being the ONLY Tahoma fonts on the system. So how to get italics?
  12. Yes, I am also getting different results with static text vs. data fields. It is all very confusing...
  13. lucianc wrote: Which documentation is that? The JasperReports.1.3.4.pdf I purchased which states: The font name introduced by the previously explained fontName attribute is of no use when exporting to PDF. lucianc wrote: Have you read this FAQ?I'll take a look at that shortly. My brain is already hurting from trying to reconcile all the different results/behaviours I have so far experienced. Almost everything now works as expected - except that I'm having problems getting Tahoma to render in italic...
  14. In iReport I have set a default style, NOT a report font as this is 'deprecated'. Now while it does appear that on the whole that works correctly, iReport isn't correctly cascading the style onto all report elements. (iReport 2.0.3) Any 'new' elements created AFTER the style has been set seem to 'inherit' the default style, but other elements (even where some style elements are not specified) don't, and the 'font' tab shows instead the 'default' settings if no style had been applied. And a crosstab on the report displays wrongly in iReport because it isn't recognising the default style - even though it DOES work when the report is generated. At the moment I'm looking at having to manually edit all my reports to remove any attributes from the font tags that iReport is setting even when that is not what was wanted. It should ONLY set any attributes that are different from the prevailing style. Post edited by: sww, at: 2008/01/14 08:16
  15. Further to my previous post and other threads on the same topic: Contrary to what the documentation says, fontName DOES appear to have some impact on what happens during PDF export. For example, I can have fontName as "Courier New" and pdfFont as "Tahoma" and it will fail to render cyrillic. If I then set fontName to "Arial" it WILL render the cyrillic. Mind you I found I also had to register the PDF Font to allow me to use the font name, rather than the file path to the font file. Code:JRProperties.setProperty(JRProperties.PDF_FONT_FILES_PREFIX+"Tahoma","c:/windows/fonts/tahoma.ttf" ); and I also found that in order to get it to render bold, I had to also register the bold font - but then I had to explicitly set any bold characters to use that font: Code:[code]JRProperties.setProperty(JRProperties.PDF_FONT_FILES_PREFIX+"TahomaBD","c:/windows/fonts/tahomabd.ttf" ); It's all rather 'clunky'.
  16. Change your pdfFont to c:/windows/fonts/tahoma.ttf and you should find the characters show up ok.
  17. Well, I've got it working :) It is a complex inter-play between iReports and the configuration needed by iText (within JasperReports.) Simple fix: For 'fontName' select a fontname that maps to one of the built-in PDF fonts - e.g. Times New Roman, and for the pdfFont set it to "c:/windows/fonts/tahoma.ttf" - and you *should* see the cyrillic characters as required. I am currently looking further for a more complete solution, but the above should get things moving forward.
  18. I have just tried something different, and now got a textfield populated from the data model that IS displaying (one) cyrillic character - I just changed one character in a string in the DB and it's showing in the PDF... The other fields that are NOT displaying are a) in a crosstab and b) in a subreport... Once I've figured out what's going on I'll report back.
  19. I have just downloaded Foxit but the DATA textfields - i.e. the ones populated from the page data source with cyrillic characters - are still all blank. I have used the debugger to trace the code where the data is read from the data model, and I can see the cyrillic characters in the data at that point. The data is all held in Java Strings, so I can't understand why it isn't displaying them properly. I wish someone would either tell us straight how it's done OR simply admit it can't be done, if that is the case.
  20. That should work fine, if you have a font selected that correctly displays cyrillic. I'm trying to do the same, and I found that using Tahoma as the font (also pdfFontName - I actually set it to Code:c:\windows\fonts\tahoma.ttf - do use double \!!! ) - and setting pdfEmbedded 'true', then it works, kind of. It works for static textFields - I have not yet figured out how to get data textFields to display cyrillic. So far none of the advice I've fo und here has worked. :( Post edited by: sww, at: 2008/01/10 12:25
×
×
  • Create New...