ファイルを取得してから印刷するプロジェクトに取り組んでいdesktop.print(file);
ますが、このファイルが非常に大きい場合 (たとえば 50 ページ)、ジョブをプリンターに送信したくありません。
ジョブを開始する前に、ファイルの印刷に必要なページ数を取得する方法はありますか?
これが私がこれを行うコードの一部です:
File file = new File(filePath);
try {
desktop.print(file);
} catch (IOException e) {
System.out.println("error in trying to print");
e.printStackTrace();
}