ビューア設定の変更

ビューア設定の変更

  1. ソース PDF を PdfContentEditor ファサードにバインドしてください。
  2. 現在のビューア設定値を読み取ってください。
  3. 希望する追加フラグと組み合わせ、その結果を changeViewerPreference(...) に渡してください。
  4. 更新された PDF ドキュメントを保存してください。
public static void changeViewerPreferences(Path inputFile, Path outputFile) {
    PdfContentEditor editor = new PdfContentEditor();
    try {
        editor.bindPdf(inputFile.toString());
        editor.changeViewerPreference(editor.getViewerPreference() | 1);
        editor.save(outputFile.toString());
    } finally {
        editor.close();
    }
}