Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

PLHKit: A Swift DSL for Rendering and creating PDF Files.

NotificationsYou must be signed in to change notification settings

iMostfa/PLHKit

Repository files navigation

PLH is a tribute to Portsaid Light House, Port Said Lighthouse was the first building in the world created with reinforced concrete. 🌊


PLHKit is a Swift DSL for Rendering and creating PDF Files. PLHKit aims to provide Friendly APIs like what you are already familiar with in SwiftUI.

and it’s currentlyExperimental

You can create beautiful pages by using syntax similar to what’s used in SwiftUI

VStack{Text("Hello World ! 🌊")}

ScreenshotScreenshotScreenshotScreenshotScreenshot

Current Stage

This project is still under development, it’s working but we still have a lot of things to be done..also, i'm still discoverting the world of DSLs and layout algrothims, your contributations and notes are highly apperciated and welcomed.

How To use

The simplest PDFFile is created from a single PDFPage, and you can preview a PDFFile using PLHViewer, so you can have Live Editing !

letpage1=PDFPage{VStack{Text("Contents").foregroundColor(UIColor.defaultGray3).font(.init(name:"Zapfino", size:50)).fontSize(45).padding(.leading,-20)Spacer()}}letpdfFile=PDFFile.init(pages: page1)letpdfData= pdfFile.body //<- Accessing PDF Body will trigger drawing ActionsstructMyAmazingPDF:View{varbody:someView{PLHViewer{letpage1=PDFPage{VStack(alignment:.leading, spacing:2){Text("Portsaid City").font(UIFont.defaultHeavy()).fontSize(60).foregroundColor(.redTitleColor)Text("DATA SHEET 2022").font(UIFont.defaultMedium()).fontSize(20).foregroundColor(.blackTitleColor)}}returnPDFFile(pages: page1 /*, pag2, page3 */)}}}

Installation

Currently the Package is available using Swift Package Manger, and it supposed to work with iOS 12+, but live previewing is supported from iOS 13+, because it depends on SwiftUI.

Known Bugs/limitations

we are still discovering bugs and limitations, here’s what’s known

  • Frame Alignment is limited to center, and leading.
  • Drawing takes a little bit of time (we need to cache the geometries calculations?)
  • Compiling is slow IMO (still investigating, likely because of numerical literals conversions ?)
  • Image Resizing is needed, currently you need to have the image resized before placing it.
  • Modifiers don’t go to upper nodes tree.
  • Previews are buggy (I think this’s because of the other bugs, and Xcode =) )
  • Excessive usage of padding/ VStack inside HStack ; are used because of the absence of Frame alignments.

Features

Current features in PLHKit are limited and we are working on implementing more

  • Basic support for shapes
  • Basic support for Text
  • Support for PDFEditor Viewer to work like SwiftUI
  • Basic support for HSTack, VSTack
  • RTL Support
  • Support Images
  • Support Text with constrained width but no height
  • Support Multiple Pages
  • Support text fonts
  • add Alignment modifier
  • Support Mac Devices ?
  • Example Project

Credits

  • Mockingbird Developers.
  • Portsaid City And my friends. 🌊

About

PLHKit: A Swift DSL for Rendering and creating PDF Files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp