Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kayoslab/SwiftPDFGenerator
Generate beautiful .pdf Files from xib
https://github.com/kayoslab/SwiftPDFGenerator
Last synced: 6 days ago
JSON representation
Generate beautiful .pdf Files from xib
- Host: GitHub
- URL: https://github.com/kayoslab/SwiftPDFGenerator
- Owner: kayoslab
- License: mit
- Created: 2016-03-19T01:03:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-04-12T08:38:31.000Z (over 8 years ago)
- Last Synced: 2024-08-15T19:06:39.264Z (4 months ago)
- Language: Swift
- Size: 8.68 MB
- Stars: 17
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ios - SwiftPDFGenerator - PDF generator using UIViews; Swift Version of 'UIView 2 PDF'. (Media / PDF)
- awesome-ios-star - SwiftPDFGenerator - PDF generator using UIViews; Swift Version of 'UIView 2 PDF'. (Media / PDF)
README
## Description
The Library generates a PDF directly from interface builder with Auto-layouted views! Swift Version of [UIView_2_PDF](https://github.com/RobertAPhillips/UIView_2_PDF).## Installation
Download and drop ```SwiftPDFGenerator.swift``` in your project.## Usage
#### 1. Make a xib file.
Your xib file should only consist of UILabels and/or UIImageViews and/or other UIView subviews. Use views that are 1 pixel high or wide to create lines. Set the tag of a UIView to 1 to have it draw filled or zero to draw as just a 1 pixel bordered box.#### 2. Load your xib like this
```swift
let pageOneView = NSBundle.mainBundle().loadNibNamed("PageOneView", owner: self, options: nil).last as! PageOneView
let pageTwoView = NSBundle.mainBundle().loadNibNamed("PageTwoView", owner: self, options: nil).last as! PageTwoView
```#### 3. Then generate your PDF like this
```swift
let filePath = SwiftPDFGenerator.generatePDFWithPages(pages)
```See demo project for details.
## License
swift-pdf is released under the MIT license. See 'LICENCE.md' for details.