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

Overview

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. 🌊
You might also like...
TPPDF is a simple-to-use PDF builder for iOS
TPPDF is a simple-to-use PDF builder for iOS

TPPDF is a fast PDF builder for iOS & macOS using simple commands to create advanced documents! Created and maintained by Philip Niedertscheider and a

UIImage PDF extensions.

UIImagePlusPDF UIImage extensions to use PDF files. Using UIImagePlusPDF you can avoid a lot png images files (1x, 2x, 3x sizes) and simply replace ea

Estrutura Simples para Navegacao Web e Download PDF

Download-PDF-WebView Projeto desenvolvido em Swift com a função de criar uma estrutura simples para navegação Web em seu Aplicativo, permitindo a visu

Small utility to import PDF slides as vector images into Keynote for iOS.
Small utility to import PDF slides as vector images into Keynote for iOS.

Small utility to import PDF files into Keynote for iOS. This utility is especially helpful when presenting slideshows created by LaTeX

TPPDF is a simple-to-use PDF builder for iOS
TPPDF is a simple-to-use PDF builder for iOS

TPPDF is a fast PDF builder for iOS & macOS using simple commands to create advanced documents! Created and maintained by Philip Niedertscheider and a

📚 A Swift ePub reader and parser framework for iOS.
📚 A Swift ePub reader and parser framework for iOS.

FolioReaderKit is an ePub reader and parser framework for iOS written in Swift. Features ePub 2 and ePub 3 support Custom Fonts Custom Text Size Text

A Static Library to be embedded on iOS applications to display pdf documents derived from Fast PDF

FastPdfKit This repository contains the FastPdfKit iOS library with some sample projects. FastPdfKit is a library that let you show pdf documents in i

MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift.

MusicKit MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift. Examples Functional harmony let C5 = Pitch(midi: 72

Swift package that uses WebKit to render PDF files from URLs

Swift package for generating a PDF file from a URL (rendered by WebKit)

Merges a given number of PDF files into one file using the PDFKit framework

Titanium iOS PDF Merge Merges a given number of PDF files into one file using the PDFKit framework Requirements iOS 11+ Titanium SDK 9+ API's Methods

Generate beautiful .pdf Files from xib

Description The Library generates a PDF directly from interface builder with Auto-layouted views! Swift Version of UIView_2_PDF. Installation Download

Package for creating, modifying, and managing subtitle files, such as SubRip (.srt).

SubtitleKit Package for creating, modifying, and managing subtitle files, such as SubRip (.srt). Supported formats Format File extension Is supported

SwiftXLSX - A library focused creating Excel spreadsheet (XLSX) files directly on mobile devices
SwiftXLSX - A library focused creating Excel spreadsheet (XLSX) files directly on mobile devices

SwiftXLSX Excel spreadsheet (XLSX) format writer on pure SWIFT. SwiftXLSX is a l

Markdown parsing and rendering for iOS and OS X
Markdown parsing and rendering for iOS and OS X

CocoaMarkdown Markdown parsing and rendering for iOS and macOS CocoaMarkdown is a cross-platform framework for parsing and rendering Markdown, built o

StyledTextKit is a declarative attributed string library for fast rendering and easy string building.
StyledTextKit is a declarative attributed string library for fast rendering and easy string building.

StyledTextKit is a declarative attributed string library for fast rendering and easy string building. It serves as a simple replacement to NSAttribute

iOS utility classes for asynchronous rendering and display.

YYAsyncLayer iOS utility classes for asynchronous rendering and display. (It was used by YYText) Simple Usage @interface YYLabel : UIView @property NS

Display and interact with SVG Images on iOS / OS X, using native rendering (CoreAnimation)

SVGKit SVGKit is a Cocoa framework for rendering SVG files natively: it's fast and powerful. Some additional info and links are on the wiki Versions:

Beautiful math equation rendering on iOS and MacOS
Beautiful math equation rendering on iOS and MacOS

iosMath iosMath is a library for displaying beautifully rendered math equations in iOS and MacOS applications. It typesets formulae written using the

Owner
null
Swift package that uses WebKit to render PDF files from URLs

Swift package for generating a PDF file from a URL (rendered by WebKit)

aaronland 1 Feb 25, 2022
Generate beautiful .pdf Files from xib

Description The Library generates a PDF directly from interface builder with Auto-layouted views! Swift Version of UIView_2_PDF. Installation Download

Simon C. Krüger 16 Dec 17, 2022
An iOS PDF viewer and annotator written in Swift that can be embedded into any application.

Requirements iOS 9 or above Xcode 8 or above Swift 3.0 Note This project is still in early stages. Right now the PDF reader works both programmaticall

UXM Studio 269 Dec 11, 2022
Mephisto - A command line tool to convert Comic Book Zip archives to PDF and share them over AirDrop

mephisto A command line tool written in Swift to convert Comic Book Zip archives

null 0 Feb 7, 2022
A simple generator of PDF written in Swift.

Features | Requirements | Installation | Usage | Communication | LICENSE PDFGenerator PDFGenerator is a simple PDF generator that generates with UIVie

Suguru Kishimoto 712 Dec 29, 2022
SimplePDF is a wrapper of UIGraphics PDF context written in Swift.

SimplePDF is a wrapper of UIGraphics PDF context written in Swift. You can: add texts, images, spaces and lines, table set up page layout, adjust cont

Nutchaphon Rewik 238 Dec 29, 2022
PdfBuilder: a swift library made to make creation of the Pdf file from code simpler

PdfBuilder PdfBuilder is a swift library made to make creation of the Pdf file f

null 4 Jul 22, 2022
Draw Week Time Table on PDF using PDFKit in iOS Swift

DrawPDFTimeTable Draw Week Time Table on PDF using PDFKit in iOS Swift. Image Info This is the pdf of time table drawn using PDFKit in iOS Swift with

Kushagra Chandra 6 Nov 22, 2022
PDF Reader Core for iOS

PDF Reader Core for iOS This project is no longer supported or maintained. It is only here for historical reasons. Please see the UXReader PDF Framewo

Julius Oklamcak 4.3k Jan 6, 2023
PDF generator using UIViews or UIViews with an associated XIB

Description Create UIView objects using any method you like, including interface builder with Auto-layout and size classes enabled. Then generate a PD

null 34 Dec 17, 2022