I need to convert a docx file into a pdf and the conversion process should also support chinese characters present in the docx file. The below code works fine when the docx file doesn't have any tables or images in them. When it contains tables, it errors out and when it has some images, the image is not displayed in the resulting pdf. Can any one help me out with the code to support tables and images? The code is as follows
public class ConvertDocxBigToPDF {
public static void main( String[] args )
{
long startTime = System.currentTimeMillis();
try
{
File file = new File("Input File Path");
FileInputStream fis = new FileInputStream(file.getAbsolutePath());
XWPFDocument document = new XWPFDocument( fis );
File outFile = new File( "Output File Path" );
outFile.getParentFile().mkdirs();
OutputStream out = new FileOutputStream( outFile );
PdfOptions options = PdfOptions.create().fontEncoding( "Identity-H" );
PdfConverter.getInstance().convert( document, out, options );
} catch ( Throwable e ) {
e.printStackTrace();
}
System.out.println("Generate DocxBig.pdf with "+(System.currentTimeMillis()-startTime )+" ms." );
}
}