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

BUG: The font list order of pypdf.annotations.FreeText is different(#1435) #2893

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Split the test
  • Loading branch information
ssjkamei committed Oct 7, 2024
commit 423876d757598f29ec92c21418b93cdb027e9902
38 changes: 20 additions & 18 deletions tests/test_annotations.py
Original file line number Diff line number Diff line change
@@ -93,24 +93,6 @@ def test_text_annotation(pdf_file_path):


def test_free_text_annotation(pdf_file_path):
free_text_annotation = FreeText(
text="Hello World",
rect=(0, 0, 0, 0),
)
assert free_text_annotation["/DS"] == "font: normal normal 14pt Helvetica;text-align:left;color:#000000"
free_text_annotation = FreeText(
text="Hello World",
rect=(50, 550, 200, 650),
font="Arial",
bold=True,
italic=True,
font_size="20pt",
font_color="00ff00",
border_color=None,
background_color=None,
)
assert free_text_annotation["/DS"] == "font: italic bold 20pt Arial;text-align:left;color:#00ff00"

# Arrange
pdf_path = RESOURCE_ROOT / "crazyones.pdf"
reader = PdfReader(pdf_path)
@@ -150,6 +132,26 @@ def test_free_text_annotation(pdf_file_path):
writer.write(fp)


def test_free_text_annotation__font_specifier():
free_text_annotation = FreeText(
text="Hello World",
rect=(0, 0, 0, 0),
)
assert free_text_annotation["/DS"] == "font: normal normal 14pt Helvetica;text-align:left;color:#000000"
free_text_annotation = FreeText(
text="Hello World",
rect=(50, 550, 200, 650),
font="Arial",
bold=True,
italic=True,
font_size="20pt",
font_color="00ff00",
border_color=None,
background_color=None,
)
assert free_text_annotation["/DS"] == "font: italic bold 20pt Arial;text-align:left;color:#00ff00"


def test_annotationdictionary():
a = AnnotationDictionary()
a.flags = 123
Loading