0

So, it's about, for example, this link, to sheet music: https://thesession.org/tunes/12124/12124?print=true It is a special print page. Now, since at least firefox automatically has the option to download as PDF, I wonder if this could be done automatically with python. If it were possible, then I could embed it into my GUI, and have an app for showing sheet music. Is there a way to do it? Or an alternative way to convert the HTML to PDF?

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • 1
    Does this answer your question ? https://stackoverflow.com/questions/23359083/how-to-convert-webpage-into-pdf-by-using-python – ScottC Dec 15 '22 at 01:36
  • Thanks! First I thought it didnt work, but I now found it does work, I made a mistake with installing it – Willem van Houten Dec 15 '22 at 17:14

1 Answers1

0

Ok, I found the answer, thanksto ScottC his reference to another questoin:

Usage

import pdfkit
pdfkit.from_url('http://google.com', 'out.pdf')

Install

MacOS: brew install Caskroom/cask/wkhtmltopdf

Debian/Ubuntu: apt-get install wkhtmltopdf

Windows: choco install wkhtmltopdf

See official documentation for MacOS/Ubuntu/other OS: https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf