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
0
votes
1 answer

python FPDF how to bold inline text

How can i bold a inline string while writing to the document. I tried the especial characters \033 but it seems that them just works on console prints not pdf outputs because them are explicitly printed in the pdf as \033... is there any other way…
TTT2
  • 549
  • 2
  • 13
0
votes
1 answer

Problem writing a mix of English and Arabic text in PDF using Python pyFPDF

I need to create a PDF with a mix of English and Arabic text, I was able to do that using below code, (download NotoSansArabic-Regular.ttf from Google Noto fonts). But the issue is Arabic text appears in left to right, but it should appear from…
akarahman
  • 235
  • 2
  • 15
0
votes
1 answer

pdf.image image print image same image in for loop

I am trying to output different photos into different pdfs but I see that it is still printing the same photo in all pdfs. namelist=[] values are ['ABC1 XYZ1', 'ABC2 XYZ2', 'ABC3 XYZ3', 'ABC4 XYZ4', 'ABC5 XYZ5'] pics named same as in namelist but it…
0
votes
0 answers

Python FPDF print table with header and index, rotate header

I have a dataframe table. I want to save it in a PDF page. The table has lengthy column names, when I print it, table goes outside the margin and data misses. Also, I cannot see the row index printed here: My data: prdf= group FF_ThisWeek…
Mainland
  • 4,110
  • 3
  • 25
  • 56
0
votes
1 answer

Problem importing fonts with FPDF using python

I've been trying to import specialty fonts beyond what is default included with the FPDF package with Python, using the pdf.add_font() command. The code below produces an error of an Undefined font, as though I didn't just use pdf.add_font(). Below…
0
votes
1 answer

python FPDF unicode symbols u"\u2611" or u'\U0001F5F9'

i have a txt file containing a tick-marked list as so Done List ☑ grocery ☑ electronics The list above is created using Python like so: chkbx = u"\u2611" #u'\U0001F5F9' for ... with open('List.txt','a',encoding='utf-8') as f: …
ttuff
  • 45
  • 5
0
votes
1 answer

Python/pyfpdf: TypeError: list indices must be integers or slices, not str

I'm trying to pass a json data and make a pdf file out of it. I have this snippet which works fine: data = [ ['Power:',data["PowerS"],'MVA'], ['Voltage:',data["Voltage"],'V'], ['Impedance:',data["Impedance"],'ohms'], …
0
votes
0 answers

no errors but doesn't create file

I'm using Python 3.4. Any idea why my code isn't creating the files in the created location? The code is: from sys import argv from fpdf import FPDF import json import csv def write_cover_letter(cover_letter, skills): # open csv file and read…
bsayles15
  • 19
  • 4
0
votes
2 answers

Access a local variable via class method in Python

I am new to classes in Python so please help me out. I am generating reports in pdf using fpdf package. I am using sample code from the following to generate PDF page with…
Abhishek Kulkarni
  • 654
  • 1
  • 8
  • 20
0
votes
1 answer

Pyfpdf Turkish Character in Python

I want to create a pdf in my Python application using a text that contains Turkish characters, but I get an error. My codes are below. How can I fix this? # -*- coding: utf-8 -*- from fpdf import FPDF import os def add_image(image_path): pdf =…
0
votes
0 answers

How to remove the most recent line break in from text?

I have a code that parses all the files in a folder and writes text to a pdf file.I want to remove the line break at the end of the text, because in some formats the script mistakenly creates a blank page. How i can do this? import os import re from…
user12297114
-1
votes
2 answers

why ading jpg in fpdf is giving me this error "FPDF error: Unsupported image type"

"I'm working on creating a PDF from Python. As a beginner, a lot of errors are occurring in my code. This is my code: class PDF(FPDF): def __init__(self): super().__init__() self.header_text = "" self.footer_text =…
-1
votes
2 answers

open(..., encoding="") vs str.encode(encoding="")

Question: What is the difference between open(, "w", encoding=) and open(, "wb") + str.encode()? They seem to (sometimes) produce different outputs. Context: While using PyFPDF (version 1.7.2), I subclassed the FPDF…
Xtrem532
  • 756
  • 8
  • 19
-1
votes
1 answer

pyfpdf: FPDF error: Undefined font: calibri B

I added the font calibri.fft,calibrii.fft, and calibrib.fft but error still exist. pdf.add_font('Calibri','','Calibri.ttf',uni=True) pdf.add_font('Calibri I','','Calibrii.ttf',uni=True) pdf.add_font('Calibri B','','Calibrib.ttf',uni=True) Underline…
Klien Menard
  • 103
  • 1
  • 1
  • 10
-2
votes
1 answer

Python try except: InvalidSyntax

I'm trying the Designer GUI TOOL of pyFpdf but upon running the designer.py with python designer.py it gives an error: File "designer.py", line 154 except Exception, e: ^ SyntaxError: invalid syntax I checked the python…
user13539846
  • 425
  • 2
  • 5
  • 13
1 2 3 4 5
6