Jump to content
Changes to the Jaspersoft community edition download ×

richkatz

Members
  • Posts

    4
  • Joined

  • Last visited

richkatz's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare

Recent Badges

0

Reputation

  1. Regarding: See this FAQ. You need to have the same font available to Java/AWT. Questions: Do you have a complete example (or a war file) that works for Tomcat and Linux showing the Java code (using with FontFactory.register() if that's required possible) and JRXML) and accesses fonts (regular, bold, and italic) that are placed into the war and that are not available in the Linux font registry? It doesn't matter what the font it is as long as the three are in one family. It would be most convenient if we did not have to build the fonts into a separate Jar that you call a Font Extension, (we then have to load them back through Maven..). but if that is the only way, please include all the coding necessary to support the Font Extension jar. The example you give in the JasperReports distribution is a set of files, not a jar, and it seems to rely on some Spring framework code. Is that correct? I have not had any luck using fontName (fontName=Arial for instance) without pdfFontName. It picks up some totally foreign font when I do that. Thanks! Regards, Rich
  2. Hi Teodor, How is pdfFontName supposed to relate to the registered font name? This is just not quite working - or making sense yet. When running on Linux, I can't get the fonts to register, but even when I do, how do I refer to them in the JRXML? First, I get this exception which I can find exactly NO WHERE on the Internet: ExceptionConverter: com.lowagie.text.DocumentException: Table 'name' does not exist in /home/tomcat/webapps/ourproject/WEB-INF/classes/arial.ttf When it can't find or load the font it gets: loadFont exception: ExceptionConverter: com.lowagie.text.DocumentException: Table 'name' does not exist in /home/tomcat/webapps/kcpt/WEB-INF/classes/arial.ttf The "loadFont exception" comes from the code: loadFont(gfp+"arial.ttf","arial.ttf"); loadFont(gfp+"ariali.ttf","ariali.ttf"); loadFont(gfp+"arialbd.ttf","arialbd.ttf"); loadFont(gfp+"arialbi.ttf","arialbi.ttf"); public boolean loadFont(String fontLocation, String fontName) { boolean ret=false; try { FontFactory.register(fontLocation, fontName); ret=true; } catch (Exception de) { logger.warn(" loadFont exception: ", de); } return ret; } I am running in Tomcat on Linux. And the font f iles are there in the classes directory: arial.ttf, arialbd.ttf, and araili.ttf and arialbi.ttf Second about the pdfFontName. I refer to these in the JRXML as pdfFontName= what? What I tried is: <staticText> <reportElement x="12" y="24" width="550" height="21"/> <textElement textAlignment="Center"> <font fontName="Arial" size="11" isBold="true" isUnderline="true" pdfFontName="arialbd.ttf"/> </textElement> <text><![CDATA[iI. CRITICAL FUNCTIONS]]></text> </staticText> That FAILS -- completely. So, I went back to: <staticText> <reportElement x="12" y="24" width="550" height="21"/> <textElement textAlignment="Center"> <font fontName="Arial" size="11" isBold="true" isUnderline="true" pdfFontName="Helvetica-Bold"/> </textElement> <text><![CDATA[iI. CRITICAL FUNCTIONS]]></text> </staticText> This gets some other font (probably because it can't find the font its trying to register). Many thanks Regards, Richard Katz
  3. I found that problem. <parameter name="PAGE_NUMBER" class="java.lang.Integer"> <defaultValueExpression><![CDATA[1]]></defaultValueExpression> </parameter> Works like a charm. I'm not sure how to get the Page Number out at the end. Is there an event at the end of a page so I can get the last page number? And can this be communicated back to the calling program? If so, how? Thx.
  4. I have searched all over for an answer to this. Page numbers are a big probem. The rest of JasperReports is very easy, but page numbers seem to be incredibly difficult to deal with. 1. I want all the page numbers on a series of Jasper Reports to be numbered contiguously. 2. I want to know what the page numbers so that the sections can be collected into a table of contents. So I want to reserve 2 pages at the front for the TOC and begin numbering at 3. I just can't find a solution. I tried the following Scriptlet solution. a. Pass the page number down by setting a parameter parameters.put("PAGE_NUMBER", pageStart); jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn); b. Use a scriptlet to move it into the actual PAGE_NUMBER variable. public void afterReportInit() throws JRScriptletException { Integer pageNumber = 15; try { System.out.println("Getting page number"); pageNumber = (Integer) getParameterValue("PAGE_NUMBER"); System.out.println("Getting page number: "+pageNumber); } catch (Exception e) { System.out.println("Exception:"+e); } setVariableValue("PAGE_NUMBER", pageNumber); } } Problems: This seemed to work once, but now it gets an exception saying it can't find this variable when the Scriptlet is run. Exception:net.sf.jasperreports.engine.JRScriptletException: Parameter not found : PAGE_NUMBER Are there some tricks in getting the parameter data into the report and to the scriptlet? It gets only the base parameters. Maybe there is some unused base parameter I could set? I have no idea what the solution is to part 2 is - that is, how do you tell the current or final value of the variable PAGE_NUMBER after the report has finished. I would guess, if parameters worked that you could get the parameter value back out somehow, using a Scriptlet afterDetailEval() method.
×
×
  • Create New...