The PDF file converted from iTextSharp with Chinese characters is garbled,
Just now, I wrote a small exercise "Saving Html code as a PDF file" http://www.cnblogs.com/insus/p/4323224.html. Some netizens immediately said that when the intercepted block contains Chinese characters, the saved PDF file will be garbled. Remember the previous article "Upload Text Document and convert to PDF" http://www.cnblogs.com/insus/p/4313092.html #2 floor netizens also feedback the same problem.
Insus. NET decided to test and solve this problem. First, let's take a look at the test html, Which is garbled or not displayed.
Open the controller and create two operations, mark A and mark B:
Create a view in the order marked below.
To solve the character problem, we need to create a directory under the project. For example, Fonts is used to store Fonts. In the windows directorySIMSUN. TTCCopy the font.
Go back to the Controller, expand the TestChineseCharacter () Action, and write the handler:
Demo: