0
Я конвертирую файл DOCX в файл HTML с помощью XHTML-конвертера в java. то есть мы загружаем HTML-файл на временный путь, а затем загружаем этот HTML-файл в браузер. Но перед преобразованием это дает ошибку:Ошибка памяти - превышен верхний предел GC
Error 404 not found
(в браузере) и
java.lang.OutOfMemoryError: GC overhead limit exceeded
(в консоли).
Я получаю сообщение об ошибке «XWPFDocument document = new XWPFDocument (in);» в следующем коде.
String root = finalDestinationPath;
int lastIndex = sDocPath.lastIndexOf(File.separator);
String sFileName = sDocPath.substring(lastIndex + 1, sDocPath.length());
String fileNameWithOutExt = FilenameUtils.removeExtension(sFileName);
String fileOutName = root + File.separator + fileNameWithOutExt + ".html";
InputStream in = new FileInputStream(new File(sDocPath));
XWPFDocument document = new XWPFDocument(in);
XHTMLOptions options = XHTMLOptions.create();// .indent(4);
String sLocalSystemImagePath = finalDestinationPath + File.separator+"images"+File.separator;
File imageFolder = new File(sLocalSystemImagePath);
options.setExtractor(new FileImageExtractor(imageFolder));
// URI resolver
String localHostImagePath = downloadImagePath + File.separator+"images"+File.separator;
FileResolver fileURIResolver = new FileResolver(new File(localHostImagePath));
options.URIResolver(fileURIResolver);
out = new FileOutputStream(new File(fileOutName));
XHTMLConverter.getInstance().convert(document, out, options);