PDFBox API の使用に問題があります。JBIG2 画像を含む PDF ファイルがあり、それを読み込んで、PDF コンテンツを含む JPEG または PNG ファイルを作成したいと考えています。残念ながら、私は黒い画像しか得ていません。
私のコードは次のとおりです。
public static void copyDocumentAsImage(String path) throws IOException {
PDDocument document = PDDocument.load(new File(path));
String destinationDir = "myDestinationPath";
BufferedImage img = new BufferedImage(2000, 2000, BufferedImage.TYPE_BYTE_GRAY);
PDXObjectImage ximage = new PDJpeg(document, img);
ximage.write2file(destinationDir);
}
私はすでにこれをチェックしました:https://issues.apache.org/jira/i#browse/PDFBOX-1067
しかし、うまくいかなかったか、正しい解決策が得られませんでした。
誰かがそれを手伝ってくれますか?
前もって感謝します。