-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

Recently I started using iText with JRuby and I really like the library
(it's way better than the pure Ruby libraries available). Currently I'm
working on a piece of code to generate a PDF page with index cards on
it. In order to lay out the cards on the page I thought I could create a
table, and then place the index cards' contents into each cell.

While that seems to work I also need to set an image as a background for
each of the cells under the text content.

After some reading I know I have to create a class which implements the
PdfPCellEvent interface. My initial cellLayout method of that class
looks more or less like this (hope you don't mind the Ruby code, the
method calls are almost the same):

  def cellLayout(cell,rect,canvas)
    cb = canvas[PdfPTable::BACKGROUNDCANVAS]
    card = Image.getInstance("lib/cards/index_card_72.jpg")
    card.scaleToFit(298, 210)
    card.setAbsolutePosition(cell.getTop, cell.getRight)
    cb.addImage(card)
  end

The image appears below the tables. What is the best approach in
positioning those images ? I tried different approaches (with using the
rect's and cell's coordinates with no luck. I would appreciate any help
or suggestions regarding the optimal way of solving this.

Best regards,
- -- 
Łukasz Badura
E-mail: [email protected] | Jabber: [email protected]
WWW: http://www.badurowie.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkw0eykACgkQOw4sRDzkBPnXYACaAvoxNCPaC1t/FXCYIoRKOrUY
1T4AnA0heCmRuuUtGw7tROLRVOG64nWE
=XaA8
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to