{"id":16685992,"url":"https://github.com/danielsaidi/printingkit","last_synced_at":"2025-09-23T09:32:02.063Z","repository":{"id":189710634,"uuid":"681150219","full_name":"danielsaidi/PrintingKit","owner":"danielsaidi","description":"Easily print texts, views, images, PDFs etc. from any SwiftUI app.","archived":false,"fork":false,"pushed_at":"2025-06-01T19:04:45.000Z","size":4187,"stargazers_count":114,"open_issues_count":2,"forks_count":13,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-09-17T20:47:29.654Z","etag":null,"topics":["ios","ipados","macos","pdf","print","printer","swift","swiftui","tvos","visionos","watchos"],"latest_commit_sha":null,"homepage":"https://danielsaidi.com/opensource","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielsaidi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["danielsaidi"]}},"created_at":"2023-08-21T11:30:53.000Z","updated_at":"2025-09-13T15:27:52.000Z","dependencies_parsed_at":"2023-08-21T12:48:56.455Z","dependency_job_id":"a85da9ca-b2c1-479d-9b5a-f10251b9c927","html_url":"https://github.com/danielsaidi/PrintingKit","commit_stats":null,"previous_names":["danielsaidi/printingkit"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/danielsaidi/PrintingKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FPrintingKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FPrintingKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FPrintingKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FPrintingKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielsaidi","download_url":"https://codeload.github.com/danielsaidi/PrintingKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielsaidi%2FPrintingKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276142874,"owners_count":25592523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","ipados","macos","pdf","print","printer","swift","swiftui","tvos","visionos","watchos"],"created_at":"2024-10-12T15:04:09.321Z","updated_at":"2025-09-23T09:32:02.034Z","avatar_url":"https://github.com/danielsaidi.png","language":"Shell","funding_links":["https://github.com/sponsors/danielsaidi"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"Resources/Icon.png\" alt=\"Project Icon\" width=\"250\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/danielsaidi/PrintingKit?color=%2300550\u0026sort=semver\" alt=\"Version\" title=\"Version\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/swift-6.0-orange.svg\" alt=\"Swift 6.0\" title=\"Swift 6.0\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/platform-SwiftUI-blue.svg\" alt=\"Swift UI\" title=\"Swift UI\" /\u003e\n    \u003ca href=\"https://danielsaidi.github.io/PrintingKit\"\u003e\u003cimg src=\"https://img.shields.io/badge/documentation-web-blue.svg\" alt=\"Documentation\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/danielsaidi/PrintingKit/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/danielsaidi/PrintingKit\" alt=\"MIT License\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/sponsors/danielsaidi\"\u003e\u003cimg src=\"https://img.shields.io/badge/sponsor-GitHub-red.svg\" alt=\"Sponsor my work\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n# PrintingKit\n\nPrintingKit is a SwiftUI library that lets you print images, strings, views, files, PDFs, etc. from any SwiftUI app. Just create a ``Printer`` instance or use the ``Printer.shared`` printer, then call any of its print functions to print.\n\n\n\n## Installation\n\nPrintingKit can be installed with the Swift Package Manager:\n\n```\nhttps://github.com/danielsaidi/PrintingKit.git\n```\n\n\n## Support My Work\n\nYou can [become a sponsor][Sponsors] to help me dedicate more time on my various [open-source tools][OpenSource]. Every contribution, no matter the size, makes a real difference in keeping these tools free and actively developed.\n\n\n\n## Getting started\n\nTo print, just create a ``Printer`` instance, or use the ``Printer.shared`` printer, then use it to print any of the following supported printable types:\n\n* ``printAttributedString(_:config:)`` - print an attributed string.\n* ``printData(_:withFileExtension:)`` - try to print generic data.\n* ``printFile(at:)`` - try to print a generic file.\n* ``printImage(_:)`` - print a `UIImage` or `NSImage`.\n* ``printImageData(_:)`` - print JPG or PNG data.\n* ``printImageFile(at:)`` - print a JPG or PNG file at a certain URL.\n* ``printPdfData(_:)`` - print PDF document data.\n* ``printPdfFile(at:)`` - print a PDF document file at a certain URL.\n* ``printString(_:config:)`` - print a plain string.\n* ``printView(_:withScale:)`` - print a SwiftUI view.\n\nIn SwiftUI, you can either print programatically, when a user taps/clicks a button, etc.:\n\n```swift\nstruct MyView: View {\n\n    var body: some View {\n        VStack {\n            Button(\"Print something\") {\n                do {\n                    try? Printer.shared.printString(\"Hello, world!\") \n                } catch {\n                    print(\"Handle this \\(error)\")\n                }\n            }\n        }\n    }\n}\n``` \n\nPrintingKit also has PDF utilities, which are used to print certain types. Since these utilies are the only ones that support paper size, page margins, etc. we should aim to make more print functions use PDF as print format.\n\n\u003e Note: Only some functions support providing a custom page configuration, which can be used to specify paper size and margins. More functions should support this functionality in the future.\n\n\n\n## macOS Sandbox Configuration\n\nFor a sandboxed application (default on macOS), you must allow printing in the target's \"Signing \u0026 Capabilities\" \u003e \"App Sandbox\" section or, you'll be met with the error \"This application does not support printing.\".\n\n\n\n## Documentation\n\nThe online [documentation][Documentation] has more information, articles, code examples, etc.\n\n\n\n## Demo Application\n\nThe `Demo` folder has a demo app that lets you explore the library.\n\n\n\n## Contact\n\nFeel free to reach out if you have questions, or want to contribute in any way:\n\n* Website: [danielsaidi.com][Website]\n* E-mail: [daniel.saidi@gmail.com][Email]\n* Bluesky: [@danielsaidi@bsky.social][Bluesky]\n* Mastodon: [@danielsaidi@mastodon.social][Mastodon]\n\n\n\n## License\n\nPrintingKit is available under the MIT license. See the [LICENSE][License] file for more info.\n\n\n\n[Email]: mailto:daniel.saidi@gmail.com\n[Website]: https://danielsaidi.com\n[GitHub]: https://github.com/danielsaidi\n[OpenSource]: https://danielsaidi.com/opensource\n[Sponsors]: https://github.com/sponsors/danielsaidi\n\n[Bluesky]: https://bsky.app/profile/danielsaidi.bsky.social\n[Mastodon]: https://mastodon.social/@danielsaidi\n[Twitter]: https://twitter.com/danielsaidi\n\n[Documentation]: https://danielsaidi.github.io/PrintingKit\n[License]: https://github.com/danielsaidi/PrintingKit/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsaidi%2Fprintingkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielsaidi%2Fprintingkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielsaidi%2Fprintingkit/lists"}