Questions tagged [python-pdfkit]

84 questions
0
votes
1 answer

python: html string to pdf via Pdfkit: avoid image to span into 2 pages

I want to output html string to pdf via Pdfkit and python. The html string included an image. The problem is that the image spanned into 2 pages as shown below. Assume the image can be held in one page, how to make the image not span into 2 pages…
warem
  • 1,471
  • 2
  • 14
  • 21
0
votes
0 answers

Dash localhost page to PDF

Good day I would like to save my dash graphs to a pdf and with this code: import dash import dash_bootstrap_components as dbc import pandas as pd import plotly.express as px import pdfkit from dash import dcc, html from dash.dependencies import…
0
votes
0 answers

Why does Python Pdfkit's from_string method insert a blank first page into the pdf?

I'm currently attempting to render a pdf from a series of html files with Python pdfkit and PyPDF2. My goal is to render each html file into a single page with pdfkit before stitching them together with PyPDF2's PdfMerger class. However, each time I…
0
votes
0 answers

pdf report creation using pdfkit python django

I am creating pdf report using pdfkit 0.6.1 and from_url method in django 4 python but the problem on my local system pdf is creating as I required but when i am pushing code on production server it is creating pdf like this: pdf content is not…
0
votes
0 answers

How to use run-script argument in pdfkit (wkhtmltopdf python wrapper)

I'm using pdfkit like this: options = { 'run-script': script } script function isOverflown(element) { return element.scrollHeight > element.clientHeight } var els = document.getElementsByClassName('headings'); for (var i =…
noname
  • 95
  • 6
0
votes
4 answers

Is there any way to highly compress PDF files through python?

I have generated a PDF file through python using pdfkit library running on django server. The size of pdf generated is 43.2 MB. Total pages in pdf = 15. Each page has 70 images, each image size = 623 bytes. Tech Stack version used- -Python =…
Himanshu K
  • 9
  • 1
  • 2
0
votes
0 answers

SVG text path is not getting rendered by wkhtmltopdf

I am trying to convert a HTML to PDF using wkhtmltopdf and pdfkit with python. In my HTML, there is a circular text which is not getting rendered in pdf. But it's displaying in all browser. Everything else is rendering correctly. Sample…
gmtek
  • 741
  • 3
  • 7
  • 25
0
votes
1 answer

How to use Python Fitz detect Hyphen when using search_for?

I'm new to the Fitz library and am working on a project where I need to find a string in a PDF page. I'm running into a case where the text on the page that I'm searching on is hyphenated. I am aware of the TEXT_DEHYPHENATE flag that I can use in…
Kevin Wu
  • 3
  • 1
  • 6
0
votes
0 answers

Convert a html with images to pdf

This is a follow up to my previous question Adding multiple images to a html file using Jinja2 I am trying to save the html created using jinja2 to pdf. import jinja2 env = jinja2.Environment( loader=jinja2.FileSystemLoader('.'), …
Natasha
  • 1,111
  • 5
  • 28
  • 66
0
votes
0 answers

Python3 pdfkit issue in generating pdf

Im using python3 pdfkit to convert html to pdf . When using macbook , CSS (Bootstrap 5) are not applied properly while generating pdf but the same works fine in ubuntu . is there any issue with MAC OS ? im using MacOS Big Sur Version11.4 Thanks in…
PremKumarR
  • 461
  • 1
  • 6
  • 19
0
votes
1 answer

Python pdfkit Command Failed

Today I tried deploying a webapp on a debian apache 2 server and wasted half a day trying to get pdfkit to work. The app is suposed to render a standard html template using jinja2 and then turn that rendered template into a pdf file the end user is…
TCA 166
  • 57
  • 4
0
votes
0 answers

Python PDF merge files inside folder, after sorting

Am looking for a way to join separate PDF files I exported from QGIS layout, with specific naming format will include decimal number at beginning. 1- 8.5_Point_5555 2- 01.50_Point_5557 3- 12.0_line_5554 4- 00.5_polygon_3554 The issue that when…
0
votes
0 answers

Trying to extract a range of PDF page numbers from a pdf page to split and save it as a separate file using Python

I am trying to create a range of page numbers from a pdf file and then split and save them as a separate file. Below is the code written for it. import os from PyPDF2 import PdfFileReader, PdfFileWriter import re def pdf_splitter(pdf_path): …
Amit Sharma
  • 53
  • 1
  • 7
0
votes
0 answers

pipenv: pdfkit not found when running FastAPI app

I've been developing an API using FastAPI and pipenv to manage my virtual environment. To start my testing setup, I use the following commands on the console: pipenv shell uvicorn backend:app --reload The API starts after a couple of seconds and…
Eddysanoli
  • 481
  • 2
  • 8
  • 17
0
votes
1 answer

Running Python script from PHP but its not working

HI I am using PHP to execute python script: pdf.py import pdfkit pdfkit.from_url('https://www.google.co.in/','google.pdf'); data.php ini_set('display_errors', 1); error_reporting(E_ALL ^ E_DEPRECATED); exec("python pdf.py"); I tried executing ython…