diff --git a/pdf/src/build.rs b/pdf/src/build.rs index 7b58a2e..8df46d3 100644 --- a/pdf/src/build.rs +++ b/pdf/src/build.rs @@ -179,6 +179,7 @@ impl CatalogBuilder { Ok(Catalog { version: Some("1.7".into()), pages: tree, + viewer_preferences: None, names: None, dests: None, metadata: None, diff --git a/pdf/src/object/types.rs b/pdf/src/object/types.rs index 2ff4587..e2fec5f 100644 --- a/pdf/src/object/types.rs +++ b/pdf/src/object/types.rs @@ -74,9 +74,12 @@ pub struct Catalog { #[pdf(key = "Dests")] pub dests: Option>, - // ViewerPreferences: dict + #[pdf(key = "ViewerPreferences")] + pub viewer_preferences: Option, + #[pdf(key = "PageLayout")] pub page_layout: Option, + // PageMode: name #[pdf(key = "Outlines")] pub outlines: Option, @@ -110,6 +113,59 @@ pub struct Catalog { // NeedsRendering: bool } +#[derive(Object, ObjectWrite, Debug, Clone, DataSize)] +pub struct ViewerPreferences { + #[pdf(key = "HideToolbar")] + pub hide_toolbar: Option, + + #[pdf(key = "HideMenubar")] + pub hide_menubar: Option, + + #[pdf(key = "HideWindowUI")] + pub hide_window_ui: Option, + + #[pdf(key = "FitWindow")] + pub fit_window: Option, + + #[pdf(key = "CenterWindow")] + pub center_window: Option, + + #[pdf(key = "DisplayDocTitle")] + pub display_doc_title: Option, + + #[pdf(key = "NonFullScreenPageMode")] + pub non_full_screen_page_mode: Option, + + #[pdf(key = "Direction")] + pub direction: Option, + + #[pdf(key = "ViewArea")] + pub view_area: Option, + + #[pdf(key = "ViewClip")] + pub view_clip: Option, + + #[pdf(key = "PrintArea")] + pub print_area: Option, + + #[pdf(key = "PrintClip")] + pub print_clip: Option, + + #[pdf(key = "PrintScaling")] + pub print_scaling: Option, + + #[pdf(key = "Duplex")] + pub duplex: Option, + + #[pdf(key = "PickTrayByPDFSize")] + pub pick_tray_by_pdf_size: Option, + + #[pdf(key = "PrintPageRange")] + pub print_page_range: Vec, + + #[pdf(key = "NumCopies")] + pub num_copies: Option, +} #[derive(Object, ObjectWrite, Debug, DataSize, Default, DeepClone, Clone)] pub struct Resources {