Skip to content

Commit

Permalink
Proposed change to py-pdf#2144
Browse files Browse the repository at this point in the history
  • Loading branch information
marcstober committed Sep 7, 2023
1 parent 05f2a65 commit 11ddc7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class PdfReader:

@property
def viewer_preferences(self) -> Optional[ViewerPreferences]:
"""Returns the existing ViewerPreferences as a overloaded dictionniary."""
"""Returns the existing ViewerPreferences as an overloaded dictionary."""
o = cast(DictionaryObject, self.trailer["/Root"]).get(
CD.VIEWER_PREFERENCES, None
)
Expand Down
6 changes: 3 additions & 3 deletions pypdf/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ def set_need_appearances_writer(self, state: bool = True) -> None:

@property
def viewer_preferences(self) -> Optional[ViewerPreferences]:
"""Returns the existing ViewerPreferences as a overloaded dictionniary."""
"""Returns the existing ViewerPreferences as an overloaded dictionary."""
o = cast(DictionaryObject, self._root_object).get(CD.VIEWER_PREFERENCES, None)
if o is None:
return None
o = self._create_viewer_preferences()
o = o.get_object()
if not isinstance(o, ViewerPreferences):
o = ViewerPreferences(o)
Expand All @@ -384,7 +384,7 @@ def viewer_preferences(self) -> Optional[ViewerPreferences]:
self._root_object[NameObject(CD.VIEWER_PREFERENCES)] = o
return o

def create_viewer_preference(self) -> ViewerPreferences:
def _create_viewer_preferences(self) -> ViewerPreferences:
o = ViewerPreferences()
self._root_object[NameObject(CD.VIEWER_PREFERENCES)] = self._add_object(o)
return o
Expand Down

0 comments on commit 11ddc7b

Please sign in to comment.