{"id":15066992,"url":"https://github.com/jrosen081/pdfdrawingview","last_synced_at":"2025-04-10T13:53:56.436Z","repository":{"id":56908756,"uuid":"142085860","full_name":"jrosen081/PDFDrawingView","owner":"jrosen081","description":"PDFDrawingView is a lightweight PDF Viewer that has built in functionality for drawing.","archived":false,"fork":false,"pushed_at":"2019-08-26T20:30:44.000Z","size":468,"stargazers_count":35,"open_issues_count":8,"forks_count":11,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-17T14:06:58.307Z","etag":null,"topics":["drawingview","drawpdf","ios11","pdf-viewer","swift4"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jrosen081.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-24T01:02:10.000Z","updated_at":"2023-12-28T00:24:33.000Z","dependencies_parsed_at":"2022-08-21T01:50:59.283Z","dependency_job_id":null,"html_url":"https://github.com/jrosen081/PDFDrawingView","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrosen081%2FPDFDrawingView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrosen081%2FPDFDrawingView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrosen081%2FPDFDrawingView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jrosen081%2FPDFDrawingView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jrosen081","download_url":"https://codeload.github.com/jrosen081/PDFDrawingView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248229288,"owners_count":21068869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drawingview","drawpdf","ios11","pdf-viewer","swift4"],"created_at":"2024-09-25T01:14:51.050Z","updated_at":"2025-04-10T13:53:56.413Z","avatar_url":"https://github.com/jrosen081.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PDFDrawingView\nPDFDrawingView is a lightweight PDF Viewer that has built in functionality for drawing.\n\n# How to Use:\n\n1. Create a PDF Document using PDFKit.\n2. Import using CocoaPods or download from here.\n* For CocoaPods, here is an example PodFile\n```\n# Uncomment the next line to define a global platform for your project\nplatform :ios, '11.0'\nsource \"https://github.com/jrosen081/PDFDrawingView.git\"\ntarget 'YOUR_TARGET_ID' do\n  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks\n  use_frameworks!\n\n  # Pods for drawSecure\n  pod 'DrawingPDF'\nend\n```\n3. Use the constructor method.\n```swift\nlet pdfDrawer = PDFDrawingView(frame: backgroundView.bounds, document: documentPDF, style: .vertical, delegate: self) //Creates an instance of the view with the PDF being displayed vertically\n```\nIt is that simple.\n\n## A \u003ca href = \"https://github.com/jrosen081/PDFDrawingView/tree/master/Sample%20Project\"\u003e  sample project \u003c/a\u003e is included  to show how to use the PDFDrawingView.\n# Features:\n1. Normal Drawing\n2. Highlighting\n3. Erasing\n4. Adding text boxes and being able to move and resize them.\n5. Moving different lines and zooming with the lasso tool.\n4. Apple Pencil compatible, with force changing the lines being drawn\n5. The PDF can be displayed either vertically or horizontally.\n6. Making a new PDF with the drawing on it.\n\n# Ways to choose the tool to use\n* There is a struct which has all of the options.\n```swift \npublic struct DrawingKeys{\n        public static let draw = \"draw\"\n        public static let scroll = \"scroll\"\n        public static let highlight = \"highlight\"\n        public static let text = \"text\"\n        public static let erase = \"erase\"\n        public static let lasso = \"lasso\"\n    }\n```    \n* Here is how to tell the view what to do\n```swift\npdfDrawer.drawingKey = PDFDrawingView.DrawingKeys.draw //Will have the view draw\n```\n* To change the color of drawing and highlighting, do the following:\n```swift\npdfDrawer.drawingColor = UIColor.red //Changes the drawing color to red\npdfDrawer.highlightColor = UIColor.yellow //Changes the highlight color to yellow\n```\n# How to decide the display of the PDF\n* There is an enum that has the options\n```swift\npublic enum DrawingStyle {\n\tcase vertical\n\tcase horizontal\n}\n```\n* Pass in the style into the constructor.\n* It displays the PDF vertically by default if you do not give it a value\n# How to create a new PDF with the drawing\n* There is a method in PDFDrawingView that will return the data for the PDF\n```swift\nlet pdfData = self.pdfDrawer.createPDF()\n```\n* If you then want to save it locally, use the built-in method for PDFDocuments\n```swift\nlet updatedDocument = PDFDocument(data: pdfData)\nupdatedDocument?.write(to: \"SAMPLE_PATH\")\n```\n# Implement the delegate protocol for more information about the PDFDrawingView\n## The delegate tells you when:\n1. The page has changed\n2. The view was created\n```swift\nextension DrawViewController: PDFDelegate{\n    func scrolled(to page: Int) {\n        self.currentPageNumber = page\n    }\n    \n    func viewWasCreated() {\n        doSomething()\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrosen081%2Fpdfdrawingview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjrosen081%2Fpdfdrawingview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjrosen081%2Fpdfdrawingview/lists"}