i meet another issue,when i run code of docx convert to pdf some times,the error java.lang.OutOfMemoryError: PermGen space is thrown,my code is
Using java Syntax Highlighting
public static byte[] parseHistoryToPDF(InputStream in) throws Exception
{
Logger log = Logger.getLogger("org/docx4j/convert/out/pdf/viaXSLFO/");
LoggerRepository repository = log.getLoggerRepository();
repository.setThreshold(Level.OFF);
try
{
WordprocessingMLPackage wordMLPackage;
Mapper fontMapper = new IdentityPlusMapper();
LoadFromZipNG z= new LoadFromZipNG();
wordMLPackage =(WordprocessingMLPackage)z.get(in);
PhysicalFont font = PhysicalFonts.getPhysicalFonts().get("FangSong");
fontMapper.getFontMappings().put("仿宋", font);
wordMLPackage.setFontMapper(fontMapper);
org.docx4j.convert.out.pdf.PdfConversion c = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);
ByteArrayOutputStream fos=new ByteArrayOutputStream();
c.output(fos);
fos.flush();
byte[] reval=fos.toByteArray();
fos.close();
return reval;
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
{
Logger log = Logger.getLogger("org/docx4j/convert/out/pdf/viaXSLFO/");
LoggerRepository repository = log.getLoggerRepository();
repository.setThreshold(Level.OFF);
try
{
WordprocessingMLPackage wordMLPackage;
Mapper fontMapper = new IdentityPlusMapper();
LoadFromZipNG z= new LoadFromZipNG();
wordMLPackage =(WordprocessingMLPackage)z.get(in);
PhysicalFont font = PhysicalFonts.getPhysicalFonts().get("FangSong");
fontMapper.getFontMappings().put("仿宋", font);
wordMLPackage.setFontMapper(fontMapper);
org.docx4j.convert.out.pdf.PdfConversion c = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);
ByteArrayOutputStream fos=new ByteArrayOutputStream();
c.output(fos);
fos.flush();
byte[] reval=fos.toByteArray();
fos.close();
return reval;
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
Parsed in 0.017 seconds, using GeSHi 1.0.8.4
i adjust VM Arguments -Xms 512m -Xmx800m but modification doesn't work, how can i deal with it?