PyFPDF is a library for PDF document generation under Python, ported from PHP (see FPDF: "Free"-PDF, a well-known PDFlib-extension replacement.
Questions tagged [pyfpdf]
90 questions
0
votes
1 answer
How to encode and decode Arabic text in python
I want to encode an Arabic string. I actually tried to pass the string as is, but it did not work. I tried to encode it and it also didn't work. Here is the code and the output: جاÙ\x85عة…

Awos Al-Radaideh
- 3
- 4
0
votes
2 answers
Convert all Text Documents from a folder to PDF
I have few text documents in a folder and would like to convert them to PDF Format. I am able to do it individually with the below code. Is there any way to select all the text files from a folder, convert and save them with the original name (as it…

Sai Teja
- 1
- 2
0
votes
0 answers
how to fix the error 'latin-1' codec can't encode character '\u011f' in position 176" in python when creating a pdf
I'm having the following error:
UnicodeEncodeError: 'latin-1' codec can't encode character '\u011f' in
position 176: ordinal not in range(256)
for the following part:
text = "ğağağağağali"
text = textwrap.indent(text=text, prefix=' ')
d =…
user10245663
0
votes
1 answer
Django : Downloading PDF object generated by the library FPDF
I have a view that contains a wizard form. When the form is submitted, a httpresponse is sent with a PDF file. I generate the PDF file with the FPDF2 Library from the data got in the form submitted by the user.
To be sure that the PDF class using…

Goncalves
- 159
- 9
0
votes
1 answer
Unit Testing Functions without Return Value in Python
My final project in CS50 is a salary slip generator in pdf format. I got these functions with me but I don't know to test them.
create_pdf() - function that opens my data file (.xlsx), iterates over its data, puts them into variables which will…

SoulSeeker916
- 37
- 9
0
votes
1 answer
Python: How to append a FPDF2 table to an existing pdf page?
I have an FPDF2 table created using this script. I used to output it to a blank page and merge it to an existing pdf, which works fine.
But now we need to add the table to an existing page in the pdf and then if it doesn't fit, we insert new pages.…

Lynob
- 5,059
- 15
- 64
- 114
0
votes
1 answer
AttributeError: 'table__n_a_m_e' object has no attribute 'getBestFullName' error on fpdf2
I am tring to run the example code from fpdf2 pyfpdf.github.io/fpdf2/Unicode.html. It gives me the error
Traceback (most recent call last):
File "fpdf2.py", line 12, in
pdf.add_font('DejaVu', fname='DejaVuSansCondensed.ttf')
File "C:\Program…

Manusha
- 346
- 2
- 5
- 21
0
votes
1 answer
How to generate table of contents using pyfpdf?
I hope you'r doing fine.
I want to generate a PDF using pyfpdf.
I need to generate a table of contents on the first page.
As you know, new pages are created at the end of the PDF. So, my table of content is generated at the end of the PDF.
I can't…

Rayon Magique
- 130
- 2
- 15
0
votes
2 answers
PyFPDF: Align cell and multi_cell in the same row
I want to align cell and multi-cell in the same row.
i = 0
for col in row:
if i == 0:
self.multi_cell(col_widths[i], 6, col, 1, new_x=XPos.LMARGIN, new_y=YPos.NEXT, align=alignments[i], fill=True)
else:
…

Pypax
- 83
- 10
0
votes
1 answer
UnicodeEncodeError: 'latin-1' codec can't encode character '\u03bc'
I am creating a pdf using python library PyFPDF and one of my data string contains a "Greek small letter μ" known as mu. I am getting the above mentioned error. If we remove this greek letter from the data string, the code works perfect. I need help…

Alpha Geek
- 21
- 4
0
votes
1 answer
Color not appearing when writing from HTML using Fpdf
So I'm creating a streamlit web app where people provide a paragraph and I split it up into sentences and allow them to download it as a PDF after applying color-blind friendly color coding. To do this, I create HTML and add the color coding as a…

Nakul Upadhya
- 494
- 4
- 16
0
votes
0 answers
How to fix PyFPDF encoding errors for different fonts?
I have a font package that exists in the same folder as my code, and the following line is causing an error:
pdf.add_font('Garamond', '', 'Garamond Regular.ttf',)
It returns the following error:
UnicodeDecodeError: 'utf-8' codec can't decode byte…

AScientist1096
- 51
- 4
0
votes
1 answer
FPDF Python Package to Write PDF Files - Inserting extra line breaks. Does this for Multi_cell and cell. Want to remove extra line breaks
I have a python application that traverses directories on the file path passed in as a parameter. As each file is found, the file is opened and data is inserted into multi_cells.
I have checked the TXT values provided to multi_cell and there are no…

NBessmer
- 87
- 2
- 9
0
votes
1 answer
New Page error using Multicell of the library Python PyFPDF
I am creating a program that generates a translation sheet for a language. It uses the python FPDF module. I utilise pdf.multicell() to create a page with two columns for the English word, and then the foreign equivalent
I am using…

Max Davies
- 148
- 10
0
votes
0 answers
Automate production of PDFs containing tables in Jupyter Notebook
I'd like some inspiration for procedures or modules that could make my life easier..
My issue is that I have numerous separate Jupyter Notebooks, that performs different heavy computations. At the moment, I spend a lot of time copy pasting the…

tigram10
- 19
- 2