Now it works, looks pretty and fine - many thanks!
The hint, that one has to discard the ColumnText used for testing with the go-method, and create a new one for putting the contents finally in, is MOST ESSENTIAL! It is most important and should be mentioned first thing, in order to avoid such ugly results, which I got before.

Thanks for doing so after all, but I guess I'm not the only one, who got confused with it. Perhaps you should think of creating a method of the ColumnText, which does the testing for enough space and, in case the elements don't fit, creates a new instance of its own and puts the contents there. Everybody who wants to use (or has to use) ColumnText must write his/her own method, which does more or less the same (keeping control of the elements to be kept together), which isn't much efficient. Just a thought, but propably worth some thinking over, don't you agree?

Anyways, many thanks
Michael

2006/6/1, Paulo Soares <[EMAIL PROTECTED]>:
You have to discard the ColumnText used to test and create a new one.
 
Paulo


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Michael Caletka
Sent: Thursday, June 01, 2006 6:03 PM

To: Post all your questions about iText here
Subject: Re: [iText-questions] Keeping things together

But there IS an output on the next page! Bruno had explained, that the ct.go(true) can be used to see, if the elements fit on a page, and if not I can create a new page and put the whole elements that should be kept together there. If I ALWAYS get an output of what is left on the next page, this is no propper way of keeping things together, which would bring me back to my initial problem....

Is there a real solution to this?

2006/6/1, Paulo Soares <[EMAIL PROTECTED]>:
ct.go(true) does exactly the same thing as the regular go() with the exception that there's no output. This means that it consumes the text and whatever is left will be used next. You'll have to create a new ColumnText or use the copy constructor just for testing.
 
Paulo


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Michael Caletka
Sent: Thursday, June 01, 2006 3:56 PM

To: Post all your questions about iText here
Subject: Re: [iText-questions] Keeping things together

Now a different problem has appeared. When I simulate the additions, it seems, that the part, that doesn't fit on the first page gets printed anyways on the second page, and the y-coordinate starts at the position afterwards. Maybe there's some conflict with the PageEvents? In order to ilustrate the effect I have added some code and the end-product. I don't think that this looks very sexy. Maybe there's some problem with working on the DirectContents all the time?

2006/6/1, Paulo Soares <[EMAIL PROTECTED]>:


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto: [EMAIL PROTECTED]] On
> Behalf Of bruno
> Sent: Thursday, June 01, 2006 8:44 AM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Keeping things together
>
> Michael Caletka wrote:
>
> > Sorry, AddElement DOES do the job! Somehow I must have been
> confused a
> > little.
>
> It is very important not to mix setText and addElement.

And don't confuse with addText either.

Paulo

> I explain this in my book (that will probably be released
> in November), but it's difficult to explain in a few sentences
> in a mail.
> br,
> Bruno


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.






_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions




Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.




_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions




Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.




_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions



_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to