This is all equivalent:

<div face="times-roman" size="11px">Hello</div>
<div style="font-family:times-roman; font-size:11">Hello3</div>
<div class="pdfFont">Hello5</div>

With a style sheet:

StyleSheet styles = new StyleSheet();                                 
styles.loadStyle("pdfFont", "size", "11px");

styles.loadStyle("pdfFont", "face", "times-roman");

I attach the resulting PDF.

Paulo                                 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, October 25, 2006 11:06 AM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] StyleSheet / HtmlWorker and 
> granular font size
> 
> 
> Hi, 
> 
> Having gotten help regarding this in the past (Thanks Paolo 
> and Leonard...) i have now stumbled across something that i 
> can't seem to fix. I currently use HtmlWorker together with 
> StyleSheet to populate a PDF using HTML. Most of this works 
> like a dream. The problem is that i need to force the fonts 
> (normal font) to use Times-roman 11pts. Whatever i try, i 
> always get Times-roman 12 pts (equal to font size="4"). Since 
> there is no way other than to use a StyleSheet, i have tried 
> to add directives for this size using the StyleSheet class: 
> 
>                                 styles = new StyleSheet();    
>                              
>                                 styles.loadStyle("pdfFont", 
> "size", "11px");                                 
>                                 styles.loadStyle("pdfFont", 
> "font-size", "11px"); 
> 
>                                 ArrayList array = 
> HTMLWorker.parseToList(sr,style);  // array of itext objects  
>                
>                                                               
>                           
>                                 float[] position = 
> af.getFieldPositions( bodyFieldName ); 
>                                 ... 
>                                 ... 
> 
> (I define my font as a class called "pdfFont". Have also 
> tried to use loadTagStyle for fonts of class "pdfFont" as 
> well as for normal font tags. Have tried "px" and "pt"... No success) 
> 
> Whatever i try, the font size is always 12pts 
> 
> Is it possible to control this in such a granular matter? 
> What would be the best way to achieve this? 
> 
> Since (as i know of) only NN browsers allow for controling 
> the "point size" in the HTML directly, this is not an option 
> either (we mainly use IE). 
> 
> Kind regards 
> 
> Daniel
> 


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.

Attachment: test3.pdf
Description: test3.pdf

-------------------------------------------------------------------------
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