We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to keep word style when converting word to PDF

How to keep word style when converting word to PDF?

eg:
DOC :
image.png (46.9 KB)
PDF:
1641790994(1).png (54.0 KB)

eg:
DOC :
1641791070(1).png (177.0 KB)

PDF:
1641791091(1).png (182.3 KB)

Word is different from PDF in style,Is there any way to solve it?

The code is as follows:

Document doc = new Document(inputStream);
// Remove all comments.
NodeCollection comments = doc.getChildNodes(NodeType.COMMENT, true);
comments.clear();
Document document = new Document()
document.removeAllChildren();
document.appendDocument(doc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
document.save(path, SaveFormat.PDF);

@Hayder.lai Could you please attach your input and output documents here for testing? We will check the issue and provide you more information.