Closed
I want to Convert Attached word document to PDF
Actually, I have a scenario to convert Attached word document to PDF. I'm try to do it using Apache POI,my code is not working .
try
{
PRFile file1 = new PRFile(FileName);
PRInputStream doc = new PRInputStream(file1);
// 1) Load docx with POI XWPFDocument
com.pega.apache.poi.xwpf.usermodel.XWPFDocument document = new com.pega.apache.poi.xwpf.usermodel.XWPFDocument(doc);
PRFile outFile = new PRFile(FileName);
PROutputStream out = new PROutputStream ( outFile );
com.pega.apache.poi.xwpf.converter.pdf.PdfOptions options = com.pega.apache.poi.xwpf.converter.pdf.PdfOptions.create().fontEncoding( "windows-1250" );
com.pega.apache.poi.xwpf.converter.pdf.PdfConverter.getInstance().convert( document, out, options );
}
catch ( Throwable e )
{
e.printStackTrace();
}