Skip to content

Commit

Permalink
Add suggestion from pubpub-zz
Browse files Browse the repository at this point in the history
  • Loading branch information
rdl committed Oct 26, 2023
1 parent 9abcfc2 commit 82cdca0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pypdf/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,8 @@ def _update_text_field(self, field: DictionaryObject) -> None:
else: # /Tx
txt = field.get("/V", "")
sel = []
# Escape parentheses (Ref. 7.3.4.2 Literal Strings)
txt = txt.replace('(', r'\(').replace(')', r'\)')
# Escape parentheses (pdf 1.7 reference, table 3.2 Literal Strings)
txt = txt.replace("\\", "\\\\").replace("(", r"\(").replace(")", r"\)")
# Generate appearance stream
ap_stream = f"q\n/Tx BMC \nq\n1 1 {rct.width - 1} {rct.height - 1} re\nW\nBT\n{da}\n".encode()
for line_number, line in enumerate(txt.replace("\n", "\r").split("\r")):
Expand Down

0 comments on commit 82cdca0

Please sign in to comment.