Questions tagged [pyfpdf]

PyFPDF is a library for PDF document generation under Python, ported from PHP (see FPDF: "Free"-PDF, a well-known PDFlib-extension replacement.

90 questions
5
votes
2 answers

How to get MultiCells in Pyfpdf Side by side?

I am making a table of about 10 cells with headings in them. They will not fit accross the page unless I use multi_cell option. However I cant figure out How to get a multi_cell side by side. When I make a new one it autmatically goes to the next…
WAMPS
  • 329
  • 1
  • 6
  • 20
4
votes
3 answers

fpdf "UnicodeEncodeError: 'latin-1' codec can't encode character '\u2013' in position 88: ordinal not in range(256)"

I am trying to convert text file into pdf in Python but I am getting error. Why is it happening and how can I fix it? Here my code: import fpdf from fpdf import FPDF pdf = FPDF() pdf.add_page() pdf.set_font("Arial", size=15) f =…
Mr X
  • 51
  • 1
  • 5
4
votes
0 answers

The letters of Unicode Bangla Avro Phonetic gets interchanged after writing in a cell in pyfpdf using python. What is the solution?

I have tried to write Bangla font to create a pdf file using pyfpdf in python. I have written the bangla word using Unicode Avro Bangla Phonetic Font. But when I use pdf.cell command to write the bangla word in the pdf file, the letters in the word…
Ishtiaque
  • 41
  • 3
4
votes
1 answer

FPDF __init__ combined with header and footer in Python

This will be my first post on Stackoverflow. I have a question concerning the FPDF package for python. Creating a class where the header and footer are defined, works fine. However when i try to initialize some variable via init, the header and…
brendanwd
  • 99
  • 1
  • 7
3
votes
2 answers

python fpdf add an image in cell

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…
jxw
  • 586
  • 2
  • 6
  • 36
3
votes
0 answers

python os.path.join(os.getcwd(), 'folder', 'file') returns different paths in same file

I am trying to add a specific font to my fpdf configuration using .add_font(). I used to have all my scripts in a folder called "david" since I rewrote the Code I am working on. Now I migrated it into the parent directory. Here is the unexpected…
David Haase
  • 179
  • 1
  • 8
3
votes
1 answer

PyFPDF, HTMLMixin, Python Unable to print HTML

I am unable to output an HTML message using PyFPDF. When I attempt to write the HTML to the PDF document I get an error: Traceback (most recent call last): File "/Users/elcid/Projects/so_test/test.py", line 8, in
Elcid_91
  • 1,571
  • 4
  • 24
  • 50
3
votes
3 answers

How to make inline bold text using PyFPDF?

from fpdf import FPDF pdf1 = FPDF pdf1.multi_cell(0, 5, 'This is my disclaimer. THESE WORDS NEED TO BE BOLD. These words do not need to be bold.', 0, 0, 'L') pdf1.output("sample.pdf")
vivek
  • 33
  • 6
2
votes
1 answer

Writing and formatting the content of a text file to a PDF file

I want to create PDF file and write text that I read from file. The text in the file looks like: Hello World. This is test text. ASDFASDFAAAAAAAAAAAAAAAAAAAAAAA Hello World. This is test text. ASDFASDFAAAAAAAAAAAAAAAAAAAAAAA Hello World. This is…
Branch
  • 88
  • 7
2
votes
1 answer

python pyfpdf Undefined font: dejavusanscondensedB - Use built-in fonts or FPDF.add_font() beforehand

I'm trying to use the python package fpdf2 to generate a pdf using my python app. But it gives me the error python pyfpdf Undefined font: dejavusanscondensedB - Use built-in fonts or FPDF.add_font() beforehand when I try to use a custom font. here…
Ahmed Wagdi
  • 3,913
  • 10
  • 50
  • 116
2
votes
0 answers

How to get the html output of a python dash html component

I want to convert my Plotly Dash web app to a pdf that is downloadable when a user clicks a button. I'm searching for a .toString() type of function that will act on something like html.Div() to give me the string
...
. This is so I can…
2
votes
5 answers

Problems creating PDF with tables and multicells in FPDF Python

I am trying to create a table with the FPDF library that is capable of expanding the height of the cells when the text is very large. I am going to show the code that I have, which is the same that appears on the official documentation page: from…
Carmen B.
  • 349
  • 7
  • 22
2
votes
1 answer

Adding emoji's to a PDF using PyFPDF

I am writing a program that is supposed to turn a paragraph into a PDF. A lot of said paragraphs have emoji's in them and I cannot figure out how I am supposed to make them show up on the PDF. Whenever there is an emoji in a paragraph I get the…
Stanislas
  • 21
  • 2
1
vote
1 answer

The content of the PDF file does not change after an update request

I am making a calendar app using Tkinter in Python3 and I have a problem with the .txt to .pdf conversion. My code saves user tasks to a .txt file and then can convert this .txt file to a pdf with the press of a button. If the user creates a pdf…
1
vote
0 answers

Output a pdf as PDF/X-1a:2003 using python

I am building then saving a PDF file using the python fpdf2 library like this: cli: >pip install fpdf2 then in python: from fpdf import FPDF pdf = FPDF(unit = 'pt') # pdf.output(, "F") However, I need the output to be…
Maile Cupo
  • 636
  • 1
  • 10
  • 26
1
2 3 4 5 6