BuildVuは一度に複数のファイルを変換できますか?
はい。BuildVuは同時に複数の変換を実行することができます。変換メソッドは一度に1つのファイルを処理するため、メソッドを並行して呼び出す必要があります。これを実現するにはいくつかのアプローチがあります。
- コマンドラインからの変換 を同時に複数起動する。
- それぞれの変換をスレッドで起動することで、複数の変換を同時に実行できます。
これはスレッドプールと変換を送信するメソッドを使用して実現できます。
final ExecutorService pool = Executors.newFixedThreadPool(10);
public void convertFile(final File pdfFile, final File outputDirectory, final HTMLConversionOptions htmlConversionOptions, final OutputModeOptions outputModeOptions, final String password) {
pool.submit(() -> {
final PDFtoHTML5Converter converter = new PDFtoHTML5Converter(pdfFile, outputDirectory, htmlConversionOptions, outputModeOptions);
if (password != null) { //optional password
converter.setPassword(password);
}
try {
converter.convert();
} catch (final PdfException e) {
System.out.println(e.getMessage());
}
});
}
- BuildVu Microserviceを使用して、BuildVuをアプリケーションサーバー またはクラウドプラットフォーム にデプロイし、クライアント 経由で並行変換を送信する。
