N-Up PDF ドキュメントの作成

N-Up PDF ドキュメントの作成

Java のサンプルでは、PdfFileEditor.makeNUp を使用して既存の PDF から 2×2 レイアウトを作成します。

手順

  1. PdfFileEditor インスタンスを作成してください。
  2. makeNUp を呼び出し、入力ファイル、出力ファイル、および列数と行数を指定してください。
  3. 生成されたドキュメントを保存してください。
  4. 明示的な成功チェックが必要な場合は、ブール値を返すバリアントを呼び出し、false 結果を処理してください。

Java の例

public static void createNupPdfDocument(Path inputFile, Path outputFile) {
    PdfFileEditor nupMaker = new PdfFileEditor();
    nupMaker.makeNUp(inputFile.toString(), outputFile.toString(), 2, 2);
}

public static void tryCreateNupPdfDocument(Path inputFile, Path outputFile) {
    PdfFileEditor nupMaker = new PdfFileEditor();
    if (!nupMaker.makeNUp(inputFile.toString(), outputFile.toString(), 2, 2)) {
        System.out.println("Failed to create N-Up PDF document.");
    }
}