Questions tagged [reportlab]
A library for generating PDF in Python.
1,186
questions
0
votes
0
answers
16
views
Reportlab table VALIGN with large text font
I'm fairly new to reportlab but pretty quickly started to generate some nice reports with it in conjunction with matplotlib. Now I'm faced with the problem of presenting data in a table rather then a ...
0
votes
1
answer
38
views
ReportLab: How to start writing from the upper left point of the paragraph, because by default it is from the lower left point
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.styles import ...
0
votes
0
answers
94
views
Convert AutoCAD SHX Text to searchable text in PDF using Python
PDF with AutoCAD SHX Text cannot be searched. We have a PDF files with annotation. My goal is to convert all AutoCAD SHX Text from PDF into text to be able to search it. I found Convert AutoCAD SHX ...
0
votes
0
answers
11
views
How to overcome Marisol ReportLab installation error?
An attempt to install Marisol on OS X 10.15:
pip3 install marisol | tee install_marisol_log.txt
returned:
Building wheel for reportlab (setup.py): finished with status
'error'
The complete install (...
-1
votes
0
answers
32
views
Studying reportlab
from mmap import PAGESIZE
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.pagesizes import A4
from reportlab....
0
votes
0
answers
21
views
reportlab sometimes adds an extra spaces between words
I am using Google Document AI to process pdf documents. After sending a pdf document, Google sends a json reply containing the detected text and the exact location of each word. This is a sample json ...
0
votes
0
answers
42
views
Python Reportlab Latin characters encoding
How would you manage certain latin characters (č, ć, ž, š, đ) in reportlab? Tried various types of UTF-8 encoding, but without luck. It displays as unreadable streams of data.
Can anyone help? Also, I ...
0
votes
0
answers
12
views
reportlab switching pageTemplate not happening properly
I am trying to change the page template dynamically using the onPage callback for the PageTemplate using handle_nextPageTemplate method.
If you look at the generated PDF, the second page does not get ...
2
votes
0
answers
23
views
Add arguments to callback function for reportlab PageTemplate
I am using the code in this source here to create a sample doc. Particularly, this is the entire working code:
import os
from reportlab.platypus import BaseDocTemplate, Frame, Paragraph, ...
0
votes
0
answers
19
views
Special character encoding added - PDF Django
I have a function to create a simple PDF. But when working on special characters, it returns something like that. How do I correctly save characters such as śćźż in my pdf file?
I tried to change the ...
0
votes
0
answers
15
views
Using Reportlab and Platypus all links point to the top of the document (not Rome)
I have been using Platypus & Reportlab for several weeks using Python, and would caveat this by saying that I am definitely a beginner, and my code isn't "good" code, but ...
I tend to ...
1
vote
0
answers
25
views
How to conditionally set header and footer of pages?
It's my first time using reportlab to generate pdfs, it's VERY hard for me to understand how it works (it took me a day to even put a sized SVG image :D)
I want to achieve a very basic pdf:
As you can ...
0
votes
1
answer
69
views
How to fix ModuleNotFoundError: No module named 'reportlab.graphics.barcode.code93' in pyinstaller?
I am converting a python file to .exe using pyinstaller v5.0.1, but I got this error when I run the exe file:
ModuleNotFoundError: No module named 'reportlab.graphics.barcode.code93'
Note that the ...
0
votes
0
answers
17
views
Error in .exe of python script having Barcode from Reportlab.graphics
I have a python script for generating barcodes (code128) which works fine in IDE.
But when converted into exe, it encounters below error:
Traceback (most recent call last):
File "amazonbarcode-...
0
votes
0
answers
21
views
Reportlab add space between Balanced columns
For the balanced column in reportlab, I want to increase the spacing between the columns so that no text gets very close to each other and there is a clear separation between them.
In the user guide ...
0
votes
0
answers
64
views
Django: Permission denied when loading a Font using xhtml2pdf
An error occurs when trying to load a TTF font within an HTML file that is to be converted to PDF using xhtml2pdf. The error only occurs when loading fonts, and doesn't occur with other types of ...
1
vote
0
answers
63
views
How to set font kerning in reportlab python?
I add font to reportlab, then it generates pdf, but text has kerning turned off. For example in html it works as expected. How to enable font kerning in reportlab ? I have tried changing settings in ...
0
votes
0
answers
24
views
ReportLab: edit a certain page after creating several pages
I want to edit a certain page while creating a PDF with ReportLab only. (There are some solutions with PyPDF2, but I want to use ReportLab only - if it is possible).
Description what I am doing / try ...
0
votes
0
answers
15
views
ReportLab - Why space has border
I write Paragraph like below
Paragraph("<para alignment='center'><img src='image location' width='28' height='28' valign='-4'/> <font color='blue' size=28>649</font&...
0
votes
1
answer
27
views
Python Reportlab - Wordwrap on Table is splitting words rather than at spaces
I created a PDF in reportlab using a canvas:
self.pdf = canvas.Canvas(f'{file_name}.pdf', pagesize=A4)
I create tables within tables to create my document but one of my tables is not wrapping the way ...
0
votes
0
answers
24
views
How to remove extra spaces inside a cell in a table in reportlab
I am new to report lab and i would like to remove extra white spaces inside a cell in a table in reportlab
This is my code
def add_in_pdf_report(self):
table = []
styleN = styles["...
0
votes
0
answers
16
views
Is there a way to autofit contents in a table contents with max table width in reportlab.?
I have a large number of tables with different sizes.. But setting the colWidth get some of the table too big or too small for the canvas.. Is there any way in reportlab to autofit contents in a ...
0
votes
0
answers
15
views
Is there a way to italicize a word in reportlab
I am new to reportlab. I want to italicize a paragraph. Can it be done without importing any fonts.
This is a piece of my code
text = "Hello world"
styleH = ParagraphStyle('title', fontSize =...
0
votes
1
answer
110
views
ReportLab: align text with KeepInFrame inside Frame not working
I am trying to align a text horizontally and vertically inside a Frame using ReportLab.
The problem is that even defining explicitly the arguments hAlign='CENTER' and vAlign='BOTTOM' for the ...
0
votes
0
answers
42
views
Python crashing while opening a image
I am getting an image using an API call and eventually need to put the image into a PDF document using ReportLab. Python was crashing without any error messages when I tried canvas.drawImage method in ...
0
votes
1
answer
19
views
Dose python reportlab has debug log?
I get issue about trigger SimpleDocTemplate.build() it will hang long time. I check the memory and cpu usage, there is nothing wrong. And I can't reproduce the problem in another server. So i want to ...
0
votes
0
answers
33
views
apache2 permissions denied, django project
I have a linux server (ubuntu) and I uploaded a project, in my project, I try to generate a pdf with reportlab, using some fonts for the created pdf.
I am having problems with permissions for ...
0
votes
0
answers
24
views
Python pylabels / changing to smaller font not possible?
I try to use pylabels to create some label-pdfs with the following code - in the example, the fontSize is set to 40 - but I changed it to 10 -
But nevertheless, the output is always with big letters - ...
0
votes
1
answer
17
views
Named entities in Reportlab
I just learned that Reportlab will support named entities like α and ≈ in paragraph text. Exactly which entities will it support?
Here's an example of how it works:
from reportlab....
0
votes
0
answers
70
views
Using ReportLab and PyPDF2, how do I diagonally align text through the middle of a landscape pdf/power point?
I am trying to diagonally place a text watermark over pdf slides. The issue I am having is that if the text is too long or short it is not centered correctly or it gets cut off due to the x and y ...
0
votes
0
answers
51
views
How to pass some variable values to RML file in Python?
Given an RML template, used to generate PDF file in python, how can one use variables declared in a Python script in the RML template file?
def create_pdf:
name = "My Name"
with open('...
0
votes
1
answer
147
views
`reportlab` table cell's height exceeding height of the page
I have data for some applications and I want to generate PDF files of the applications using reportlab.
The template to create PDF files was given to me and has nested tables. And these tables are ...
0
votes
0
answers
16
views
few backgrounds in report lab platypus
I'm trying to create pdf with reportlab and using platypus.
I want to have big photo (full A4) with first_name and last_name OVER photo)
Now I have this:
(...)
for person in people:
image = "...
1
vote
1
answer
69
views
Reportlab and pdfrw with matplotlib imshow() error in python3
I've recently updated some code which worked in python2 to python3 and encountered an error using reportlab in conjunction with pdfrw and matplotlib imshow().
Can someone reproduce this error in py3? ...
0
votes
0
answers
25
views
ReportLab Breakline is not working ( big text )
I know about <br /> but it's not working for me...
I have a single long line so I had to use textwrap to wrap it into smaller lines
example: separate_text = ('<br/>'.join(textwrap.wrap(...
0
votes
1
answer
49
views
Reportlab Platypus generates empty file on second pass
Minimal example:
import io
import lorem
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import SimpleDocTemplate, Paragraph
styles = getSampleStyleSheet()
story = [...
0
votes
0
answers
35
views
printer not printing pdf that is generated using reportlab
from reportlab.pdfgen import canvas
c = canvas.Canvas("hello.pdf")
c.drawString(100,750,"Welcome to Reportlab!")
c.save()
this is my simple python code it generates pdf ...
0
votes
0
answers
42
views
ReportLab page break in python
I have a view for creating from a Pandas dataframe and then turns it into a PDF file and returns the file response. Everything works fine except for (see code below for comment:)
@login_required()
def ...
2
votes
0
answers
102
views
Django FileResponse PDF - pdf font changes in frontend - (Django DRF and React.js)
I am using Django Rest Framework and React.js for my application. As part of the application I generate pdf in the backend and then send them to the frontend to be displayed. This functionality is ...
1
vote
1
answer
71
views
Text rotated when merging pdf pages using Pypdf2 and Reportlab
I'm trying to merge two pages
one from reportlab that has the text I wish and another one is my source pdf
But when I merge those two pages, my text is rotated 90 degree
Pdf created using Report lab -&...
0
votes
0
answers
25
views
while creating pdf for repaortlab layout error
raise LayoutError(ident)
reportlab.platypus.doctemplate.LayoutError:
Flowable <Table@0x7FA13491B898 1 rows x 1 cols(tallest row 900)> with cell(0,0) containing
'<Table@0x7FA1349110B8 1 rows ...
0
votes
0
answers
74
views
PyPDF4 doesn't want to merge pdf and reportlab Canvas. Giving an index error even though it shouldn't
In my code I am trying to overlay a reportlab canvas overtop of a pdf as I want to stamp text ontop of the pdf. The code works for when I want to do 1 page at a time. However I would like to do ...
0
votes
0
answers
49
views
Create table on Reportlab the next row display above
I am new to reportlab for creating PDF and very confuse about x,y coordinate. When create the table on canvas, the second row insert above the first row instead. So, the data on table is overlap with ...
0
votes
1
answer
34
views
drawString doesn't print
I try to use enter link description here this to generate page nums.
The most important part:
class PageNumCanvas(canvas.Canvas):
"""
http://code.activestate.com/...
0
votes
0
answers
38
views
reportlab: image not set properly(inversion-rotation)
please am really stressed , from 2 days am searching to set a background image for my pdf generated , I have tried with the library wkhtmltopdf and it givs me a white space on the header(it's a bug in ...
0
votes
0
answers
21
views
How do I fit table width to content
I want to create a table that is only as wide as it needs to be.
The following is not good enough since the content is variable
Table(*data, colWidths = 3*cm)
Creating a Table without any arguments, ...
1
vote
1
answer
40
views
How do I break line at the range on ReportLab?
I am trying to write text on a PDF file but if the line is bigger than the page size it overflows and doesn't automatically go to the next line. How do I provide a range when the line overflows and ...
1
vote
1
answer
342
views
Django: save pdf from view to model (reportlab)
Is it possible in Django to save a pdf from a view to a model (while downloading it at the same time)?
So far, these steps work already:
the pdf is displayed in a new tab and I can download it
the ...
0
votes
0
answers
34
views
Reportlab pyhton alignment issue
Style3 = TableStyle([('VALIGN',(0,0),(-1,-1),'TOP'),
('ALIGN',(0,0),(-1,-1),'RIGHT'),
('LEFTPADDING',(0,0),(-1,-1), 130),
('RIGHTPADDING',(0,0),(-1,-1), 0),
('TOPPADDING',(0,0),(-1,-1), 0),
])
I want ...
0
votes
0
answers
11
views
Reportlab, move image to center
I have such code that add svg-image to pdf
def pdf_generator(response:
buff = io.BytesIO()
doc = SimpleDocTemplate(buff, pagesize=letter,
rightMargin=72, leftMargin=...