reportlab

Converting a html template containing highcharts to pdf

荒凉一梦 提交于 2020-08-10 19:17:20
问题 I have a html template with highcharts in it.I have to mail these reports after converting to pdf.I tried to use xhtml2pdf but it just loads everything but the charts.Here is my code (view.py) from io import BytesIO from xhtml2pdf import pisa from schedule.settings import EMAIL_HOST_USER from django.core.mail import EmailMessage def sender1(request): userid = request.user.email template = get_template('html.html') context = { 'pagesize': 'A3', } html = template.render(context) result =

Create outlines/TOC for existing PDF in Python

自古美人都是妖i 提交于 2020-07-05 03:29:28
问题 I'm using pyPdf to merge several PDF files into one. This works great, but I would also need to add a table of contents/outlines/bookmarks to the PDF file that is generated. pyPdf seems to have only read support for outlines. Reportlab would allow me to create them, but the opensource version does not support loading PDF files, so that doesn't work to add outlines to an existing file. Is there any way I can add outlines to an existing PDF using Python, or any library that would allow that?

How can I display data in table in columns, not row?

百般思念 提交于 2020-06-13 08:03:17
问题 I'm using Reportlab for pdf generate. How can I display data in table in columns, not row? Current output: Expected output: So data should be displayed in columns, not row. Here my code: # -*- coding: utf-8 -*- from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import A4, landscape from reportlab.platypus.tables import TableStyle, Table from reportlab.pdfbase import pdfmetrics from reportlab.platypus.paragraph import Paragraph from reportlab.lib import styles from reportlab.lib

Writing full csv table to PDF in Python

蹲街弑〆低调 提交于 2020-05-29 07:18:33
问题 I have a python script that writes text message data from a .csv file to a table in a PDF using reportlab platypus. It only writes the last line of the table into the cell. It ignores all other rows before this point. The only line it writes into the PDF is the last line shown in the excel snip highlighted in yellow. A snippet is also included of what it looks like when it writes it to the PDF as shown. It also creates the PDF in three or four pages inferring that it is trying to make space

Matplotlib figure to PDF without saving

送分小仙女□ 提交于 2020-05-25 08:42:27
问题 I have to create a group of matplotlib figures, which I would like to directly present in a PDF report without saving them as a file. The data for my plots is stored in a Pandas DataFrame: Right now I do not know other better option than first save the image and use it later. I am doing something like that: import matplotlib.pylab as plt from reportlab.platypus import BaseDocTemplate, Image for index, row in myDataFrame.iterrows(): fig = plt.figure() plt.plot(row['Xvalues'], row['Yvalues'],'o

How to create PDF containing Persian(Farsi) text with reportlab, rtl and bidi in python

99封情书 提交于 2020-05-09 05:09:05
问题 I've been trying to create a PDF file from content that can be English, Persian, digits or a combination of them. there is some problems with Persian texts like: "این یک متن فارسی است" ۱- the text must be written from right to left 2- there is a difference between characters in different positions in the word (meaning that characters change their shape according to their surrounding characters) 3- because the sentence is read from right to left then the normal textwrap doesn't work correctly.

Save Image generated with Reportlab in my MEDIA folder (in Amazon S3)

你离开我真会死。 提交于 2020-04-30 07:42:13
问题 I implemented this library for generate barcodes images (http://kennethngedo.wordpress.com/2014/02/07/how-to-generate-barcode-in-django-using-reportlab/) Everything works fine, the image is generated correctly, BUT... the image is created in a folder outside the project, and such I'm using Heroku for Production, I can't access to the image. I'm using this Django structure (http://django-skel.readthedocs.org/en/latest/) specially adapted to work on Heroku with Amazon S3. Do you know guys how

How to Repeat Table Column Headings over Page Breaks in PDF output from ReportLab

倾然丶 夕夏残阳落幕 提交于 2020-04-08 01:02:38
问题 I'm using ReportLab to write tables in PDF documents and am very pleased with the results (despite not having a total grasp on flowables just yet). However, I have not been able to figure out how to make a table that spans a page break have its column headings repeated. The code below creates a test.pdf in C:\Temp that has a heading row followed by 99 rows of data. The heading row looks great on the first page but I would like that to repeat at the top of the second and third pages. I'm keen