Hi Bill

I found this message that had code to redirect from a JTextPane to 
iText.  I didn't see any z-order in it.

From: Bill Ensley <bill <at> bearprinting.com>
Subject: RE: text editor and itext
Newsgroups: gmane.comp.java.lib.itext.general
Date: 2005-12-11 17:47:46 GMT (29 weeks, 6 days, 10 hours and 52 minutes 
ago)

This is the critical snippet.

     // a JTextComponent makes a copy of any graphics you pass to it 
and     then paints itself last.

      // this fix makes the JTextComponent paint when you want it to, 
not when it wants to.


      Rectangle alloc = getVisibleEditorRect(ta);
      ta.getUI().getRootView(ta).paint(g2, alloc);

Thanks very much for that piece of code.  It rescued me big time.

However, we seem to be operating with different values of trivial :)

Also I have not explained myself clearly enough.

I am using a variant of the above code to put the text in the pdf file 
but I am using the iText Image class to put the images in a PdfTemplate 
object which then get added to the page.  I was using awt.Image but it 
lost resolution so I couldn't use it to print.  I am still using it on 
the screen. The text itself always appears over the images in the pdf 
file (until I clipped the text), however the text background is under 
the images.  The z-ordering is correct on the screen (I am using 
JLayeredPanes there, one to hold the whole screen and one each for each 
text or image element, which also holds drag and resize handles);

The clipping solution won't work for images with transparent 
backgrounds.  These are unlikely/rare but it would be good if they worked.

Jim Rootham


Bill Ensley wrote:
> You need to search the mail archives for my post on writing a styled document 
> to 
pdf with iText. If you do it right, it is trivially easy.  It gives 
instructions on
how to get around the z order problem.  It is not a design decision, but 
rather a
feature/bug of JTextPane. I am mobile right now, but I can send you the 
code later today.
> 
> Bill Ensley
> Bear Printing
> 
> -----Original Message-----
> From: "Jim Rootham" <[EMAIL PROTECTED]>
> To: itext-questions@lists.sourceforge.net
> Sent: 7/8/06 10:10 AM
> Subject: [iText-questions] iText and z-order
> 
> Hi
> 
> I am writing a layout editor and I need to output pdf files.  I have got 
> iText working OK (translating StyledDocument to iText is not as trivial 
> as I would like).  However, there is a more serious problem.
> 
>  From the docs, examples, and mailing list messages it seems that there 
> is a design decision that images cannot be placed over text.  I am 
> currently working around that by clipping the text with the bounding 
> boxes of the elements on top of the text (which is a pain).  But even 
> then there will be a bug.  Images with transparent backgrounds will have 
> the text still over them.
> 
> Are there any proposals for iText to control the z-order?
> 
> Jim Rootham
> 
> 
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to