I have not looked at the output PDF data but am using Acrobat 7.0.7 to display.


Moving the cb.setFontAndSize() inbetween BT/ET makes no difference in my testing to the output (despite my previous claim it did). The only thing that reliably corrects the problem is to use the extra cb.setFontAndSize().

Another thing I noted in chopping down the code is it only affect ALIGN_RIGHT. Which makes me think it is an acrobat rendering bug.


I have a working compilable example and example output files I have prepared into a ZIP file. I will shortly email to everyone who posted a reply/followup to the thread, if you didn't want it feel free to just delete it from your inbox. If I have missed you out and you would like a copy email me privately.

Regards,

Darryl



Mark Storer wrote:
That code looks kosher to me.  It may be that you're running into a bug in 
Acrobat's imaging model.  If I'm following things correctly, your output will 
look something like:

---
/foo 8 Tf        %%cb.setFontAndSize()
q                %%cb.saveState()
<stuff>
Q                %%cb.restoreState();
BT               %%cb.beginText();
<more stuff>
ET               %%cb.endText();
---

That "Tf" (set the font and size) operator is really only valid inside a 
beginText/endText block.  Given your later comments, it sounds like this will work and be 
valid:

public void outerMethod(PdfContentByte cb, BaseFont font) {
  cb.beginText();
  cb.setFontAndSize(font.getBaseFont(), 8);
  cb.endText();

  //the rest is left alone
  ...
}


-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to