Jump to content

z3gator

Members
  • Posts

    7
  • Joined

  • Last visited

z3gator's Achievements

Rookie

Rookie (2/14)

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

Recent Badges

0

Reputation

  1. Thank you so much for the detailed response. I haven't had time to investigate it yet, but I am hopeful that the table support added to the latest release will enable me to eliminate my need for a generic element.
  2. While I haven't delved deeply into it, I've observed another anomaly with generic elements that might be related. From tracing added to my generic component, it looks like it is being called after the rest of the report is evaluated. I added some text that I wanted to be conditional on whether the generic element consumed much less space than was reserved for it, but the conditional depends on having the generic element executed first (so that the actual height is known) and that never seems to happen. It doesn't matter what evaluationTime I set for the text, it always gets evaluated before the generic element. If it is indeed always being invoked after everything else, then that could also contribute to the lack of stretch support.
  3. Any help here? I'm sort of stuck if I cannot make this element stretch. I have set it up so that I force a page break if the actual height turns out to be greater than a certain threshold, but that is sub-optimal when the table is smaller than that threshold (i.e. it leaves a lot of undesirable whitespace before the next element). It seems like I need to be able to call setStretchHeight on the JRFillElement, but my handler only has the JRGenericPrintElement to work with (at least, I couldn't figure out a way to gain access to the associated JRFillElement). Is this a bug, or am I just missing something I need to do besides just setting the stretchType?
  4. I have implemented a generic element to export a fairly complex PDF table, but the engine does not seem to recognize that the table consumed more vertical space than the fixed value specified for the generic element (i.e. since the table can have a varying number of rows, the actual height is not known at design time). Consequently, elements that should be pushed down by the table are not, and instead overwrite part of the table. The only way I saw to be able to add the table to the PDF was using the PdfPTable writeSelectedRows method: PdfWriter writer = ctx.getPdfWriter(); PdfPTable table = getBean(element).getResultsTable(element.getWidth()); float x = element.getX() + ctx.getOffsetX(); float y = writer.getPageSize().getTop() - element.getY() + ctx.getOffsetY(); table.writeSelectedRows(0, -1, x, y, writer.getDirectContent()); Perhaps there is another way to add to the PDF output stream that would allow the jasperserver engine to recognize the actual generated height? I knew it was a long shot, but I tried setting the (passed in) element height to the actual height of the table, but that had no effect. I wasn't able to find any examples of a GenericElementPdfHandler -- only an HTML handler, which isn't really applicable. Thanks for any help you can offer.
  5. While not necessary to create a visible signature, that's what our requirements were. While I looked at the generic element support, I ended up using what I believed to be a simpler solution: I placed an anchor in the PDF where I wanted to place the signature and then used a PdfStamper to add the digital signature. The iReport snippet is just: <anchorNameExpression><![CDATA[new String("SIGNED_BY")]]></anchorNameExpression> and then the logic to extract the location from the anchor is: String[] dest = getNamedDestination(reader, "SIGNED_BY"); if (dest != null) { try { sigData.setSigPageNumber(Integer.parseInt(dest[0])); sigData.setSigLowerLeftX(Float.parseFloat(dest[1])); sigData.setSigLowerLeftY(Float.parseFloat(dest[2])+3.0f); sigData.setSigUpperRightX(sigData.getSigLowerLeftX()+150.0f); sigData.setSigUpperRightY(sigData.getSigLowerLeftY()+32.0f); if (logger.isDebugEnabled()) logger.debug("Set signature location to page "+sigData.getSigPageNumber()+" at "+ sigData.getSigLowerLeftX()+","+sigData.getSigLowerLeftY()+", "+ sigData.getSigUpperRightX()+", "+sigData.getSigUpperRightY()); } catch (Exception e) { logger.error("Caught exception processing destination: "+Arrays.asList(dest), e); } } } public static String[] getNamedDestination(PdfReader reader, String name) throws Exception { String[] parts = StringUtils.split((String)SimpleNamedDestination.getNamedDestination(reader, false).get(name), " "); return (parts == null || parts.length < 4) ? null : new String[] {parts[0], parts[2], parts[3]}; }
  6. I have used itext to add a digital signature to a PDF, but in moving to iReport I cannot tell whether there is a way for me to find out where (i.e. page, x, y coordinates) the signature field was positioned in order to position the visible signature. One alternative (which might be useful in general) might be to create an acrofield for the signature, which could later be found in the PDF, but I don't see any indication that it's possible to create form fields via iReport/Jasper. Thanks for any suggestions.
×
×
  • Create New...