2016-08-10 4 views
0

Wie kann ich meine PDF-Körper Schriftgröße "6.6pt" mit XMLWorker?iTextSharp PDF Basis Schriftgröße mit XMLWorker

Ich habe erreicht mit HTMLWorker als wie unten,

var style = new StyleSheet(); 
style.LoadTagStyle("body", "size", "6.6pt"); 
HTMLWorker htmlWorker = new HTMLWorker(pdfDoc); 
htmlWorker.SetStyleSheet(style); 

Aber wie kann ich das mit XMLWorker?

Antwort

0

Dieser Code-Schnipsel:

var style = new StyleSheet(); 
style.LoadTagStyle("body", "size", "6.6pt"); 

war eine schlechte Version CSS zu den HTML-Code der Anwendung Sie wurden Parsen.

Wenn Sie XML Worker verwenden, können Sie echtes CSS verwenden.

Gehen Sie auf der offiziellen Website und werfen Sie einen genaueren Blick auf die examples, wo wir CSS haben, wie:

<table style="font-size:10pt"> 

Html: table10.html; Java: ParseHtmlTable10.java; PDF: html_table_10.pdf

oder CSS wie:

p   { font-size: 11px; font-family: "verdana", tahoma, arial, sans-serif; color: #040404; background-color: #FFFFEE; margin-top: 5px; margin-bottom: 8px; margin-left: 10px; } 
h1   { font-size: 17px; color: #FFA500; margin-bottom: 10px; background-color: #0000EE; padding-top:6px; padding-bottom:7px; padding-left:10px; }  
h2   { font-size: 15px; color: #0055AA; margin-bottom: 10px; margin-top: 16px; background-color:#FFCC66; padding-top:0px; padding-bottom:2px; padding-left:10px; } 
h3   { font-size: 15px; color: #660000; margin-bottom: 8px; margin-top: 15px; } 
h4   { font-size: 12px; color: black; margin-bottom: 8px; margin-top: 15px; margin-left: 8px; font-style: normal; } 
code  { font-size: 12px; margin-left: 16px; padding-left:16px} 

HTML: paragj.html; Java: ParseHtmlTable6.java; PDF: html_table_6.pdf

+0

Vielen Dank @Bruno ... –

+0

@UMAMAHESH Wenn es funktioniert, bitte akzeptieren Sie die Antwort. –

+0

ok Sicher Bruno ... –