Wednesday, January 16, 2019

SuiteScript > nlapiXMLtoPDF > Generated PDF does not display Chinese characters

** The font-family:mhei also seems to work for Russian characters, so if the article can be updated to include sample below :

var template = "<?xml version=\"1.0\"?>\n<!DOCTYPE pdf PUBLIC \"-//big.faceless.org//report\" \"report-1.1.dtd\">\n <pdf>\n <head> <style type=\"text/css\"> body { font-family:mhei; }</style> </head> <body font-size=\"18\" >\n Hello World!\n\n СЧЕТ - ФАКТУРА \n</body>\n</pdf>";

In order to display Chinese characters in the created PDF file you must specify the font family style of "mhei". 



This can be done by adding font-family:mhei style in the head of your xml string.


Sample:



var xml = "<?xml version=\"1.0\"?>\n<!DOCTYPE pdf PUBLIC \"-//big.faceless.org//report\" \"report-1.1.dtd\">\n <pdf>\n <head> <style type=\"text/css\"> body { font-family:mhei; }</style> </head> <body font-size=\"18\" >\n Hello World!\n\n 汉字/漢字 \n</body>\n</pdf>";


 

No comments:

Post a Comment