Giter VIP home page Giter VIP logo

plhkit's Introduction

PLHKit

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 currently Experimental

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

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

Screenshot Screenshot Screenshot Screenshot Screenshot

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 !

let page1 = PDFPage {
        VStack {
            Text("Contents")
                .foregroundColor(UIColor.defaultGray3)
                .font(.init(name: "Zapfino", size: 50))
                .fontSize(45)
                .padding(.leading, -20)
            Spacer()
        }
    }

let pdfFile = PDFFile.init(pages: page1)
let pdfData = pdfFile.body //<- Accessing PDF Body will trigger drawing Actions

struct MyAmazingPDF: View {
    
    
    var body: some View {
        PLHViewer {
            let page1 = 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)
                }
            }
            return PDFFile(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. 🌊

plhkit's People

Contributors

imostfa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.