1

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

Underthesun
  • 125
  • 2
  • 11

1 Answers1

4

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

Underthesun
  • 125
  • 2
  • 11
  • 1
    Great that you added your own answer after you've found the solution. This helps others which have the same problem. So welcome to SO! – Lonzak May 22 '18 at 08:36