Skip to main content

printing

Printing utils for Windows.

Install

pip install win32printing

Installed Utils

  • win32printing.get_system_fonts
  • win32printing.PrinterBase
  • win32printing.PrinterContext
  • win32printing.Printer

Printer APIs

  • text(text, align="left", font_config=None)
  • new_page()

Usage Example

from win32printing import Printer

font = {
    "height": 8,
}
with Printer(linegap=1) as printer:
    printer.text("title1", font_config=font)
    printer.text("title2", font_config=font)
    printer.text("title3", font_config=font)
    printer.text("title4", font_config=font)
    printer.new_page()
    printer.text("title5", font_config=font)
    printer.text("title6", font_config=font)
    printer.text("title7", font_config=font)
    printer.text("title8", font_config=font)

Printer init parameters

  • printer_name: The printer name which will be used to print. None value means use system default's printer. Default to None.
  • doc_name: The file name will be used. None value means "NoNameFile". Default to None.
  • margin: The page margin. Default to (0, 0, 0, 0).
  • linegap: Gap between two lines.
  • default_font: Default font config used in print, will be override by .text(..., font_config).
  • auto_page: Do auto page or not. Default to False means you shuold care about pagination by yourself.

font_config items

  • height
  • width
  • escapement
  • orientation
  • weight
  • italic
  • underline
  • strikeOut
  • charSet
  • outPrecision
  • clipPrecision
  • quality
  • pitchAndFamily
  • faceName

Note: See item detail at https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createfontw

Releases

v0.1.3 2020-06-21

  • Add auto_page for Printer.
  • Fix Printer(..., default_font) not used problem.
  • Update doc, add new_page usage in example.

v0.1.2 2020-02-12

  • Fix printer_name parameter not using problem. Thanks to Mark Butsch.

v0.1.1 2019-10-22

  • Fix py_modules problem in setup.py.

v0.1.0 2019-10-22

  • Allow text printing on Windows system.
  • Support text alignment and font settings.
  • Support linegap setting.

Metadata

Release files for win32printing 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for win32printing 0.1.3
File Size Uploaded Provenance Actions
win32printing-0.1.3.tar.gz 4.9 kB Without provenance Details for win32printing-0.1.3.tar.gz

Release files / win32printing-0.1.3.tar.gz

Download URL win32printing-0.1.3.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6690bd74b529d26f28d21bd6eabb892785352e5edbd29ddbed387ad27c3f7d12
BLAKE2b-256 checksum
How to use checksums
3bec8acf69b0173240b3cbadf941aeba572df474254cb94397d38b693fd5359d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Security for win32printing 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page