docxからpdf形式への変換を行っています。私は正常に変数置換を行い、WordprocessingMLPackageテンプレートを持っています。FOEventHandlerもレンダラーもこの出力書式では見つかりません
私は両方のアトラクションを試しました。 pdfと新しい方法に変換する古いdeprcatedバージョン。両方ともこの例外エラーが発生しません
Don't know how to handle "application/pdf" as an output format. Neither an FOEventHandler, nor a Renderer could be found for this output format. Error: UnsupportedOpertaionException
私はできる限り試しました。これは私のローカルマシンで動作しますが、現在私の職場で動作します。私は必要なすべての瓶があると思う。どのような行動をとるべきか教えてください。
コード: 方法1:
Docx4J.toPDF(template, new FileOutputStream("newPdf.pdf"));
方法2:
public static void createPDF(WordprocessingMLPackage template, String outputPath) {
try {
// 2) Prepare Pdf settings
PdfSettings pdfSettings = new PdfSettings();
// 3) Convert WordprocessingMLPackage to Pdf
OutputStream out = new FileOutputStream(new File(
outputPath));
PdfConversion converter = new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(
template);
converter.output(out, pdfSettings);
} catch (Throwable e) {
e.printStackTrace();
}
}
両方が同じエラーを与えています。どんな助けもありがとう!
これは役に立つかもしれません...私はMeta-INFフォルダがありません。実際に何らかの理由で私は自分のプロジェクトに第三者のdocx4jをインポートすることができませんでした。そのため、ビルド - >プライベート - >クラス - >ライブラリで同じ階層構造にクラスファイルを置くのが面倒でした。それが問題なのでしょうか?はいの場合は、このMETA-INFを入れる場所を教えてください –
クラスパスにはどのようなFOP jarがありますか? – JasonPlutext
私はfop-1.1.jarを持っています –