All Projects → jrosen081 → Pdfdrawingview

jrosen081 / Pdfdrawingview

Licence: mit
PDFDrawingView is a lightweight PDF Viewer that has built in functionality for drawing.

Programming Languages

swift
15916 projects
swift4
162 projects

Projects that are alternatives of or similar to Pdfdrawingview

Pdfh5
web/h5/移动端PDF预览插件
Stars: ✭ 423 (+2388.24%)
Mutual labels:  pdf-viewer
Ios Nfc Example
📱 Example showing how to use the Core NFC API in iOS
Stars: ✭ 480 (+2723.53%)
Mutual labels:  ios11
Arpaint
Draw with bare fingers in the air using ARKit
Stars: ✭ 672 (+3852.94%)
Mutual labels:  ios11
React Pdf Highlighter
Set of React components for PDF annotation
Stars: ✭ 448 (+2535.29%)
Mutual labels:  pdf-viewer
Pdf2htmlex
Convert PDF to HTML without losing text or format.
Stars: ✭ 472 (+2676.47%)
Mutual labels:  pdf-viewer
React Pdf Js
A React component to wrap PDF.js
Stars: ✭ 489 (+2776.47%)
Mutual labels:  pdf-viewer
Document Viewer
Document Viewer is a highly customizable document viewer for Android.
Stars: ✭ 415 (+2341.18%)
Mutual labels:  pdf-viewer
Sumatrapdf
SumatraPDF reader
Stars: ✭ 7,462 (+43794.12%)
Mutual labels:  pdf-viewer
Facecropper
✂️ Crop faces, inside of your image, with iOS 11 Vision api.
Stars: ✭ 479 (+2717.65%)
Mutual labels:  ios11
Awesome Coreml Models
Largest list of models for Core ML (for iOS 11+)
Stars: ✭ 5,192 (+30441.18%)
Mutual labels:  ios11
Pympress
Pympress is a simple yet powerful PDF reader designed for dual-screen presentations
Stars: ✭ 450 (+2547.06%)
Mutual labels:  pdf-viewer
React Pdf
Display PDFs in your React app as easily as if they were images.
Stars: ✭ 5,320 (+31194.12%)
Mutual labels:  pdf-viewer
Awesome Coreml Models
Collection of models for Core ML
Stars: ✭ 500 (+2841.18%)
Mutual labels:  ios11
Pdfvuer
A PDF viewer for Vue using Mozilla's PDF.js
Stars: ✭ 443 (+2505.88%)
Mutual labels:  pdf-viewer
Swiftmessages
A very flexible message bar for iOS written in Swift.
Stars: ✭ 6,363 (+37329.41%)
Mutual labels:  ios11
Cards
Awesome iOS 11 appstore cards in swift 5.
Stars: ✭ 4,017 (+23529.41%)
Mutual labels:  ios11
Safariautologintest
A demo showing how you can auto-login users to an iOS app using SafariViewController (on iOS 9) and SFAuthenticationSession (on iOS 11)
Stars: ✭ 480 (+2723.53%)
Mutual labels:  ios11
Arshooter
A demo Augmented Reality shooter made with ARKit in Swift (iOS 11)
Stars: ✭ 794 (+4570.59%)
Mutual labels:  ios11
Awesome Ios Interview
📲 The curated list of iOS Developer interview questions and answers, Swift & Objective-C
Stars: ✭ 753 (+4329.41%)
Mutual labels:  ios11
Hapticbutton
A button that is triggered based on the 3D Touch pressure, similar to the iOS 11 control center.
Stars: ✭ 501 (+2847.06%)
Mutual labels:  ios11

PDFDrawingView

PDFDrawingView is a lightweight PDF Viewer that has built in functionality for drawing.

How to Use:

  1. Create a PDF Document using PDFKit.
  2. Import using CocoaPods or download from here.
  • For CocoaPods, here is an example PodFile
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
source "https://github.com/jrosen081/PDFDrawingView.git"
target 'YOUR_TARGET_ID' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for drawSecure
  pod 'DrawingPDF'
end
  1. Use the constructor method.
let pdfDrawer = PDFDrawingView(frame: backgroundView.bounds, document: documentPDF, style: .vertical, delegate: self) //Creates an instance of the view with the PDF being displayed vertically

It is that simple.

A sample project is included to show how to use the PDFDrawingView.

Features:

  1. Normal Drawing
  2. Highlighting
  3. Erasing
  4. Adding text boxes and being able to move and resize them.
  5. Moving different lines and zooming with the lasso tool.
  6. Apple Pencil compatible, with force changing the lines being drawn
  7. The PDF can be displayed either vertically or horizontally.
  8. Making a new PDF with the drawing on it.

Ways to choose the tool to use

  • There is a struct which has all of the options.
public struct DrawingKeys{
        public static let draw = "draw"
        public static let scroll = "scroll"
        public static let highlight = "highlight"
        public static let text = "text"
        public static let erase = "erase"
        public static let lasso = "lasso"
    }
  • Here is how to tell the view what to do
pdfDrawer.drawingKey = PDFDrawingView.DrawingKeys.draw //Will have the view draw
  • To change the color of drawing and highlighting, do the following:
pdfDrawer.drawingColor = UIColor.red //Changes the drawing color to red
pdfDrawer.highlightColor = UIColor.yellow //Changes the highlight color to yellow

How to decide the display of the PDF

  • There is an enum that has the options
public enum DrawingStyle {
	case vertical
	case horizontal
}
  • Pass in the style into the constructor.
  • It displays the PDF vertically by default if you do not give it a value

How to create a new PDF with the drawing

  • There is a method in PDFDrawingView that will return the data for the PDF
let pdfData = self.pdfDrawer.createPDF()
  • If you then want to save it locally, use the built-in method for PDFDocuments
let updatedDocument = PDFDocument(data: pdfData)
updatedDocument?.write(to: "SAMPLE_PATH")

Implement the delegate protocol for more information about the PDFDrawingView

The delegate tells you when:

  1. The page has changed
  2. The view was created
extension DrawViewController: PDFDelegate{
    func scrolled(to page: Int) {
        self.currentPageNumber = page
    }
    
    func viewWasCreated() {
        doSomething()
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].