Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit README #36

Merged
merged 1 commit into from
Jul 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Edit README
  • Loading branch information
sgr-ksmt committed Jul 18, 2016
commit cc2a4e454b9488ba82c74c23eef8ef772857db44
150 changes: 85 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,95 @@
<p align="center">
<a href="#features">Features</a> |
<a href="#requirements">Requirements</a> |
<a href="#installation">Installation</a> |
<a href="#usage">Usage</a> |
<a href="#communication">Communication</a> |
<a href="#license">LICENSE</a>
</p>

# PDFGenerator
[![Build Status](https://travis-ci.org/sgr-ksmt/PDFGenerator.svg?branch=master)](https://travis-ci.org/sgr-ksmt/PDFGenerator)
[![GitHub release](https://img.shields.io/github/release/sgr-ksmt/PDFGenerator.svg)](https://github.com/sgr-ksmt/PDFGenerator/releases)
[![Build Status](https://travis-ci.org/sgr-ksmt/PDFGenerator.svg?branch=master)](https://travis-ci.org/sgr-ksmt/PDFGenerator)
![Language](https://img.shields.io/badge/language-Swift%202.2-orange.svg)
![Language](https://img.shields.io/badge/language-Swift%202.2-orange.svg)
[![Carthage](https://img.shields.io/badge/Carthage-✓-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![CocoaPods](https://img.shields.io/badge/Cocoa%20Pods-✓-4BC51D.svg?style=flat)](https://cocoapods.org)
[![Swift Package Manager](https://img.shields.io/badge/Swift%20Package%20Manager-✓-brightgreen.svg)](https://github.com/apple/swift-package-manager)
[![Swift Package Manager](https://img.shields.io/badge/SPM-✓-brightgreen.svg)](https://github.com/apple/swift-package-manager)
`PDFGenerator` is a simple PDF generator that generates with `UIView`, `UIImage`, ...etc .

# PDFGenerator
A simple PDF generator.
Generate PDF from UIView/UIImage (single page or multiple page).
```swift
do {
let page: [PDFPage] = [
.WhitePage(CGSize(width: 200, height: 100)),
.Image(image1)
.Image(image2)
.ImagePath(lastPageImagePath)
.WhitePage(CGSize(width: 200,height: 100))
]
let path = NSHomeDirectory().stringByAppendingString("/sample1.pdf")
try PDFGenerator.generate(page, outputPath: path, password: "123456")
} catch let error{
print(error)
}
```

## Features
- Support multiple pages.
- Also generate PDF from:
- ImagePath : that can load image with `UIImage(contentsOfFile:)`
- Binary(`NSData`)
- ImageRef(`CGImage`)
- Type safe.
- Multiple pages support.
- Also generate PDF with `image path`, `image binary`, `image ref (CGImage)`
- Good memory management.
- Generate PDF from mixed-pages.
- If view is `UIScrollView`, `UITableView`, `UICollectionView`, `UIWebView`, drawn whole content.
- Outputs as `NSData` or writes to Disk(in given file path) directly.
- Corresponding to Error-Handling. Strange PDF has never been generated!!
- DPI support (v1.2.0~): Default dpi is 72.
- Password protection (v1.3.0~)
- UIScrollView support : If view is `UIScrollView`, `UITableView`, `UICollectionView`, `UIWebView`, drawn whole content.
- Outputs as binary(`NSData`) or writes to Disk(in given file path) directly.
- Corresponding to Error-Handling. Strange PDF has never been generated!!.
- DPI support. : Default dpi is 72.
- Password protection support.

## Requirements
- iOS 8.0+
- Xcode 7.0+(Swift 2.x)

## Installation

### For Swift 2.2, Swift2.3

#### Carthage

- Add the following to your *Cartfile*:

```bash
github 'sgr-ksmt/PDFGenerator' ~> 1.3.0
```

- Run command
- for Swift 2.2 : `carthage update`
- for Swift 2.3 : `carthage update --no-use-binaries`
- Add the framework as described.
<br> Details: [Carthage Readme](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)


#### CocoaPods

**PDFGenerator** is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'PDFGenerator', '~> 1.3.0'
```

and run `pod install`

### For Swift 3.0 beta
#### Carthage

```bash
github 'sgr-ksmt/PDFGenerator' 'swift-3.0'
```

#### CocoaPods

```ruby
pod 'PDFGenerator', :branch => 'swift-3.0'
```

Notice : This branch is beta yet. If you found a bug, please create issue. :bow:

## Usage

Expand Down Expand Up @@ -161,53 +228,6 @@ public enum PDFGenerateError: ErrorType {
```


## Requirements
- iOS 8.0+
- Xcode 7.0+(Swift 2.x)

## Installation (Swift 2.x)

### Carthage

- Add the following to your *Cartfile*:

```bash
github 'sgr-ksmt/PDFGenerator' ~> 1.3.0
```

- Run command
- for Swift 2.2 : `carthage update`
- for Swift 2.3 : `carthage update --no-use-binaries`
- Add the framework as described.
<br> Details: [Carthage Readme](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)


### CocoaPods

**PDFGenerator** is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'PDFGenerator', '~> 1.3.0'
```

and run `pod install`

## Installation (Swift 3.0 beta)
### Carthage

```bash
github 'sgr-ksmt/PDFGenerator' 'swift-3.0'
```

### CocoaPods

```ruby
pod 'PDFGenerator', :branch => 'swift-3.0'
```

Notice : This branch is beta yet. If you found a bug, please create issue. :bow:

## Communication
- If you found a bug, please open an issue. :bow:
- Also, if you have a feature request, please open an issue. :thumbsup:
Expand Down