That means you aren't embedding the font and so Acrobat/Reader has to
substitute.
Leonard
On Apr 25, 2008, at 10:42 AM, johniText wrote:
>
> Dear 1T3XT,
>
> Thanks a lot for your help. I ran the code you provided, and it
> produced the exact behaviour as I described. I attached the
> PDF file produced on my system for your reference.
>
> The environment of my system is:
> Windows 2000, Java JDK 1.5, Adobe reader version 8.1.0, iText
> version 2.1.0
>
> When I checked the PDF file document properties in Adobe reader, it
> reads:
> Helvetica-BoldOblique
> Type: Type 1
> Encoding: Ansi
> Actual Font: Arial-BoldItalicMT
> Actual Font Type: TrueType
>
>
> thanks again for your help,
> Kevin
>
>
>
> 1T3XT info wrote:
>>
>> johniText wrote:
>>> Hello,
>>>
>>> I am using the convenience class, TextField, to create PdfFormField.
>>> First I create the text field, then I set the text and the font,
>>> color,
>>> etc.
>>
>> I made a small standalone sample and I can't reproduce the following
>> behavior:
>>
>>> But When I open the PDF file using Adobe reader, the font
>>> of the text is NOT what I set in my java code. The weired thing is,
>>> if I click the text field and do some change to it, say, add a
>>> character, and leave the text field by
>>> clicking anywhere in the PDF, then the font is set to what I set in
>>> the java code.
>>
>> I see "test Annotation" in Helvetica Bold Oblique (Italic) when
>> I open the resulting PDF. I also see only one font in the list
>> of fonts when I go to File > (Document) Properties > Fonts
>>
>> The behavior you are describing occurs when the Default Appearance
>> for the text field is different from the appearance created by
>> Adobe Reader when changing the field. This puzzles me.
>>
>> Could you run the attached example on your system, and send us
>> the PDF if it reproduces the problem for you.
>> This will allow us to find out if it's a Reader problem (maybe
>> some version of reader renders the DA the wrong way, however
>> that would surprise me) or if it's an iText problem (maybe an
>> old version of iText didn't create the DA correctly).
>> --
>> This answer is provided by 1T3XT BVBA
>>
>> import java.awt.Color;
>> import java.io.FileOutputStream;
>> import java.io.IOException;
>>
>> import com.lowagie.text.Chunk;
>> import com.lowagie.text.Document;
>> import com.lowagie.text.DocumentException;
>> import com.lowagie.text.Element;
>> import com.lowagie.text.Font;
>> import com.lowagie.text.Paragraph;
>> import com.lowagie.text.Rectangle;
>> import com.lowagie.text.pdf.BaseFont;
>> import com.lowagie.text.pdf.PdfWriter;
>> import com.lowagie.text.pdf.TextField;
>>
>>
>> public class TextFieldTest {
>> public static final String RESULT = "textfield.pdf";
>>
>> public static void main(String[] args) {
>>
>> // step 1
>> Document document = new Document();
>> try {
>> // step 2
>> PdfWriter writer = PdfWriter.getInstance(document, new
>> FileOutputStream(RESULT));
>> // step 3
>> document.open();
>> // step 4
>> TextField textfield = new TextField(writer, new
>> Rectangle(100,400,150,425), "testField");
>> textfield.setText("test Annotation");
>> textfield.setTextColor(Color.BLUE);
>> BaseFont bf =
>> BaseFont.createFont(BaseFont.HELVETICA_BOLDOBLIQUE,
>> BaseFont.WINANSI, BaseFont.EMBEDDED);
>> textfield.setFont(bf);
>> textfield.setFontSize(12f);
>> textfield.setBackgroundColor(Color.lightGray);
>> textfield.setBackgroundColor(new Color(173, 216, 230));
>> textfield.setAlignment(Element.ALIGN_CENTER);
>> textfield.setOptions(TextField.EDIT);
>>
>> Chunk ck = new Chunk(" ");
>> ck.setFont(new Font(bf, 15f, Font.BOLDITALIC,
>> Color.white));
>> ck.setAnnotation(textfield.getTextField());
>> document.add(ck);
>> } catch (DocumentException de) {
>> System.err.println(de.getMessage());
>> } catch (IOException ioe) {
>> System.err.println(ioe.getMessage());
>> }
>> // step 5
>> document.close();
>> }
>> }
>>
>> ---------------------------------------------------------------------
>> ----
>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>> Don't miss this year's exciting event. There's still time to save
>> $100.
>> Use priority code J8TL2D2.
>> http://ad.doubleclick.net/clk;198757673;13503038;p?http://
>> java.sun.com/javaone
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Do you like iText?
>> Buy the iText book: http://www.1t3xt.com/docs/book.php
>> Or leave a tip: https://tipit.to/itexttipjar
>>
>
> --
> View this message in context: http://www.nabble.com/need-help-on-
> TextField-font-tp16851001p16895856.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
> ----------------------------------------------------------------------
> ---
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save
> $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://
> java.sun.com/javaone
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Do you like iText?
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Or leave a tip: https://tipit.to/itexttipjar
>
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar