Hello,

I've just tried to position a Rectangle within a PdfDirectContent at an
absolute position using the following code:

  try {
    PdfWriter writer = PdfWriter.getInstance(document, new 
FileOutputStream("pdf/RectangleTest.pdf"));
    document.open();

    PdfContentByte cb = writer.getDirectContent();

    // First rectangle is being painted
    cb.rectangle(100, 100, 100, 100);

    // Second rectangle is NOT being painted - why not?!?
    Rectangle rect = new Rectangle(200, 200, 300, 300);
    rect.setBorderWidth(2f);
    rect.setBorderColor(Color.RED);
    cb.rectangle(rect);

    cb.stroke();
  } catch (DocumentException de) {
    System.err.println(de.getMessage());
  } catch (IOException ioe) {
    System.err.println(ioe.getMessage());
  }


However, while the first rectangle is being painted the second one that
should have a red border is not being painted.

Could anyone please enlighten me as to why the above code is not working
the way it should? I'd like to use the rich set of features of Rectangle
to change the color of the background, set different widths of the border
on each side, and so on...

Thanks in advance for any hint.

Christian




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to