Look at AcroFields.java for the relation between the pdf names and the
fonts. These are the names to be used in BaseFont.
stdFieldFontNames.put("CoBO", new String[]{"Courier-BoldOblique"});
stdFieldFontNames.put("CoBo", new String[]{"Courier-Bold"});
stdFieldFontNames.put("CoOb", new String[]{"Courier-Oblique"});
stdFieldFontNames.put("Cour", new String[]{"Courier"});
stdFieldFontNames.put("HeBO", new String[]{"Helvetica-BoldOblique"});
stdFieldFontNames.put("HeBo", new String[]{"Helvetica-Bold"});
stdFieldFontNames.put("HeOb", new String[]{"Helvetica-Oblique"});
stdFieldFontNames.put("Helv", new String[]{"Helvetica"});
stdFieldFontNames.put("Symb", new String[]{"Symbol"});
stdFieldFontNames.put("TiBI", new String[]{"Times-BoldItalic"});
stdFieldFontNames.put("TiBo", new String[]{"Times-Bold"});
stdFieldFontNames.put("TiIt", new String[]{"Times-Italic"});
stdFieldFontNames.put("TiRo", new String[]{"Times-Roman"});
stdFieldFontNames.put("ZaDb", new String[]{"ZapfDingbats"});
stdFieldFontNames.put("HySm", new String[]{"HYSMyeongJo-Medium",
"UniKS-UCS2-H"});
stdFieldFontNames.put("HyGo", new String[]{"HYGoThic-Medium",
"UniKS-UCS2-H"});
stdFieldFontNames.put("KaGo", new String[]{"HeiseiKakuGo-W5",
"UniKS-UCS2-H"});
stdFieldFontNames.put("KaMi", new String[]{"HeiseiMin-W3",
"UniJIS-UCS2-H"});
stdFieldFontNames.put("MHei", new String[]{"MHei-Medium",
"UniCNS-UCS2-H"});
stdFieldFontNames.put("MSun", new String[]{"MSung-Light",
"UniCNS-UCS2-H"});
stdFieldFontNames.put("STSo", new String[]{"STSong-Light",
"UniGB-UCS2-H"});
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Marco
> Sent: Monday, June 30, 2008 11:35 AM
> To: [email protected]
> Subject: Re: [iText-questions] Acrofield and font type
>
> Sorry for my silence but I was in holiday :)
>
> 1T3XT info <info <at> 1t3xt.info> writes:
>
> >
> > Marco wrote:
> > > One question: from an acrofield I can get PdfName.DA to
> know the Helv type.
> >
> > Please explain. You get an appearance stream containing the
> name /Helv.
>
> read under..
>
> >
> > > When I want to create the basefont I must use the
> constant "Helvetica" and
> > > not "Helv".
> >
> > In the resources of this stream you can find out that /Helv
> is a name
> > referring to a dictionary where one of the key-value pairs is
> > /BaseFont /Helvetica
> >
>
> Where can I find this dictionary?
>
> > > There's a way to transform "Helv" in "Helvetica"? so I
> can use it to
> transform
> > > every font style.
> >
> > The name used to refer to a font can be anything.
> > Sometimes it will be /f1, it could even be /Marco.
> > If you want the font name, you have to look in the
> > resources dictionary (/DR).
>
> I write the code I use:
>
> //Start
> PdfStamper stamp = new PdfStamper(reader, new
> FileOutputStream("c:\\XXX.pdf"));
> AcroFields acroForm1 = stamp.getAcroFields();
> acroForm1.setField("Testo3", "Prova marco con sfondo bianco");
> Item testo3 = acroForm1.getFieldItem("Testo3");
> ArrayList strutturaTesto = testo3.values;
>
> //Get Item's dictionary
> for (int i=0; i<strutturaTesto.size(); i++) {
> PdfDictionary dict = (PdfDictionary)strutturaTesto.get(i);
> }
> ------------------------------------
>
> In debug i read for dict variable:
> {/[EMAIL PROTECTED],
> /Type=/Annot, /F=4, /AP=c
> [EMAIL PROTECTED], /V=Prova marco con sfondo
> bianco, /Q=1, /Subtype=/Widget, /T=Testo3, /Ff=1,
> /Rect=com.lowagie.text.pdf.Pd
> [EMAIL PROTECTED], /DA=/Helv 14 Tf 0
> g, /FT=/Tx, /[EMAIL PROTECTED]
>
> I use the /DA that contain /Helv but I don't know how to use
> this to write
> another text using the same font type.
>
> I don't see the /DR.
>
> Thanks,
> Marco
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.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
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