Skip to content

Commit

Permalink
implement enumerable OutlineItemFlag
Browse files Browse the repository at this point in the history
  • Loading branch information
mtd91429 committed Jul 8, 2022
1 parent 802b938 commit dba85c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions PyPDF2/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import warnings
from io import BytesIO
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
from enum import IntFlag

from ._codecs import ( # noqa: rev_encoding
_pdfdoc_encoding,
Expand Down Expand Up @@ -1702,6 +1703,9 @@ def additionalActions(self) -> Optional[DictionaryObject]: # pragma: no cover
deprecate_with_replacement("additionalActions", "additional_actions")
return self.additional_actions

class OutlineItemFlag(IntFlag):
italic = 1
bold = 2

class Destination(TreeObject):
"""
Expand Down Expand Up @@ -1856,9 +1860,9 @@ def color(self) -> Optional[tuple]:
return self.get("/C", None)

@property
def fmt(self) -> Optional[int]:
def fmt(self) -> Optional[OutlineItemFlag]:
"""Read-only property accessing the font type. 1=italic, 2=bold, 3=both"""
return self.get("/F", None)
return self.get("/F", 0)


class Bookmark(Destination):
Expand Down

0 comments on commit dba85c4

Please sign in to comment.