reingart / pyfpdf

Simple PDF generation for Python (FPDF PHP port)
https://code.google.com/p/pyfpdf/
GNU Lesser General Public License v3.0
858 stars 528 forks source link

How to insert an image inside a cell? #195

Open JianDk opened 2 years ago

JianDk commented 2 years ago

I am generating a PDF file using FPDF in Python. Below is a code snippet, where I am creating a table using cell. The table consists of 3 columns. In the last cell of each row, I need to insert an image with a QR code. I don't know how to insert an image inside a cell.

```

Create table header

height = 5
pdf.cell(w = 50, h = height, txt = 'Product', align = 'L', border = 'B', ln = 0)
pdf.cell(w = 120, h = height, txt = 'Instructioon', align = 'L', border = 'B', ln = 0)
pdf.cell(w = 20, h = height, txt = 'Video', align = 'L', border = 'B', ln = 1)
#Create the content in the first table row
pdf.cell(w = 50, h = height, txt = 'Product 1', align = 'L', ln = 0)
pdf.cell(w = 120, h = height, txt = 'some product descriptions', align = 'L', ln = 0)
#This is the cell I need to insert an image with a QR code, but I don't know how to insert the image inside a cell
pdf.cell(....)
Lucas-C commented 2 years ago

pyfpdf is not maintained anymore, have you tried using fpdf2? https://pyfpdf.github.io/fpdf2/

We do not support this use case for the moment, but feel free to open a feature request at https://github.com/PyFPDF/fpdf2/issues