Op 23/08/2012 9:09, Alexis Pigeon schreef:
Hi tweeti,

On 23 August 2012 01:35, tweeti <[email protected] <mailto:[email protected]>> wrote:

    I'm trying to create engineering data and one of the requirement
    is to embed
    a square box, with number inside, or a hexagone with a number
    inside.  Can
    that be possible with itext?


With a bit of mathematics, you can achieve drawing any shape with the help of PdfContentByte [1], in particular the methods moveTo(float, float) and lineTo(float, float). Have a look at the examples [2] in order to understand how these work.

Yes, using the methods available in PdfContentByte, is the best option to draw those objects (much better than using an image).

Once you know how to draw vectors, you'll need to decide how to add them. There are many different options.

For instance: if you use these 'glyphs' frequently throughout the content of your text, you could create a user-defined font (a Type 3 font). I'm not sure what Adobe's point of view is regarding Type 3 fonts (do they have a future?), but it can be fun. If you create a Type 3 font and you define that the character '1' has to be drawn as a hexagon with the number 1 inside, you can use that special font the same way you would use any other font.

Or you can create a small PdfTemplate object, wrap it in an Image object, and wrap the Image in a Chunk. You can then use that Chunk whenever you want (for instance: as part of a Phrase, Paragraph,...). Note that the Image will still be a vector image (iText won't convert it to a raster image).

Which is the best solution all depends on how you intend to use those graphical objects...
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to