0
votes

Hope someone can help me. It's about docx to pdf conversion having korean sign in docx document. I'm able to convert a docx document to pdf with docx4j.

In pdf document, I can see the result. But if my docx document contains korean font, I can't see any korean font in my pdf document except the latin numbers. What do I have to do to get korean font in my pdf from the docx document?

Here is my code:

File docXFile ="E:/contract2Files/test.docx";
WordprocessingMLPackage wordprocessingMLPackage = WordprocessingMLPackage.load(docXFile);
String   out = docXFile .replace("docx","pdf");
File pdfFile = new File(out);
OutputStream pdfFileOs = new java.io.FileOutputStream(pdfFile);
org.docx4j.convert.out.pdf.PdfConversion c = new JanoPdfConversion(wordprocessingMLPackage);
c.output(pdfFileOs);
2

2 Answers

1
votes

Please try http://www.docx4java.org/docx4j/docx4j-3_0-beta2.zip (link updated 15 Nov)

You might need to configure your font mapper, though things work out of the box with the Identity mapper on my Windows box, since I have the relevant font installed.

If this doesn't help, please put a sample docx somewhere StackOverflow users can see it.

0
votes

thanks again. I tried the newest jar file with this code passage and it worked!!! Now I get the korean letters into pdf. Thank again.

ThemePart themePart = wordprocessingMLPackage.getMainDocumentPart().getThemePart(); org.docx4j.dml.BaseStyles.FontScheme fontScheme = themePart.getFontScheme(); org.docx4j.dml.TextFont textFont = fontScheme.getMinorFont().getLatin(); textFont.setTypeface("Malgun Gothic");