{"id":13492440,"url":"https://github.com/WeirdMath/SwiftyHaru","last_synced_at":"2025-03-28T10:32:12.483Z","repository":{"id":56904893,"uuid":"69702395","full_name":"WeirdMath/SwiftyHaru","owner":"WeirdMath","description":"A safe cross-platform Swift wrapper for LibHaru — a library for creating PDF documents.","archived":false,"fork":false,"pushed_at":"2020-07-03T10:24:59.000Z","size":6196,"stargazers_count":55,"open_issues_count":4,"forks_count":11,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2024-04-14T04:58:16.529Z","etag":null,"topics":["cocoapods","ios","libharu","linux","pdf","pdf-generation","swift"],"latest_commit_sha":null,"homepage":"https://weirdmath.github.io/SwiftyHaru/","language":"C","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/WeirdMath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-30T21:10:20.000Z","updated_at":"2024-04-14T04:58:16.530Z","dependencies_parsed_at":"2022-08-20T18:40:08.419Z","dependency_job_id":null,"html_url":"https://github.com/WeirdMath/SwiftyHaru","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeirdMath%2FSwiftyHaru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeirdMath%2FSwiftyHaru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeirdMath%2FSwiftyHaru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WeirdMath%2FSwiftyHaru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WeirdMath","download_url":"https://codeload.github.com/WeirdMath/SwiftyHaru/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791901,"owners_count":20672666,"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","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":["cocoapods","ios","libharu","linux","pdf","pdf-generation","swift"],"created_at":"2024-07-31T19:01:06.085Z","updated_at":"2025-03-28T10:32:07.470Z","avatar_url":"https://github.com/WeirdMath.png","language":"C","readme":"# SwiftyHaru\n\n[![Build Status](https://travis-ci.org/WeirdMath/SwiftyHaru.svg?branch=dev)](https://travis-ci.org/WeirdMath/SwiftyHaru)\n[![codecov](https://codecov.io/gh/WeirdMath/SwiftyHaru/branch/dev/graph/badge.svg)](https://codecov.io/gh/WeirdMath/SwiftyHaru)\n[![documentation](docs/badge.svg)](https://weirdmath.github.io/SwiftyHaru/)\n![Language](https://img.shields.io/badge/Swift-4.2-orange.svg)\n![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20iOS%20%7C%20watchOS%20%7C%20tvOS-lightgrey.svg)\n![Cocoapods](https://img.shields.io/cocoapods/v/SwiftyHaru.svg?style=flat)\n\nSwiftyHaru is an object-oriented Swift wrapper for [LibHaru](https://github.com/libharu/libharu), a C library for creating PDF documents. It brings the safety of Swift to the process of creating PDFs on different platforms like Linux, macOS, iOS, watchOS and tvOS.\n\nCheck out which [features of LibHaru](https://github.com/libharu/libharu/wiki) has already been implemented in [FEATURES.md](FEATURES.md)\n\n## Requirements\n\n* Swift 4.2+\n* iOS 8.0+\n* macOS 10.10+\n* tvOS 9.0+\n* watchOS 2.0+\n* Ubuntu 14.04+\n\n## Installation\n\n#### CocoaPods\n\nFor the latest release in CocoaPods add the following to your `Podfile`:\n\n```ruby\nuse_frameworks!\n\npod 'SwiftyHaru'\n```\n\nFor the latest dev build:\n\n```ruby\nuse_frameworks!\n\npod 'SwiftyHaru', :git =\u003e 'https://github.com/WeirdMath/SwiftyHaru.git', :branch =\u003e 'dev'\n```\n\n### Swift Package Manager\nAdd SwiftyHaru as a dependency to your `Package.swift`. For example:\n\n```swift\nlet package = Package(\n    name: \"YourPackageName\",\n    dependencies: [\n        .package(url: \"https://github.com/WeirdMath/SwiftyHaru.git\", from: \"0.3.0\")\n    ]\n)\n```\n\n**Important:** when building your project that has SwiftyHaru as a dependency, \nyou need to pass the `-Xlinker -lz` flags to the compiler. This is because SwiftyHaru has to be linked with zlib (which must be intalled on your computer). For example:\n\n```\n$ swift build -Xlinker -lz\n$ swift test -Xlinker -lz\n```\n\n## Documentation\n\nAvailable [here](https://weirdmath.github.io/SwiftyHaru/).\n\n## Getting started\n\n```swift\nimport SwiftyHaru\n\n// Initialize stuff\nlet document = PDFDocument()\n\ntry document.addPage(width: 600, height: 400) { context in\n\n    // Construct a path\n    let path = Path()\n        .moving(toX: 100, y: 100)\n        .appendingLine(toX: 400, y: 100)\n        .moving(toX: 500, y: 200)\n        .appendingArc(x: 400, y: 200, radius: 100, beginningAngle: 90, endAngle: 180)\n        .appendingCircle(x: 200, y: 200, radius: 50)\n        .moving(toX: 500, y: 200)\n        .appendingCurve(controlPoint1: Point(x: 400, y: 200),\n                        controlPoint2: Point(x: 400, y: 300),\n                        endPoint: Point(x: 500, y: 300))\n        .closingSubpath()\n\n    // Paint the path\n    context.strokeColor = .blue\n    context.stroke(path)\n\n    // Put some text\n    context.textLeading = 11\n    try context.show(text: \"Roses are red,\\nViolets are blue,\\nSugar is sweet,\\nAnd so are you.\",\n                     atX: 300, y: 200)\n}\n```\n\n## Contributing\n\n### Building:\n\n```\n$ make debug\n```\nOr:\n\n```\n$ make release\n```\n\n### Testing:\n\n```\n$ make test\n```\n\n### Generating Xcode project\nSince the Xcode project is explicitly `gitignore`d, you might want to generate it in order to make development comfortable for you. This can be accomplished by running the following command:\n\n```\nmake generate-xcodeproj\n```\n\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWeirdMath%2FSwiftyHaru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWeirdMath%2FSwiftyHaru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWeirdMath%2FSwiftyHaru/lists"}