Change Viewer Preferences
Contents
[
Hide
]
Change the viewer preference
- Bind the source PDF to the
PdfContentEditorfacade. - Read the current viewer preference value.
- Combine it with the desired additional flag and pass the result to
changeViewerPreference(...). - Save the updated PDF document.
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();
}
}