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

RTThomas

Members
  • Posts

    9
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Everything posted by RTThomas

  1. Hozawa, please stop making so many posts when you don't understand the question. I AM using a font extension, and reference the font in <style pdfFontName=....> It works fine. What do you mean "no longer supported?" For instance, this compiles, and the style shows up in the exported PDF: <staticText> <reportElement style="Normal" x="5" y="2" width="144" height="14" uuid="672eb87e-2fe1-4856-a595-d7a5f705e8f5"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> <property name="com.jaspersoft.studio.unit.y" value="pixel"/> </reportElement> <text><![CDATA[<style pdfFontName="TimesNewRoman" isPdfEmbedded="true">Temporary License Issue Date:</style>]]></text></staticText> The question is about applying such a font to style text produced by a field or parameter reference ($F{} or $P{}). For instance, the CDATA expression below will not compile: <textField> <reportElement isPrintRepeatedValues="false" x="115" y="85" width="210" height="21" uuid="7130cf53-a6c1-4d8a-89cf-86bb03a9fb00"> <property name="com.jaspersoft.studio.unit.width" value="pixel"/> </reportElement> <textElement markup="styled"> <paragraph leftIndent="5" spacingBefore="4"/> </textElement> <textFieldExpression><![CDATA[<style pdfFontName="TimesNewRoman" isPdfEmbedded="true">$F{name} </style>]]></textFieldExpression></textField> I can't believe that there isn't some way to accomplish this.
  2. I need to style parameter and field strings with an embedded font for my pdf document. Something like this: <textField> <reportElement isPrintRepeatedValues="false" x="115" y="85" width="210" height="21" uuid="7130cf53-a6c1-4d8a-89cf-86bb03a9fb00"> <property name="com.jaspersoft.studio.unit.width" value="pixel"/> </reportElement> <textElement markup="styled"> <paragraph leftIndent="5" spacingBefore="4"/> </textElement> <textFieldExpression><![CDATA[<style pdfFontName="TimesNewRoman" isPdfEmbedded="true">$F{name}</style>]]></textFieldExpression> </textField> But I get this when compiling: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. Syntax error on token(s), misplaced construct(s) value = <style pdfFontName="TimesNewRoman" isPdfEmbedded="true">((java.lang.String)field_name.getValue())</style>; //$JR_EXPR_ID=10$ <-----> 2. Syntax error on token "<", delete this token value = <style pdfFontName="TimesNewRoman" isPdfEmbedded="true">((java.lang.String)field_name.getValue())</style>; //$JR_EXPR_ID=10$ ^ 3. style cannot be resolved to a type value = <style pdfFontName="TimesNewRoman" isPdfEmbedded="true">((java.lang.String)field_name.getValue())</style>; //$JR_EXPR_ID=10$ <---> Is there any way to do this? Thanks.
  3. I am sooo embarassed. Wish I could delete this. It's me that in't closing the output stream. Duhhh...
  4. I am generating a reports in a web application running on Windows, exporting it as pdf. I need to later programatically delete this files within the application. Creation works fine: File file = new File(reportFilename);OutputStream os = new FileOutputStream(file); InputStream reportStream = facesContext.getExternalContext().getResourceAsStream("/reports/" + jasperFilename);JasperPrint jrPrint = JasperFillManager.fillReport(reportStream, parameters, dataSource); JasperExportManager.exportReportToPdfStream(jrPrint, os); When I later call File.delete(), it returns false. And if I try to delete it from Windows Explorer before shutting down the Tomcat web server, it reports "File in Use"It appears as if the output stream is not being being closed. Thanks for any suggestions.
  5. I just followed the instructions at http://community.jaspersoft.com/wiki/custom-font-font-extension. (I used the three separate font files fronm Windows/fonts, one for each variant. I exported them together.) But the line <italic>fonts/Arial_Italic/ariali.ttf</italic> does look odd with the underscore instead of the hyphen. I tried again using underscores rather than hyphens, - recreated the extensions, exported, changed to underscores in my jrxml, but still the same error.
  6. Thanks for the tip, but placing the font jar in tomcat/lib made no difference
  7. I need to style some text in a PDF export Arial bold, italic or bold italic. I've created extensions for all three, using the corresponding Windows font files. They show up as expected in the Jaspersoft Studio Font dropdown. I then exported them to a jar. I looked in the jar file and everything looks good. The fontsfamily.xml file contains: <?xml version="1.0" encoding="UTF-8"?> <fontFamilies> <fontFamily name="Arial-Italic"> <italic>fonts/Arial_Italic/ariali.ttf</italic> <pdfEncoding>Cp1252</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> </exportFonts> </fontFamily> <fontFamily name="Arial-Bold"> <bold>fonts/Arial_Bold/arialbd.ttf</bold> <pdfEncoding>Cp1252</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> </exportFonts> </fontFamily> <fontFamily name="Arial-Bold-Italic"> <boldItalic>fonts/Arial_Bold_Italic/arialbi.ttf</boldItalic> <pdfEncoding>Cp1252</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> </exportFonts> </fontFamily> </fontFamilies> In my case I'm using it in a web app, so it's with the rest of my jars in WEB-INF/lib. For a fixed text element which I want in Arial Italic, I selected "styled" in the markup dropdown, and added a <style> element to the text: <staticText> <reportElement style="Large" x="30" y="40" width="126" height="30" uuid="7e908695-0594-4452-9a82-471ef38d7281"> <property name="com.jaspersoft.studio.unit.y" value="pixel"/> </reportElement> <textElement markup="styled"/> <text><![CDATA[<style pdfFontName="Arial-Italic" isPdfEmbedded="true">Public Security Division</style>]]></text> </staticText> But when I try to generate the PDF in my web app, I get this exception: net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font: pdfFontName: Arial-Italic pdfEncoding: Cp1252 isPdfEmbedded : true at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2278) at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:2069) .... I'm at a loss. Any suggestions?
  8. I have the same problem. I've created extensions for Arial Bold, Arial Italic and Arial Bold Italic, using the corresponding WIndows font files. They show up as expected in the Font dropdown. I then exported them to a jar. I looked in the jar file and everything looks good. The fontsfamily.xml file contains: <?xml version="1.0" encoding="UTF-8"?> <fontFamilies> <fontFamily name="Arial-Italic"> <italic>fonts/Arial_Italic/ariali.ttf</italic> <pdfEncoding>Cp1252</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> </exportFonts> </fontFamily> <fontFamily name="Arial-Bold"> <bold>fonts/Arial_Bold/arialbd.ttf</bold> <pdfEncoding>Cp1252</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> </exportFonts> </fontFamily> <fontFamily name="Arial-Bold-Italic"> <boldItalic>fonts/Arial_Bold_Italic/arialbi.ttf</boldItalic> <pdfEncoding>Cp1252</pdfEncoding> <pdfEmbedded>true</pdfEmbedded> <exportFonts> </exportFonts> </fontFamily> </fontFamilies> In my case I'm using it in a web app, so it's with the rest of my jars in WEB-INF/lib. For a fixed text element which I want in Arial Italic, I selected "styled" in the markup dropdown, and added a <style> element to the text: <staticText> <reportElement style="Large" x="30" y="40" width="126" height="30" uuid="7e908695-0594-4452-9a82-471ef38d7281"> <property name="com.jaspersoft.studio.unit.y" value="pixel"/> </reportElement> <textElement markup="styled"/> <text><![CDATA[<style pdfFontName="Arial-Italic" isPdfEmbedded="true">Public Security Division</style>]]></text> </staticText> But when I try to generate the PDF in my web app, I get an exception: net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font: pdfFontName: Arial-Italic pdfEncoding: Cp1252 isPdfEmbedded : true at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2278) at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:2069) .... I'm at a loss. Any ideas?
×
×
  • Create New...