> Show me your code.

The code basically does this:

        content.roundRectangle((float) nativeToDevice(getX()), (float) 
nativeToDevice(getY()), (float) nativeToDevice(getWidth()), (float) 
nativeToDevice(-getHeight()), (float) nativeToDevice(smallest));
        content.setLineWidth((float) nativeToDevice(borderWidth));
        content.stroke();

content is a Document.getDirectContent() PdfContentByte object.
In the execution, the paramters looks like this:

content.roundRectangle(291.68503, 776.5795, 14.173228, -15.703937,
3.3543307);

The - at the height comes because my engine calculates everything from
top to bottom, but the coordinate system in iText (or PDF) is from
bottom to top, so I write a rectangle backwards.

The line width comes to 

0.8503937


As for the picture problem.. well.. I don't think that this is a problem
of iText at all (except the file size, but that comes down to be my
problem as well I guess). The code I have right now, does this:

  // Convert the image that comes in whatever format possible to PNG..
    try { imageConverter.convert(object, "png"); }
    catch (IOException io) {
      io.printStackTrace();
      return;
    }
    
   // get the AWT image container in PNG format
    java.awt.Image awtImage = (java.awt.Image)
    imageConverter.getObject();

  // get a PDF image instance of this AWT image
    Image pdfImage;
    try { pdfImage  = Image.getInstance(awtImage, null); }
    catch (BadElementException be) {
      be.printStackTrace();
      return;
    }
    catch (IOException io) {
      io.printStackTrace();
      return;
    }

  // If its a picture (and not a barcode...)
    if (object.getOrigin() instanceof Picture) {
      // write the background and border styles...
      decorateField(outputContainer, object);
      Dimension dimension = (Dimension) object.extensions().get(Dimension.class);
      switch (((Picture) object.getOrigin()).getSizeMode()) {
        case Picture.ORIGINAL:
          break;
        case Picture.STRETCH:
          // Stretch the picture to fill the dimension of the original
          // container...
          pdfImage.scaleAbsolute((float) nativeToDevice(width), (float) 
nativeToDevice(height));
...
    // Now set the picture to the position set by the report engine...
    pdfImage.setAbsolutePosition((float) nativeToDevice(pX), (float)
    nativeToDevice(pY - height));
    
    // and add it to the PDF..
    try { content.addImage(pdfImage); }
    catch (DocumentException de) { de.printStackTrace(); }


Thats it. I did not yet implement clipping, because I don't know how to
do it yet, I'm still experimenting with java.awt.Image.setClip(), but
that has nothing to do with iText.

I dont' know if my problem is something that has already been answered
many times before, as I did not search into the forum that deeply, but I
didn't see anything. If this is the typical "iText newbie didn't RTFM"
question, I would like to apologize in advance, and I will sadly hang my
head to shame and return to the tutorials and FAW's, but I couldn't find
it, so.. :-)

Regards and many thanks,
Roger Misteli



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id�66&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to