by sp2801 » Fri Sep 05, 2014 8:30 pm
Thanks for your reply Jason. I will test this and let you know. I have attached the word document for the reference. I was using earlier version. Below is the code which I am using
Ones in Red are showing as Deprecated. Seems this can be the issue.
public void generatePDF(WordprocessingMLPackage wordMLPackage, String fileName,String objectName,String baseLocation) throws Exception
{
inputfilepath = baseLocation + "Report/"+objectName+"/"+fileName;
wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath+".docx"));
org.docx4j.convert.out.pdf.PdfConversion c = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);
((org.docx4j.convert.out.pdf.viaXSLFO.Conversion)c).setSaveFO(new java.io.File(inputfilepath+".fo"));
((org.docx4j.convert.out.pdf.viaXSLFO.Conversion)c).setSaveFO(new java.io.File(inputfilepath + ".fo"));
OutputStream os = new java.io.FileOutputStream(inputfilepath.substring(0,inputfilepath.length()-2) + ".pdf");
c.output(os, new PdfSettings());
System.out.println("Saved " + inputfilepath + ".pdf");
}
Shashank
- Attachments
-
- Summary.docx
- Here is the File Jason
- (14.9 KiB) Downloaded 633 times