Skip to main content

flet-printing

Native print dialog / share sheet for Flet apps — wraps the Flutter printing package.

Flet has no built-in printing API. Flutter has a mature one. This extension bridges the gap, the same way official extensions like flet-audio wrap audioplayers.

The demand is documented: flet-dev/flet#894 (Jan 2023) asked for exactly this — PDF printing via the printing package — was closed as "completed" without a shipped solution, and the follow-up question "What's the completed solution for this?" (Feb 2024) was never answered. This package is that answer.

日本語補足: Fletには印刷APIがありません(0.85で全API確認、1.1でも無し)。 Flutterのprintingパッケージ(ネイティブ印刷ダイアログ・共有シート)を Flet拡張として包んだものです。ワープロ的なアプリの「ファイル→印刷…」を Fletで実装できます。

Usage

import flet as ft
from flet_printing import Printing

def main(page: ft.Page):
    printing = Printing()
    page.services.append(printing)

    async def print_click(e):
        pdf = open("document.pdf", "rb").read()
        sent = await printing.print_pdf(pdf, name="document")
        # sent=True: 印刷された / False: ダイアログでキャンセル

    page.add(ft.FilledButton("印刷…", on_click=print_click))

ft.run(main)

API:

  • await printing.print_pdf(pdf, name="document") — open the platform print dialog (printer selection / copies / duplex / save-as-PDF) for the given PDF bytes. Returns False if the user cancelled.
  • await printing.share_pdf(pdf, filename="document.pdf") — open the platform share sheet (mobile) / save dialog (desktop).

PdfPreview — display a PDF with print/share built in

from flet_printing import PdfPreview

page.add(PdfPreview(src=pdf_bytes, pdf_file_name="document.pdf",
                    expand=True))

Renders the PDF pages (scrollable) with an action bar: print and share buttons work out of the box. Properties: src (bytes or base64), allow_printing, allow_sharing, use_actions, pdf_file_name, on_printed/on_shared events. can_change_page_format / can_change_orientation are off by default (the PDF you pass is already laid out).

There is deliberately no HTML-to-PDF here: printing's convertHtml is deprecated. Generate the PDF yourself (e.g. headless Chrome for exact CJK typesetting) and pass the bytes to print_pdf.

Installation

Like every third-party Flet extension, this works with apps compiled via flet build (the prebuilt flet run client only bundles official extensions).

Add to your app's pyproject.toml:

dependencies = [
  "flet-printing",
  "flet>=1.1.0",
]

then flet build linux (or windows / macos / apk / ipa). The Usage snippets above are complete runnable apps — paste one into your app's main.py to try it (build verified on Linux: extension registers, app launches, print dialog opens).

Platform support

Follows the printing package: Android / iOS / macOS / Windows / Linux (via CUPS) / web. See the printing package docs for details.

License

MIT

Metadata

Release files for flet-printing 0.3.0

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

Source distribution (sdist)

Source distribution for flet-printing 0.3.0
File Size Uploaded Provenance Actions
flet_printing-0.3.0.tar.gz 7.5 kB With provenance Details for flet_printing-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flet-printing 0.3.0
File Interpreter ABI Platform Actions
flet_printing-0.3.0-py3-none-any.whl Python 3 none any Details for flet_printing-0.3.0-py3-none-any.whl

Total release size: 17.1 kB

Release files / flet_printing-0.3.0.tar.gz

Download URL flet_printing-0.3.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
938025055c4b452dd16ef6182dfb1862faf01d5974ab4cd64f0b6e9f91a0056d
BLAKE2b-256 checksum
How to use checksums
49f31837739a33e22165d75ca12d12d32c704d5aa9423bdd2bc70667d8694bf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / flet_printing-0.3.0-py3-none-any.whl

Download URL flet_printing-0.3.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f39086dd008955b0f3e38670f14a1dae2efd2ffc265a203140adbcc16d7a7cab
BLAKE2b-256 checksum
How to use checksums
2cbc80c486f2bedc9854ffea0ee49610521967d0196692aaa32743c0cb42a30f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for flet-printing 0.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flet_printing-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

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