Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在JavaFX中隐藏Docx4j消息_Java_Pdf_Javafx_Docx_Docx4j - Fatal编程技术网

在JavaFX中隐藏Docx4j消息

在JavaFX中隐藏Docx4j消息,java,pdf,javafx,docx,docx4j,Java,Pdf,Javafx,Docx,Docx4j,我通过Docx4j在所有转换成PDF的文件上都有这些消息 要隐藏这些消息,请关闭org.docx4j.convert.out.pdf.viaXSLFO的log4j调试级别日志记录 有可能把它藏起来吗?我在堆栈上找到了一些解决方案,但它对我没有帮助,因为我的应用程序很简单。我使用了这段代码并将其放入我的应用程序中 long start = System.currentTimeMillis(); // 1) Load DOCX into WordprocessingMLPackage Fi

我通过Docx4j在所有转换成PDF的文件上都有这些消息

要隐藏这些消息,请关闭org.docx4j.convert.out.pdf.viaXSLFO的log4j调试级别日志记录

有可能把它藏起来吗?我在堆栈上找到了一些解决方案,但它对我没有帮助,因为我的应用程序很简单。我使用了这段代码并将其放入我的应用程序中

long start = System.currentTimeMillis();

    // 1) Load DOCX into WordprocessingMLPackage
File file = new File(sFiles.getAbsolutePath());

InputStream is = new FileInputStream(file);
String name=file.getName();
String destination= file.getAbsolutePath();
String outDestination=file.getParent();
String fileType=FilenameUtils.getExtension(destination);
        String name1=name.replaceAll(fileType, "");

WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage
                .load(is);

System.out.println(name);
// 2) Prepare Pdf settings
PdfSettings pdfSettings = new PdfSettings();

// 3) Convert WordprocessingMLPackage to Pdf

wordName=outDestination+"\\"+name1+"pdf";
FileOutputStream out = new FileOutputStream(wordName);
PdfConversion converter = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(
            wordMLPackage);
converter.output(out, pdfSettings);

System.err.println("Generate pdf/Resume.pdf with "
            + (System.currentTimeMillis() - start) + "ms");

如上所述,关闭org.docx4j.convert.out.pdf.viaXSLFO的log4j调试级别日志记录。换句话说,将日志记录设置为levelinfo或WARN,例如

从这一点来看,您可能也需要为“org.docx4j.convert.out.common.writer.AbstractMessageWriter”这样做,或者改为“org.docx4j.convert.out.common.writer.AbstractMessageWriter”

现在,docx4j使用slf4j。因此,假设您使用log4j作为日志实现。在这种情况下,您可以使用


否则,请使用您选择的日志记录实现配置日志记录。

我的项目中没有xml,我只有我表示的类。我真的不明白我需要做什么:/这个消息对那里意味着什么?为什么它在这里-如果存在无法使用viaXSLFO实现转换为PDF的内容,则消息会警告您。如果消息被关闭,该内容将被静默删除。