-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Font family, size, and 'style' params not working/changing in AnnotationBuilder's free_text method #1435
Comments
I was having this same issue and came across your post, you may moved on by now but I figured I would post my partial solution. I was able to get font family and font size working by editing the annotation builder definition file, particularly the bg_color_str code. Here is the modified code (starts on line 92), I added the font name and font size to the bg_color_str after comparing an annotation I read in vs what annotation builder was creating. I wasn't able to get bold and italic working though.
|
Have to tried to do some reverse engineering creating an annotation with Acrobat Reader (or else),save it and then check how the fields are encoded with PdfReader ? |
I am having the same issue. Furthermore, I think this should be labelled as a bug. To reproduce:
Changing font_size parameter changes nothing on the written pdf file. |
I'm just trying to add free text to a blank page using the AnnotationBuilder class. Some of the parameters seem to work just fine (text, rect, colors) but it looks like there is an issue with changing the font. No matter what I change it to, the font family and size, and style (bold/underline params) don't change at all.
Environment
Which environment were you using when you encountered the problem?
$ python -m platform macOS-12.6-x86_64-i386-64bit $ python -c "import PyPDF2;print(PyPDF2.__version__)" 2.11.1
Code + PDF
This is a minimal, complete example that shows the issue:
Here is an image of the resulting PDF:
The text was updated successfully, but these errors were encountered: