October 2, 2022

Windows -- printer support API

So if you are a developer working on an application that you intend to run in the Windows environment, how does Microsoft expect you to implement printer functionality? And how would I (programming in Python) access the windows API. Well the Python gang has a win32api package (but is there a win64api). Actually, the module you may want is win32print. Consider this comment from the above:
Without any extra tools, printing an image on a Windows machine is almost insanely difficult, involving at least three device contexts all related to each other at different levels and a fair amount of trial-and-error.
The above writer suggests generating PDF files and then letting Adobe Acrobat deal with the printing. This might not be a bad idea. I don't see FPDF in the Fedora package collection. Here is what I do see:
python3-reportlab.x86_64
python3-img2pdf.noarch
python3-pdfminer.noarch
python3-pikepdf.x86_64
pdflib-lite-python.x86_64
python-pikepdf-doc.x86_64
python3-lhapdf.x86_64
python3-pdfkit.noarch
python3-pdfrw.noarch
python3-sphinxcontrib-svg2pdfconverter-common.noarch
python-PyMuPDF-doc.noarch
python-PyPDF2-doc.noarch
python3-PyMuPDF.x86_64
python3-PyPDF2.noarch
Among the above that are mentioned and recommended are reportlab and pdfrw. Also pikepdf (based on QPDF). Also we could use FPDF and install it via PIP (or some other method). And consider PyPDF2.

FPDF has at least 3 strikes against it. First is it is not available as a Fedora package. Second is that it was ported from PHP. Third is that I read that reportlab is "for more advanced users and is way more comprehensive". And now I read that "PyFPDF is dead, being replaced by fpdf2".


Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org