forked from reingart/pyfpdf
-
Notifications
You must be signed in to change notification settings - Fork 332
Open
Labels
Description
keep_aspect_ratio flag not recognized when attempting to create an image. Also happens when a rectangle is not involved, but thought that providing code directly from the repository would make this easier to re-create
Error details
TypeError Traceback (most recent call last)
Cell In[88], line 5
3 rect1 = 30, 30, 60, 100
4 pdf.rect(*rect1)
----> 5 pdf.image(
6 "test_image.jpg",
7 *rect1,
8 keep_aspect_ratio=True,
9 )
File c:\Users\...\fpdf\fpdf.py:150, in FPDF.check_page.<locals>.wrapper(self, *args, **kwargs)
148 self.error("No page open, you need to call add_page() first")
149 else:
--> 150 return fn(self, *args, **kwargs)
TypeError: FPDF.image() got an unexpected keyword argument 'keep_aspect_ratio'
Code to reproduce
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
rect1 = 30, 30, 60, 100
pdf.rect(*rect1)
pdf.image(
"test_image.jpg",
*rect1,
keep_aspect_ratio=True,
)
# from https://github.com/py-pdf/fpdf2/blob/master/test/image/test_image_fit.pyEnvironment
Please provide the following information:
- Operating System: Windows
- Python version: Python 3.14.0
fpdf2version used: 2.8.5
Reactions are currently unavailable