Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: add capability to set font and size in fields #2636

Merged
merged 15 commits into from
May 20, 2024
4 changes: 1 addition & 3 deletions pypdf/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
from .constants import CatalogAttributes as CA
from .constants import (
CatalogDictionary,
FieldFlag,
FileSpecificationDictionaryEntries,
GoToActionArguments,
ImageType,
Expand Down Expand Up @@ -123,7 +122,6 @@
)
from .xmp import XmpInformation

OPTIONAL_READ_WRITE_FIELD = FieldFlag(0)
pubpub-zz marked this conversation as resolved.
Show resolved Hide resolved
ALL_DOCUMENT_PERMISSIONS = UserAccessPermissions.all()
DEFAULT_FONT_HEIGHT_IN_MULTILINE = 12

Expand Down Expand Up @@ -945,7 +943,7 @@ def update_page_form_field_values(
self,
page: Union[PageObject, List[PageObject], None],
fields: Dict[str, Any],
flags: FieldFlag = OPTIONAL_READ_WRITE_FIELD,
flags: FA.FfBits = FA.FfBits.Nul,
auto_regenerate: Optional[bool] = True,
) -> None:
"""
Expand Down
3 changes: 2 additions & 1 deletion pypdf/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ class FieldDictionaryAttributes:
AA = "/AA" # dictionary, optional
Opt = "/Opt"

class FfBits:
class FfBits(IntFlag):
"""
Ease building /Ff flags
Some entries may be specific to:
Expand All @@ -464,6 +464,7 @@ class FfBits:
* List(Ch) (Table 8.79 PDF 1.7 reference)
"""

Nul = 0
ReadOnly = 1 << 0
"""common to Tx/Btn/Ch in Table 8.70"""
Required = 1 << 1
Expand Down