Jump to content

ge0ffrey

Members
  • Posts

    65
  • 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

Posts posted by ge0ffrey

  1. Let's say I have this resultset as a datasource:

    A-1 B-1 1
    A-1 B-2 20
    A-2 B-1 300
    A-2 B-2 400

    and I want this report:

    Total   4321
    * B-1 301
    * B-2 4020
    A-1 * 21
    A-1 B-1 1
    A-1 B-2 20
    A-2 * 4300
    A-2 B-1 300
    A-2 B-2 400

    How can I do that?

    I can create a <variable> grandTotal for the total, that is easy.

    I can create a <group> for the A's and a <variable> groupATotal (for line A-1/* and A-2/*)

    I can show these lines directly: A-1/B-1, A-1/B-2, A-2/B-1, A-2/B-2

    But how do I show the lines */B-1 and */B-2? Is there some way to create a variable that is a list or map itself?

    Making a subreport for those is not really valid option, because in reality this nesting goes up to A's holds B's holds C's hold D's and there are many of each of those. A subreport would create a lot n+1 query problems.

  2. I've got a group which has a header to reprint on each page,

    but I don't want to have an anchor for each page. I want an anchor only for the first page of each group.

    Is that possible?

    Here's my code:

    <group name="a" isReprintHeaderOnEachPage="true">
        ...
        <groupHeader>
          <band height="50">

            <textField bookmarkLevel="1">
              ...
              <textFieldExpression class="java.lang.String">$F{b}</textFieldExpression>
              <anchorNameExpression>$F{b}</anchorNameExpression>
            </textField>

    I've tried inserting dummy groups with an empty textfield with an anchor, but that anchor simply doesn't show.

  3. You can pass in the current page as subreport parameter (though that will only be the first page of that subreport...)

    But you can't pass in the total number of pages in a subreport => I miss this feature too :)

  4. in the jrxml:

    Code:

    <parameter name="myColor" class="java.lang.String" />
    ...
    <textFieldExpression class="java.lang.String">$P{myColor}</textFieldExpression>

    in your java code:

    Code:
    [code]Map<String, Object> myMap = new HashMap<String, Object>();
    myMap.put("myColor", "FF0000"«»);
    ...
    JasperManager...fill(myJasperReport, myMap, ...);
  5. I did it like this:

     

    Code:

    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jasperreports-maven-plugin</artifactId>
    <version>1.0-beta-1</version>
    <executions>
    <execution>
    <goals>
    <goal>compile-reports</goal>
    </goals>
    </execution>
    </executions>
    <dependencies>
    <dependency>
    <groupId>jasperreports</groupId>
    <artifactId>jasperreports</artifactId>
    <version>3.0.0</version>
    </dependency>
    </dependencies>
    </plugin>

    Though I have another issue with the plugin that I 'll probably make a patch for.
  6. I made a mistake in how to register the font, it should be:

     

    Code:
    InputStream in = getClass().getResourceAsStream(ttfResource);
    Font font = Font.createFont(Font.TRUETYPE_FONT, in);
    GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font);
    in.close();

     

    The line still is missing though I 've used the exact same font in pdf as in jasperviewer, see the screenshot in the issue.

  7. Even when using the exact same font, lines still disappear:

     

    I took the liberty of making an issue:

    http://jasperforge.org/sf/go/artf3235?nav=1

     

     

    When trying to use an external font, AWT doesn't recognize the ttf format:

     

    java.lang.IllegalArgumentException: font format not recognized

     

     

    Code:
    Font font = Font.createFont(12,
    getClass().getResourceAsStream("/jasperpoc/font/LiberationSans-Regular.ttf"«»));
    GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font);
  8. That Map is for report parameters.

    One of the entry's in that report parameters Map can be the JRDataSource, but you can also provide it explicitly.

     

    Take a look at the javabean datasource example in the examples.

  9. Yes, it's possible:

     

    Code:
    JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);

     

    If you use the ServletResponse's outputstream (after setting it to binary and mime type pdf) it should work.

  10. Is there any way to do this platform independend?

    My software needs to run at least on linux (Red Hat, CentOs, Ubuntu) and Windows (XP, Vista).

     

    I don't really care which font ttf is used exactly, but I 'd like to furfill these requirements:

    Font Times New Roman (or something that looks like it)

    Platform independend

    I should never lose a line of text in my PDF

    [/ul]

     

    Is there anything that could explain why I only lose that line when I am using padding?

    The PDF now doesn't show the line, probably because it has 1 pixel height to few to show it. Is it possible to force the PDF exporter to show as much of the line as possible anyway?

  11. If I drop the pdfFontName attribute, it's definitly no longer Times New Roman in the pdf, so the default awt2pdf font mapping isn't correct (is there such a mapping out of the box?)?

     

    If I do set the pdfFontName attribute, it turns out that awt "Times New Roman" doesn't match pdf "Times-Roman" as I lose a line.

  12. It happens only in PDF, not in the JasperViewer apparently.

     

    I've just added this to my PDFExporter

    Code:
                    exporter.setParameter(JRPdfExporterParameter.FORCE_LINEBREAK_POLICY, Boolean.TRUE);

    but that doesn't solve the problem.

     

    According to the FAQ it could be because the PDF font doesn't match the AWT font.

    I declared the fonts as such:

    Code:
    [code]<style name="base" isBlankWhenNull="true"
    fontName="Times New Roman" fontSize="12" pdfFontName="Times-Roman">
    <box padding="2"/>
    </style>
    <style name="text" style="base" isDefault="true">
    </style>
    <style name="textEmphasis" style="base"
    isItalic="true" pdfFontName="Times-Italic">
    </style>
    <style name="textStrongEmphasis" style="base"
    isBold="true" pdfFontName="Times-Bold">
    </style>

     

    But those definitly don't match.

    Removing all pdfFontName attributes (and relying on the default awt2pdf font mapping, which I 'd like to do) doesn't solve it either.

     

    Thanks for the help :)

×
×
  • Create New...