Underthesun
Underthesun

Reputation: 125

font color changed when converted to pdf from html/css using itext and flying-saucer

I overview the html with css in chrome, it looks normal as follows:

html:enter image description here

while pdf looked dislike the same as follows:

pdf:enter image description here

pdf2: enter image description here

As you see in pdf2, the font is not bold, but outlined with black color。And my code snippet here:

.title{
	font-size: 2em;
	color: #4d82bf;
	font-weight: bold;
	padding-left: 20px;
}
 <p class="title">报告书总览 Summary Overview</p>

Does anybody know how to make the html and pdf displayed the same with bold font?

TIP: without the font-weight font-weight: bold;style, they look the same:

html: enter image description here pdf:enter image description here

Upvotes: 1

Views: 1200

Answers (1)

Underthesun
Underthesun

Reputation: 125

After searching a few hours, I found this question Can't change bold text color, a 'black border' remains which answered by @Bruno Lowagie, the creator of iText. According to the accepted answer, a couterpart bold font(.ttf) file is needed. After adding 'msyhbd.ttf' to the ItextRender, my program worked well! Thanks to @Bruno Lowagie , and hope this post would help anybody! Results as follows:

enter image description here

Upvotes: 4

Related Questions