Reputation: 125
I overview the html with css in chrome, it looks normal as follows:
while pdf looked dislike the same as follows:
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:
Upvotes: 1
Views: 1200
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:
Upvotes: 4