This works! Thanks Bruno. That was the last piece to the puzzle.  Now we
plan to go live with Electronic Invoicing next week.  I just had to
change the custom event handler class to accept the text as a parameter
and I was in business.

That's a good solution to remember because I'm sure, like our shop, some
managers want new electronic pdf forms to look like the old forms that
came off the line printer.  Sometimes this means creating and coloring
table cells and painting text over the top while still showing the
borders and coloring of the cells underneath.  This simulates printing
over the top of a preprinted form.

Cheers,
Mike Buchanan

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Bruno Lowagie (iText)
Sent: Friday, January 19, 2007 1:32 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Overlay text across multiple table cells

Mike Buchanan wrote:
> It does get frustrating when I
> can pump in a few hundred lines of code a day but then it sometimes
> takes two or three days to figure out how to do just one function.

I studied architecture.
As a developer I'm a Mies Van der Rohe adept: Less is More.
I'd rather spend a week doing nothing, thinking about how to
solve a problem, and then code 100 lines solving the problem
in one day. Then code a 1000 lines a day for two weeks, ending
up with a solution that is almost impossible to maintain.

> In the book, page 284, it notes that drawing lines and shapes is
called
> "constructing and painting paths".  So, what is a path? 

On the same page, it says: "The first thing you need to know
is how to draw lines and shapes; in PDF terminology this is
called constructing and painting paths."

> I understood it
> to be setting a starting position in a table cell and then placing
> something there.

No, it's about drawing lines and shapes.

>  The example you returned to me does the same as the
> example in the book, it simply draws a line through the table cell. 

Yes, because I hadn't the faintest idea of what you
were trying to achieve.

> So
> you moveTo() a starting point and then lineTo() a destination point to
> draw the line.  This I understand.  Now I need to moveTo() a starting
> point and draw the text, not a straight line.

So you want to draw text instead of lines and shapes?
Then you should move on to chapter 11 (p344):
"The text state is a subset of the graphics state."

> Simply put, we need to overlay several table columns with text while
> still showing all of the borders and coloring of the table columns
under
> the text.  In effect, this is like printing over a preprinted form, if
> you catch my drift.

See the attachment.
Of course, showTextAligned DOESN'T WRAP the text string.
Maybe you'll want to calculate the width of the String first,
and then change the font accordingly. Or you may want to use
ColumnText to position the text correctly; I don't know...
It all depends on your requirements. And it's all explained
in the book. I'm not using any special methods that aren't
mentioned in the book here.

Maybe I should start thinking about a 3 day course on iText.
It would be fun to teach how to use iText, and it would surely
lower the threshold for future users...
best regards,
Bruno

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to