I wrote a sample code that converts word documents into PDFs with the latest version (12.7.17)
In PDF, Korean_Digital, Korean_Legal, and Korean_CountingListPatternType all change to 1,2,3..Arabian numerals.
How can I mark it in Korean?
I've also added the sample code I've written.
- Code: Select all
//Create a Document object
Document document = new Document();
Document.setGlobalCustomFontsFolders("C:\\ws\\wordtohtml\\fonts");
document.setEmbedSystemFonts(true);
document.setEmbedFontsInFile(true);
document.setKeepSameFormat(true);
PrivateFontPath fontPath1 = new PrivateFontPath();
fontPath1.setFontName("맑은 고딕");
fontPath1.setFontPath("C:\\ws\\wordtohtml\\fonts\\malgun.ttf");
document.getPrivateFontList().add(fontPath1);
//Add a section
Section section = document.addSection();
//Create a numbered list style
ListStyle listStyle = new ListStyle(document, ListType.Numbered);
listStyle.setName("numberedList");
document.getListStyles().add(listStyle);
//Add a paragraph
Paragraph paragraph = section.addParagraph();
paragraph.appendText("Required Web Development Skills:");
paragraph.getFormat().setAfterSpacing(5);
//Add a paragraph and apply the numbered list style to it
paragraph = section.addParagraph();
paragraph.appendText("HTML");
paragraph.getListFormat().applyStyle("numberedList");
paragraph.getListFormat().setListLevelNumber(0);
//Add another four paragraphs and apply the numbered list style to them
paragraph = section.addParagraph();
paragraph.appendText("CSS");
paragraph.getListFormat().applyStyle("numberedList");
paragraph.getListFormat().setListLevelNumber(0);
paragraph = section.addParagraph();
paragraph.appendText("JavaScript");
paragraph.getListFormat().applyStyle("numberedList");
paragraph.getListFormat().setListLevelNumber(0);
paragraph = section.addParagraph();
paragraph.appendText("MySQL");
paragraph.getListFormat().applyStyle("numberedList");
paragraph.getListFormat().setListLevelNumber(0);
paragraph.getStyle().getCharacterFormat().setFontName("맑은 고딕");
// paragraph.get.getCharacterFormat().setFontName("Arial Black");
paragraph.getListFormat().getCurrentListLevel().setPatternType(ListPatternType.Korean_Counting);
paragraph.getListFormat().getCurrentListLevel().getParagraphFormat().setAfterSpacing(50);
paragraph.getListFormat().getCurrentListLevel().getCharacterFormat().setFontName("맑은 고딕");
paragraph.getListFormat().getCurrentListLevel().getCharacterFormat().setFontSize(20);
paragraph.getStyle().getCharacterFormat().setFontName("맑은 고딕");
//Save the document to file
document.saveToFile("output/NumberedList.docx");
ArrayList<PrivateFontPath> fontPathList = new ArrayList<>();
fontPathList.add(fontPath1);
ToPdfParameterList ppl = new ToPdfParameterList();
// ppl.isEmbeddedAllFonts(true);
// ppl.setEmbeddedFontNameList(fontNameList);
// ppl.setUsePSCoversion(true);
// ppl.setAutoFitTableLayout(true);
// ppl.setMimicWPSLayout(true);
ppl.setPrivateFontPaths(fontPathList);
ppl.setPdfConformanceLevel(PdfConformanceLevel.Pdf_A_1_B); // https://docs.fileformat.com/ko/pdf/a/
// ppl.setMemoryOptimization(true);
document.saveToFile("output/NumberedList.pdf", ppl);