Upload text document and convert to PDF (fix garbled)

Source: Internet
Author: User

Some days ago, Insus.net shared an article "upload text document and convert it to PDF" http://www.cnblogs.com/insus/p/4313092.html It is handled in the simplest and the default way.

It is in the processing of text files with Chinese, when converted to PDF, Chinese is not normal display, garbled.

This article is on that basis, to reconstruct, to solve the garbled problem.

To solve the character problem, we need to create a directory under the project, such as fonts, which is used to store fonts. Let's go to the Windows directory to put SimSun. TTC font copy over.



In the controller's Postfile () operation, also need to modify some code, such as the previous article is to upload the file into a temporary directory, now feel it a bit redundant, directly to read the HttpPostedFileBase InputStream can.

Demo, first folder to create a text file in Chinese:



If the program is normal, the converted PDF should be no different from the text file above:



Upload text document and convert to PDF (fix garbled)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.