Xml解析和itext [英] Xml parsing and itext
问题描述
目前,我能够解析我所给的任何输入。所以我想如果可能,更改字体,字体大小,字体颜色等。
谢谢
您可以创建自己的 CSS
样式并将其添加到您的HTML代码。 CSS样式将根据下面给出的优先级来应用,其中优先级不高于4。
$ b 1)浏览器默认
2)外部样式表
)内部样式表
4)内联样式
示例:
$ pre code> document.open();
String finall =< style> h1 {color:orange;}< / style>< body>< h1>这是一个Demo< / h1>< / body>
InputStream is = new ByteArrayInputStream(finall.getBytes());
XMLWorkerHelper.getInstance()。parseXHtml(pdfWriter,document,is);
document.close();
在示例中,橙色将被设置为标题。
Just wanted to know if it is possible to change the font,color,font size while parsing html to pdf using xmlWorker.parser Currently I am able to parse whatever I have given as the input.So I wanted to change the font,font size, font color etc if possible. Thank you
You can create your own CSS
style and add it to your HTML code. The CSS style will be applied according the priority given below where no 4 is the higher priority.
1)Browser default 2)External style sheet 3)Internal style sheet 4)Inline style
Example:
document.open();
String finall= "<style>h1{color:orange;} </style><body><h1>This is a Demo</h1></body>";
InputStream is = new ByteArrayInputStream(finall.getBytes());
XMLWorkerHelper.getInstance().parseXHtml(pdfWriter,document, is);
document.close();
In the Example Orange color will be set to the header.
这篇关于Xml解析和itext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!