pdf-generation

"no module named PyPDF2" error

"no module named PyPDF2" error Question: I use Spyder, with Python 2.7, on a windows 10. I was able to install the PyPDF2 package with a conda command from my prompt. I said installation complete. Yet, If I try to run a simple import command: import PyPDF2 I get the error: ImportError: No module named …

Total answers: 10

Python ReportLab — Table too wide for page

Python ReportLab — Table too wide for page Question: I’m using the ReportLab package for python to create a table in a PDF file, but the table is too wide for the page and the first and last columns cut off. Here is a sample of the code I’m using. t = Table(data, style=[(“INNERGRID”, (0,0), …

Total answers: 4

Python PyPDF2 merge rotated pages

Python PyPDF2 merge rotated pages Question: I’m using python ReportLab canvas to generate overlay document with watermarks to merge it into source pdf document (with PyPDF2). Recently I encountered a problem with a document that contains rotated pages (/Rotate key is present for Page object in pdf). This document looks ok on devices and printers. …

Total answers: 1

password protect pdf files created using pisa

password protect pdf files created using pisa Question: I’m converting a html file into pdf using python pisa module. I need to password protect it. I searched everywhere in pisa module and couldn’t find a solution for it. Is there anyway to password protect it using python? The constraint is I want keep my file …

Total answers: 2

Python PDF library

Python PDF library Question: What Python PDF libraries are there? I need to make some PDF with many grids, and I’m looking for a library that allows to manage pages (multi-page). The library should calculate when the page is ended and then create the next page. Asked By: enfix || Source Answers: The two that …

Total answers: 4

How to unit test a Python function that draws PDF graphics?

How to unit test a Python function that draws PDF graphics? Question: I’m writing a CAD application that outputs PDF files using the Cairo graphics library. A lot of the unit testing does not require actually generating the PDF files, such as computing the expected bounding boxes of the objects. However, I want to make …

Total answers: 6

Shrink and merge PDFs in Python

Shrink and merge PDFs in Python Question: I’m trying to shrink and merge two A4 PDF pages into one A4 page so that if I had; _____ _____ | | | | | p1 | | p2 | | | | | |_____| |_____| I would get; _____ | p1 | |…..| | p2 | …

Total answers: 2

Render HTML to PDF in Django site

Render HTML to PDF in Django site Question: For my django powered site, I am looking for an easy solution to convert dynamic html pages to pdf. Pages include HTML and charts from Google visualization API (which is javascript based, yet including those graphs is a must). Asked By: crib || Source Answers: Try the …

Total answers: 10