[iText-questions] Drawing lines and boxes inline with text

2009-04-21 Thread Java Developer
I have searched through the mail archives, and examined the API and
tutorial, but still have not found a straight-forward way of doing this.
I need to construct a PDF from text input, where that text contains a token
character ( e.g: * ) that indicates a line to be drawn.

The program needs to dynamically convert these to lines and boxes inline
with the text.

Examples of text input:

  Praesent suscipit  

*
* Cras facilisis rhoncus ante In ute neque. *
* Maecenas iaculis tempor massa. Seda quam  *
*

 
* accumsan et* Donec magna
* vitae rhoncus  * luctus vitae
* Praesent nonummy   * facilisis tortor

Attached is an image showing the desired outcome in the PDF of the  above
sample.

I would appreciate your advise on the best strategy to implement this using
the iText API.

Thanks,

JB
<>--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p___
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Re: [iText-questions] Drawing lines and boxes inline with text

2009-04-22 Thread Java Developer
 Thanks for the suggestion - very interesting, as I have not yet read about
generic tags and page events. Will definitely look into it now.

Some comments for further consideration:

1. The font to be used can be any font - not necesserily a monospaced font.

2. I can foresee a possible problem at the joins, as horizontal lines are
positioned vertically at the middle of the text height, while vertical lines
will be drawn at full height of the text (top to bottom).

... and yes, a fun project indeed :-)

Thanks,

JB




On Wed, Apr 22, 2009 at 4:59 PM, 1T3XT info  wrote:

> Java Developer wrote:
> > I would appreciate your advise on the best strategy to implement this
> > using the iText API.
>
> A possible strategy (it might not be the best one, but it's where I
> would start if I were asked to do this), is:
>
> * first select a monospaced font (for instance courier).
>   Why? Seems like the plain text file is formatted that way.
> * write my own parser that creates chunks.
>   If one "*" create a chunk with a (non-breaking-)space character
>   and add a generic tag with text "vertical"
>   If more "*" create a chunk with as many (non-breaking?) space
>   characters as there are "*" and add a generic tag with text
>   "horizontal"
>   If no "*" create a chunk with the content.
> * implement page events so that a short vertical line is drawn on
>   "vertical" tags and a horizontal line on "horizontal" tags.
>
> This will demands some trial and error to get the lines correct,
> but it should be fun writing something like this. (Also: there's
> no guarantee it will works: that will depend largely on the shape
> your input files are in.)
> --
> This answer is provided by 1T3XT BVBA
> http://www.1t3xt.com/ - http://www.1t3xt.info
>
>
> --
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> ___
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>
--
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p___
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php