Coder Social home page Coder Social logo

ilpdfkit's Introduction

ILPDFKit Logo

CI Status Version Carthage compatible Swift License Platform

A simple, minimalist toolkit for filling out PDF forms, and extracting PDF data in iOS, that extends WKWebView and the CoreGraphics PDF C API.

screenshot

Features

  • Parse and analyze PDF documents with easy API.
  • Fill out and save PDF AcroForms to a flat non-editable PDF.
  • Handle text, button and combo fields.
  • Easy introspection using PDFDocument, PDFPage, PDFDictionary and PDFArray.
  • Rapidly, parse, extract and analyze PDF document structure, data and properties.
  • Handle signature fields.
  • Save AcroForm values to the original, editable PDF.
  • Comprehensive Unit and Integration Test Coverage
  • Swift Documentation

Requirements

  • iOS 9.0+
  • Xcode 9.1+
  • Swift 4.0+

Installation

Cocoapods

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod ILPDFKit
end  

Then, run the following command: pod install

Carthage

To integrate ILPDFKit into your Xcode project using Carthage, specify it in your Cartfile:

github "derekblair/ILPDFKit"

Run carthage update to build the framework and drag the built ILPDFKit.framework into your Xcode project.

Quick Start

The quickest way to get started with ILPDFKit is to take a look at the included sample app. For example, to view a PDF form resource named 'test.pdf' you can do the following:

let document = ILPDFDocument(resource:"myPDF")
// Manually set a form value
document.forms.setValue("Derek", forFormWithName: "Contacts.FirstName")
// Save via a static PDF.
let flatPDF = document.savedStaticPDFData()

PDF Support

ILPDFKit currently supports a narrow range of PDF versions and is not suitable for a production app that needs to save general PDF files from versions 1.3 to 1.7

PDF features that cause issues with saving include:

  1. Linearized PDF files (Linearization is broken after save. File will open correctly using WKWebView, Preview, and Chrome but Adobe reader fails)

  2. Object Streams (This library can not currently save fields stored in object streams, introduced in PDF 1.5 , files that use object streams are sometimes referred to as compressed files as object streams can compress PDF objects in the file).

Usage

Filling Out Forms

pdfViewController = ILPDFViewController(resource:"test.pdf")
window.rootViewController = pdfViewController
// Have fun filling out the form.

Getting/Setting Form Values Explicitly

for form in pdfViewController.document.forms {
	// Get
	let formValue = form.value;
	let formName = form.name; // Fully qualified field name.
	// Set
	form.value = "foo";
	
	// If the form is visible on screen it will updated automatically.
	// You can access the actual associated widget annotation view as below.
	// let widgetView = form.associatedWidget()
}

Custom Styling of Form Fields

All fields are easily custom styled.

Donate

Donations are greatly appreciated and assist with the development of ILPDFKit.

Contact

[email protected]

License

(The MIT License)

Copyright (c) 2018 Derek Blair <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ilpdfkit's People

Contributors

derekblair avatar wes-nz avatar apontious-gl avatar peterp avatar readmecritic avatar

Watchers

James Cloos avatar Mahmut Pinarbasi 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.