I am trying to convert docx file to PDF which contains multiple image but I am getting this Exception
- Code: Select all
java.lang.ClassCastException: org.docx4j.openpackaging.parts.WordprocessingML.BinaryPart cannot be cast to org.docx4j.openpackaging.parts.WordprocessingML.ObfuscatedFontPart
at org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart.getObfuscatedFontFromRelationship(FontTablePart.java:142)
at org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart.processEmbeddings(FontTablePart.java:118)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.setFontMapper(WordprocessingMLPackage.java:360)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.setFontMapper(WordprocessingMLPackage.java:309)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.getFontMapper(WordprocessingMLPackage.java:376)
at org.docx4j.convert.out.common.preprocess.PartialDeepCopy.process(PartialDeepCopy.java:95)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:77)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:135)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:51)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:32)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:64)
at org.docx4j.Docx4J.toFO(Docx4J.java:568)
at org.docx4j.Docx4J.toPDF(Docx4J.java:583)
at org.docx4j.convert.out.pdf.viaXSLFO.Conversion.output(Conversion.java:70)
at com.yeokhengmeng.docstopdfconverter.DocxToPDFConverter.convert(DocxToPDFConverter.java:61)
at com.yeokhengmeng.docstopdfconverter.MainClass.main(MainClass.java:44)
org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:109)
at org.docx4j.Docx4J.toFO(Docx4J.java:568)
at org.docx4j.Docx4J.toPDF(Docx4J.java:583)
at org.docx4j.convert.out.pdf.viaXSLFO.Conversion.output(Conversion.java:70)
at com.yeokhengmeng.docstopdfconverter.DocxToPDFConverter.convert(DocxToPDFConverter.java:61)
at com.yeokhengmeng.docstopdfconverter.MainClass.main(MainClass.java:44)
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Error setting font mapper on copy
at org.docx4j.convert.out.common.preprocess.PartialDeepCopy.process(PartialDeepCopy.java:99)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:77)
at org.docx4j.convert.out.common.Preprocess.process(Preprocess.java:135)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:51)
at org.docx4j.convert.out.common.AbstractWmlExporter.preprocess(AbstractWmlExporter.java:32)
at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:64)
... 5 more
Caused by: java.lang.ClassCastException: org.docx4j.openpackaging.parts.WordprocessingML.BinaryPart cannot be cast to org.docx4j.openpackaging.parts.WordprocessingML.ObfuscatedFontPart
at org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart.getObfuscatedFontFromRelationship(FontTablePart.java:142)
at org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart.processEmbeddings(FontTablePart.java:118)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.setFontMapper(WordprocessingMLPackage.java:360)
at org.docx4j.convert.out.common.preprocess.PartialDeepCopy.process(PartialDeepCopy.java:94)
... 10 more