亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

提供者 com.levigo.jbig2.util.log.JDKLoggerBridge

提供者 com.levigo.jbig2.util.log.JDKLoggerBridge

慕蓋茨4494581 2021-12-10 10:27:41
使用以下代碼將 PDF 文件寫入 HTML 文件格式時...import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.io.IOException;import java.io.PrintWriter;import java.io.Writer;import javax.xml.parsers.ParserConfigurationException;import org.apache.pdfbox.pdmodel.PDDocument;import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException;import org.fit.pdfdom.PDFDomTree;import org.fit.pdfdom.PDFDomTreeConfig;import org.fit.pdfdom.resource.HtmlResourceHandler;import org.fit.pdfdom.resource.SaveResourceToDirHandler;public class PdfToHtmlConverter {    public String pdfToHtmlFileWriter(File file, String outputFilePath, String outputFileName) throws InvalidPasswordException, IOException, ParserConfigurationException {        // load the PDF file using PDFBox        PDDocument pdf = PDDocument.load(file);        PDFDomTreeConfig config = PDFDomTreeConfig.createDefaultConfig();        HtmlResourceHandler fontHandler = new SaveResourceToDirHandler();        config.setFontHandler(fontHandler);        HtmlResourceHandler imageHandler = new SaveResourceToDirHandler();        config.setImageHandler(imageHandler);        // create the DOM parser        PDFDomTree parser = new PDFDomTree();        // parse the file and get the DOM Document        String outputFile = outputFilePath + File.separator + outputFileName + ".html";        try (Writer woutput = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)))) {            parser.writeText(pdf, woutput);        } catch(Exception e) {            e.printStackTrace();        }        pdf.close();        return outputFile;    }}并且build.gradle文件具有以下依賴項列表...
查看完整描述

1 回答

?
胡子哥哥

TA貢獻1825條經驗 獲得超6個贊

請將 jbig2 解碼器更新到最新版本,即 3.0.2。由于levigo Solutions GmbH,jbig2 解碼器現在是 Apache PDFBox 的一部分。對于 maven,使用這個:


    <dependency>

        <groupId>org.apache.pdfbox</groupId>

        <artifactId>jbig2-imageio</artifactId>

        <version>3.0.2</version>

    </dependency>

或者使用直接下載。


查看完整回答
反對 回復 2021-12-10
  • 1 回答
  • 0 關注
  • 343 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號