├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── Example ├── OHPDFImageDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── OHPDFImageDemo.xcscheme ├── OHPDFImageDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── WorkspaceSettings.xcsettings ├── OHPDFImageDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── check.pdf │ │ ├── circle.pdf │ │ ├── dingbats.pdf │ │ └── dotmask.pdf │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── Podfile ├── Podfile.lock ├── Pods │ ├── Headers │ │ ├── Private │ │ │ └── OHPDFImage │ │ │ │ ├── OHPDFDocument.h │ │ │ │ ├── OHPDFImage.h │ │ │ │ ├── OHPDFPage.h │ │ │ │ ├── OHVectorImage.h │ │ │ │ └── UIImage+OHPDF.h │ │ └── Public │ │ │ └── OHPDFImage │ │ │ ├── OHPDFDocument.h │ │ │ ├── OHPDFImage.h │ │ │ ├── OHPDFPage.h │ │ │ ├── OHVectorImage.h │ │ │ └── UIImage+OHPDF.h │ ├── Local Podspecs │ │ └── OHPDFImage.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ └── Target Support Files │ │ ├── Pods-OHPDFImage │ │ ├── Pods-OHPDFImage-Private.xcconfig │ │ ├── Pods-OHPDFImage-dummy.m │ │ ├── Pods-OHPDFImage-prefix.pch │ │ └── Pods-OHPDFImage.xcconfig │ │ └── Pods │ │ ├── Pods-acknowledgements.markdown │ │ ├── Pods-acknowledgements.plist │ │ ├── Pods-dummy.m │ │ ├── Pods-environment.h │ │ ├── Pods-resources.sh │ │ ├── Pods.debug.xcconfig │ │ └── Pods.release.xcconfig └── UnitTests │ ├── Info.plist │ └── OHPDFImageTests.m ├── LICENSE ├── OHPDFImage.podspec ├── OHPDFImage ├── OHPDFDocument.h ├── OHPDFDocument.m ├── OHPDFImage.h ├── OHPDFPage.h ├── OHPDFPage.m ├── OHVectorImage.h ├── OHVectorImage.m ├── UIImage+OHPDF.h └── UIImage+OHPDF.m └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build/* 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | profile 13 | *.moved-aside 14 | .DS_Store 15 | *.xccheckout 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | sudo: false 3 | 4 | before_install: 5 | - gem install xcpretty --no-rdoc --no-ri --no-document --quiet 6 | 7 | script: 8 | - set -o pipefail && xcodebuild -workspace Example/OHPDFImageDemo.xcworkspace -scheme "OHPDFImageDemo" -sdk iphonesimulator -configuration Release ONLY_ACTIVE_ARCH=NO test | xcpretty -c 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## 3.2.1 4 | 5 | * Fixed issue with `OHVectorImage.insets` not interpreted properly when no `tintColor` was set (and thus no intermediate drawing was done in a flipped context) 6 | 7 | ## 3.2.0 8 | 9 | * Added `OHPDFDocument` constructor `documentWithData:` ([@colasjojo](https://github.com/colasjojo), [#8](https://github.com/AliSoftware/OHPDFImage/pull/8)) 10 | 11 | ## 3.1.3 12 | 13 | * Fixed issue when trying to render image at empty size (zero-width and/or zero-height size). 14 | Now returns a `nil` image in such cases. ([@colasjojo](https://github.com/colasjojo), [#7](https://github.com/AliSoftware/OHPDFImage/pull/7)) 15 | 16 | ## 3.1.2 17 | 18 | * Fixed rendering algorithm to avoid seeing the original image borders when using tintColor + shadow ([#3](https://github.com/AliSoftware/OHPDFImage/issues/3)) 19 | 20 | ## 3.1.1 21 | 22 | * Added compatiblity for people still building with Xcode 5 / SDK 7 23 | _(`NS_DESIGNATED_INITIALIZER` was not yet defined back then)_ 24 | 25 | ## 3.1.0 26 | 27 | * Added `-renderAtSizeThatFits:` convenience method, as this is a common use case. ([@colasjojo](https://github.com/colasjojo), [#1](https://github.com/AliSoftware/OHPDFImage/pull/1)) 28 | * Added `-scaleForSize:` method (was private, exposed publicly). 29 | * Fixed issue when using a translucent `backgroundColor` (like `[UIColor clearColor]`) ([#2](https://github.com/AliSoftware/OHPDFImage/issues/2)) 30 | _(`backgroundColor != nil` generated an opaque image)_ 31 | * Fixed subpixelling issue when rendering. (#2) 32 | _(`CGSize` with non-integral dimensions did generate blurry edges especially visible when using a `tintColor`)_ 33 | * Improved documentation 34 | 35 | ## 3.0.1 36 | 37 | * Fixed an issue when passing `nil` to `OHVectorImage` initializers 38 | 39 | ## 3.0.0 40 | 41 | * Added `shadow` and `insets` properties to `OHVectorImage` 42 | * Renamed `imageWithSize:` to `renderAtSize:` _(to clarify API and avoid confusion with convenience initializers)_ 43 | * Refactor the code used to tint the image rendering _(to avoid tinting the shadow itself)_ 44 | * Added `` conformance to `OHVectorImage` 45 | * Using `NS_DESIGNATED_INITIALIZER` 46 | * Improved documentation 47 | 48 | ## 2.0.1 49 | 50 | * Code cleaning & reducing magic numbers in code. 51 | 52 | ## 2.0.0 53 | 54 | * New API: Introducting `OHVectorImage` with `backgroundColor` and `tintColor` properties to customize the rendering. 55 | 56 | ## 1.0.0 57 | 58 | * Initial version with basic API : `OHPDFDocument`, `OHPDFPage` and a `UIImage` category. 59 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 09027B3C1A3CA71B007625B7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 09027B3B1A3CA71B007625B7 /* main.m */; }; 11 | 09027B3F1A3CA71B007625B7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 09027B3E1A3CA71B007625B7 /* AppDelegate.m */; }; 12 | 09027B421A3CA71B007625B7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09027B411A3CA71B007625B7 /* ViewController.m */; }; 13 | 09027B451A3CA71B007625B7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 09027B431A3CA71B007625B7 /* Main.storyboard */; }; 14 | 09027B471A3CA71B007625B7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 09027B461A3CA71B007625B7 /* Images.xcassets */; }; 15 | 09027B4A1A3CA71B007625B7 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 09027B481A3CA71B007625B7 /* LaunchScreen.xib */; }; 16 | 09027B561A3CA71B007625B7 /* OHPDFImageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 09027B551A3CA71B007625B7 /* OHPDFImageTests.m */; }; 17 | 097F6F5B1A3CB9FE00F1FE65 /* check.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 097F6F5A1A3CB9FE00F1FE65 /* check.pdf */; }; 18 | 097F6F5E1A3CDC8F00F1FE65 /* circle.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 097F6F5D1A3CDC8F00F1FE65 /* circle.pdf */; }; 19 | 097F6F601A3CE07E00F1FE65 /* dingbats.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 097F6F5F1A3CE07E00F1FE65 /* dingbats.pdf */; }; 20 | 097F6F661A3DDC4200F1FE65 /* dotmask.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 097F6F651A3DDC4200F1FE65 /* dotmask.pdf */; }; 21 | C71835FB7F0DBB7CFA3232F1 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 80A26BDC6D04530DAB526FEB /* libPods.a */; }; 22 | DBA750C40A9CC0BBD7140D6E /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 80A26BDC6D04530DAB526FEB /* libPods.a */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 09027B501A3CA71B007625B7 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 09027B2E1A3CA71B007625B7 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 09027B351A3CA71B007625B7; 31 | remoteInfo = OHPDFImageDemo; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 09027B361A3CA71B007625B7 /* OHPDFImageDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OHPDFImageDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 09027B3A1A3CA71B007625B7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | 09027B3B1A3CA71B007625B7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 39 | 09027B3D1A3CA71B007625B7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 40 | 09027B3E1A3CA71B007625B7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 41 | 09027B401A3CA71B007625B7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 42 | 09027B411A3CA71B007625B7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 43 | 09027B441A3CA71B007625B7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 09027B461A3CA71B007625B7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 45 | 09027B491A3CA71B007625B7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 46 | 09027B4F1A3CA71B007625B7 /* UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 09027B541A3CA71B007625B7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 09027B551A3CA71B007625B7 /* OHPDFImageTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OHPDFImageTests.m; sourceTree = ""; }; 49 | 097F6F5A1A3CB9FE00F1FE65 /* check.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = check.pdf; sourceTree = ""; }; 50 | 097F6F5D1A3CDC8F00F1FE65 /* circle.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = circle.pdf; sourceTree = ""; }; 51 | 097F6F5F1A3CE07E00F1FE65 /* dingbats.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = dingbats.pdf; sourceTree = ""; }; 52 | 097F6F651A3DDC4200F1FE65 /* dotmask.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = dotmask.pdf; sourceTree = ""; }; 53 | 0D8CEE072ADB3E3A9BBD09AA /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 54 | 80A26BDC6D04530DAB526FEB /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 8E1E3125F2235BE421751BA1 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 09027B331A3CA71B007625B7 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | C71835FB7F0DBB7CFA3232F1 /* libPods.a in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 09027B4C1A3CA71B007625B7 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | DBA750C40A9CC0BBD7140D6E /* libPods.a in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXFrameworksBuildPhase section */ 76 | 77 | /* Begin PBXGroup section */ 78 | 09027B2D1A3CA71B007625B7 = { 79 | isa = PBXGroup; 80 | children = ( 81 | 09027B381A3CA71B007625B7 /* OHPDFImageDemo */, 82 | 09027B521A3CA71B007625B7 /* UnitTests */, 83 | 09027B371A3CA71B007625B7 /* Products */, 84 | FA1629E08FB0BD132FCC4EC4 /* Pods */, 85 | E2733B61B82C0C1B5F35805C /* Frameworks */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | 09027B371A3CA71B007625B7 /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 09027B361A3CA71B007625B7 /* OHPDFImageDemo.app */, 93 | 09027B4F1A3CA71B007625B7 /* UnitTests.xctest */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 09027B381A3CA71B007625B7 /* OHPDFImageDemo */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 09027B3D1A3CA71B007625B7 /* AppDelegate.h */, 102 | 09027B3E1A3CA71B007625B7 /* AppDelegate.m */, 103 | 09027B431A3CA71B007625B7 /* Main.storyboard */, 104 | 09027B401A3CA71B007625B7 /* ViewController.h */, 105 | 09027B411A3CA71B007625B7 /* ViewController.m */, 106 | 097F6F5C1A3CBA1B00F1FE65 /* Assets */, 107 | 09027B391A3CA71B007625B7 /* Supporting Files */, 108 | ); 109 | path = OHPDFImageDemo; 110 | sourceTree = ""; 111 | }; 112 | 09027B391A3CA71B007625B7 /* Supporting Files */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 09027B3A1A3CA71B007625B7 /* Info.plist */, 116 | 09027B3B1A3CA71B007625B7 /* main.m */, 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | 09027B521A3CA71B007625B7 /* UnitTests */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 09027B551A3CA71B007625B7 /* OHPDFImageTests.m */, 125 | 09027B531A3CA71B007625B7 /* Supporting Files */, 126 | ); 127 | path = UnitTests; 128 | sourceTree = ""; 129 | }; 130 | 09027B531A3CA71B007625B7 /* Supporting Files */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 09027B541A3CA71B007625B7 /* Info.plist */, 134 | ); 135 | name = "Supporting Files"; 136 | sourceTree = ""; 137 | }; 138 | 097F6F5C1A3CBA1B00F1FE65 /* Assets */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 097F6F5D1A3CDC8F00F1FE65 /* circle.pdf */, 142 | 097F6F5A1A3CB9FE00F1FE65 /* check.pdf */, 143 | 097F6F5F1A3CE07E00F1FE65 /* dingbats.pdf */, 144 | 097F6F651A3DDC4200F1FE65 /* dotmask.pdf */, 145 | 09027B461A3CA71B007625B7 /* Images.xcassets */, 146 | 09027B481A3CA71B007625B7 /* LaunchScreen.xib */, 147 | ); 148 | path = Assets; 149 | sourceTree = ""; 150 | }; 151 | E2733B61B82C0C1B5F35805C /* Frameworks */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 80A26BDC6D04530DAB526FEB /* libPods.a */, 155 | ); 156 | name = Frameworks; 157 | sourceTree = ""; 158 | }; 159 | FA1629E08FB0BD132FCC4EC4 /* Pods */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 0D8CEE072ADB3E3A9BBD09AA /* Pods.debug.xcconfig */, 163 | 8E1E3125F2235BE421751BA1 /* Pods.release.xcconfig */, 164 | ); 165 | name = Pods; 166 | sourceTree = ""; 167 | }; 168 | /* End PBXGroup section */ 169 | 170 | /* Begin PBXNativeTarget section */ 171 | 09027B351A3CA71B007625B7 /* OHPDFImageDemo */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = 09027B591A3CA71B007625B7 /* Build configuration list for PBXNativeTarget "OHPDFImageDemo" */; 174 | buildPhases = ( 175 | 910555089866BB849C16EEF5 /* Check Pods Manifest.lock */, 176 | 09027B321A3CA71B007625B7 /* Sources */, 177 | 09027B331A3CA71B007625B7 /* Frameworks */, 178 | 09027B341A3CA71B007625B7 /* Resources */, 179 | 815ED9B4C91A5A26359B9E82 /* Copy Pods Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = OHPDFImageDemo; 186 | productName = OHPDFImageDemo; 187 | productReference = 09027B361A3CA71B007625B7 /* OHPDFImageDemo.app */; 188 | productType = "com.apple.product-type.application"; 189 | }; 190 | 09027B4E1A3CA71B007625B7 /* UnitTests */ = { 191 | isa = PBXNativeTarget; 192 | buildConfigurationList = 09027B5C1A3CA71B007625B7 /* Build configuration list for PBXNativeTarget "UnitTests" */; 193 | buildPhases = ( 194 | F33A480F755FF22ED384B045 /* Check Pods Manifest.lock */, 195 | 09027B4B1A3CA71B007625B7 /* Sources */, 196 | 09027B4C1A3CA71B007625B7 /* Frameworks */, 197 | 09027B4D1A3CA71B007625B7 /* Resources */, 198 | A388475341941FDEF9853422 /* Copy Pods Resources */, 199 | ); 200 | buildRules = ( 201 | ); 202 | dependencies = ( 203 | 09027B511A3CA71B007625B7 /* PBXTargetDependency */, 204 | ); 205 | name = UnitTests; 206 | productName = OHPDFImageDemoTests; 207 | productReference = 09027B4F1A3CA71B007625B7 /* UnitTests.xctest */; 208 | productType = "com.apple.product-type.bundle.unit-test"; 209 | }; 210 | /* End PBXNativeTarget section */ 211 | 212 | /* Begin PBXProject section */ 213 | 09027B2E1A3CA71B007625B7 /* Project object */ = { 214 | isa = PBXProject; 215 | attributes = { 216 | LastUpgradeCheck = 0610; 217 | ORGANIZATIONNAME = AliSoftware; 218 | TargetAttributes = { 219 | 09027B351A3CA71B007625B7 = { 220 | CreatedOnToolsVersion = 6.1; 221 | }; 222 | 09027B4E1A3CA71B007625B7 = { 223 | CreatedOnToolsVersion = 6.1; 224 | }; 225 | }; 226 | }; 227 | buildConfigurationList = 09027B311A3CA71B007625B7 /* Build configuration list for PBXProject "OHPDFImageDemo" */; 228 | compatibilityVersion = "Xcode 3.2"; 229 | developmentRegion = English; 230 | hasScannedForEncodings = 0; 231 | knownRegions = ( 232 | en, 233 | Base, 234 | ); 235 | mainGroup = 09027B2D1A3CA71B007625B7; 236 | productRefGroup = 09027B371A3CA71B007625B7 /* Products */; 237 | projectDirPath = ""; 238 | projectRoot = ""; 239 | targets = ( 240 | 09027B351A3CA71B007625B7 /* OHPDFImageDemo */, 241 | 09027B4E1A3CA71B007625B7 /* UnitTests */, 242 | ); 243 | }; 244 | /* End PBXProject section */ 245 | 246 | /* Begin PBXResourcesBuildPhase section */ 247 | 09027B341A3CA71B007625B7 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | 09027B451A3CA71B007625B7 /* Main.storyboard in Resources */, 252 | 09027B4A1A3CA71B007625B7 /* LaunchScreen.xib in Resources */, 253 | 097F6F661A3DDC4200F1FE65 /* dotmask.pdf in Resources */, 254 | 097F6F5E1A3CDC8F00F1FE65 /* circle.pdf in Resources */, 255 | 09027B471A3CA71B007625B7 /* Images.xcassets in Resources */, 256 | 097F6F601A3CE07E00F1FE65 /* dingbats.pdf in Resources */, 257 | 097F6F5B1A3CB9FE00F1FE65 /* check.pdf in Resources */, 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | 09027B4D1A3CA71B007625B7 /* Resources */ = { 262 | isa = PBXResourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | /* End PBXResourcesBuildPhase section */ 269 | 270 | /* Begin PBXShellScriptBuildPhase section */ 271 | 815ED9B4C91A5A26359B9E82 /* Copy Pods Resources */ = { 272 | isa = PBXShellScriptBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | ); 276 | inputPaths = ( 277 | ); 278 | name = "Copy Pods Resources"; 279 | outputPaths = ( 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | shellPath = /bin/sh; 283 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 284 | showEnvVarsInLog = 0; 285 | }; 286 | 910555089866BB849C16EEF5 /* Check Pods Manifest.lock */ = { 287 | isa = PBXShellScriptBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | ); 291 | inputPaths = ( 292 | ); 293 | name = "Check Pods Manifest.lock"; 294 | outputPaths = ( 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | shellPath = /bin/sh; 298 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 299 | showEnvVarsInLog = 0; 300 | }; 301 | A388475341941FDEF9853422 /* Copy Pods Resources */ = { 302 | isa = PBXShellScriptBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | ); 306 | inputPaths = ( 307 | ); 308 | name = "Copy Pods Resources"; 309 | outputPaths = ( 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | shellPath = /bin/sh; 313 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 314 | showEnvVarsInLog = 0; 315 | }; 316 | F33A480F755FF22ED384B045 /* Check Pods Manifest.lock */ = { 317 | isa = PBXShellScriptBuildPhase; 318 | buildActionMask = 2147483647; 319 | files = ( 320 | ); 321 | inputPaths = ( 322 | ); 323 | name = "Check Pods Manifest.lock"; 324 | outputPaths = ( 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | shellPath = /bin/sh; 328 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 329 | showEnvVarsInLog = 0; 330 | }; 331 | /* End PBXShellScriptBuildPhase section */ 332 | 333 | /* Begin PBXSourcesBuildPhase section */ 334 | 09027B321A3CA71B007625B7 /* Sources */ = { 335 | isa = PBXSourcesBuildPhase; 336 | buildActionMask = 2147483647; 337 | files = ( 338 | 09027B421A3CA71B007625B7 /* ViewController.m in Sources */, 339 | 09027B3F1A3CA71B007625B7 /* AppDelegate.m in Sources */, 340 | 09027B3C1A3CA71B007625B7 /* main.m in Sources */, 341 | ); 342 | runOnlyForDeploymentPostprocessing = 0; 343 | }; 344 | 09027B4B1A3CA71B007625B7 /* Sources */ = { 345 | isa = PBXSourcesBuildPhase; 346 | buildActionMask = 2147483647; 347 | files = ( 348 | 09027B561A3CA71B007625B7 /* OHPDFImageTests.m in Sources */, 349 | ); 350 | runOnlyForDeploymentPostprocessing = 0; 351 | }; 352 | /* End PBXSourcesBuildPhase section */ 353 | 354 | /* Begin PBXTargetDependency section */ 355 | 09027B511A3CA71B007625B7 /* PBXTargetDependency */ = { 356 | isa = PBXTargetDependency; 357 | target = 09027B351A3CA71B007625B7 /* OHPDFImageDemo */; 358 | targetProxy = 09027B501A3CA71B007625B7 /* PBXContainerItemProxy */; 359 | }; 360 | /* End PBXTargetDependency section */ 361 | 362 | /* Begin PBXVariantGroup section */ 363 | 09027B431A3CA71B007625B7 /* Main.storyboard */ = { 364 | isa = PBXVariantGroup; 365 | children = ( 366 | 09027B441A3CA71B007625B7 /* Base */, 367 | ); 368 | name = Main.storyboard; 369 | sourceTree = ""; 370 | }; 371 | 09027B481A3CA71B007625B7 /* LaunchScreen.xib */ = { 372 | isa = PBXVariantGroup; 373 | children = ( 374 | 09027B491A3CA71B007625B7 /* Base */, 375 | ); 376 | name = LaunchScreen.xib; 377 | path = ..; 378 | sourceTree = ""; 379 | }; 380 | /* End PBXVariantGroup section */ 381 | 382 | /* Begin XCBuildConfiguration section */ 383 | 09027B571A3CA71B007625B7 /* Debug */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 388 | CLANG_CXX_LIBRARY = "libc++"; 389 | CLANG_ENABLE_MODULES = YES; 390 | CLANG_ENABLE_OBJC_ARC = YES; 391 | CLANG_WARN_BOOL_CONVERSION = YES; 392 | CLANG_WARN_CONSTANT_CONVERSION = YES; 393 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 394 | CLANG_WARN_EMPTY_BODY = YES; 395 | CLANG_WARN_ENUM_CONVERSION = YES; 396 | CLANG_WARN_INT_CONVERSION = YES; 397 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 398 | CLANG_WARN_UNREACHABLE_CODE = YES; 399 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 400 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 401 | COPY_PHASE_STRIP = NO; 402 | ENABLE_STRICT_OBJC_MSGSEND = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_DYNAMIC_NO_PIC = NO; 405 | GCC_OPTIMIZATION_LEVEL = 0; 406 | GCC_PREPROCESSOR_DEFINITIONS = ( 407 | "DEBUG=1", 408 | "$(inherited)", 409 | ); 410 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | TARGETED_DEVICE_FAMILY = 2; 422 | }; 423 | name = Debug; 424 | }; 425 | 09027B581A3CA71B007625B7 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 430 | CLANG_CXX_LIBRARY = "libc++"; 431 | CLANG_ENABLE_MODULES = YES; 432 | CLANG_ENABLE_OBJC_ARC = YES; 433 | CLANG_WARN_BOOL_CONVERSION = YES; 434 | CLANG_WARN_CONSTANT_CONVERSION = YES; 435 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 436 | CLANG_WARN_EMPTY_BODY = YES; 437 | CLANG_WARN_ENUM_CONVERSION = YES; 438 | CLANG_WARN_INT_CONVERSION = YES; 439 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 440 | CLANG_WARN_UNREACHABLE_CODE = YES; 441 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 442 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 443 | COPY_PHASE_STRIP = YES; 444 | ENABLE_NS_ASSERTIONS = NO; 445 | ENABLE_STRICT_OBJC_MSGSEND = YES; 446 | GCC_C_LANGUAGE_STANDARD = gnu99; 447 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 448 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 449 | GCC_WARN_UNDECLARED_SELECTOR = YES; 450 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 451 | GCC_WARN_UNUSED_FUNCTION = YES; 452 | GCC_WARN_UNUSED_VARIABLE = YES; 453 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 454 | MTL_ENABLE_DEBUG_INFO = NO; 455 | SDKROOT = iphoneos; 456 | TARGETED_DEVICE_FAMILY = 2; 457 | VALIDATE_PRODUCT = YES; 458 | }; 459 | name = Release; 460 | }; 461 | 09027B5A1A3CA71B007625B7 /* Debug */ = { 462 | isa = XCBuildConfiguration; 463 | baseConfigurationReference = 0D8CEE072ADB3E3A9BBD09AA /* Pods.debug.xcconfig */; 464 | buildSettings = { 465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 466 | INFOPLIST_FILE = OHPDFImageDemo/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | }; 470 | name = Debug; 471 | }; 472 | 09027B5B1A3CA71B007625B7 /* Release */ = { 473 | isa = XCBuildConfiguration; 474 | baseConfigurationReference = 8E1E3125F2235BE421751BA1 /* Pods.release.xcconfig */; 475 | buildSettings = { 476 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 477 | INFOPLIST_FILE = OHPDFImageDemo/Info.plist; 478 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | }; 481 | name = Release; 482 | }; 483 | 09027B5D1A3CA71B007625B7 /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | baseConfigurationReference = 0D8CEE072ADB3E3A9BBD09AA /* Pods.debug.xcconfig */; 486 | buildSettings = { 487 | FRAMEWORK_SEARCH_PATHS = ( 488 | "$(SDKROOT)/Developer/Library/Frameworks", 489 | "$(inherited)", 490 | ); 491 | GCC_PREPROCESSOR_DEFINITIONS = ( 492 | "DEBUG=1", 493 | "$(inherited)", 494 | ); 495 | INFOPLIST_FILE = UnitTests/Info.plist; 496 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 497 | PRODUCT_NAME = "$(TARGET_NAME)"; 498 | }; 499 | name = Debug; 500 | }; 501 | 09027B5E1A3CA71B007625B7 /* Release */ = { 502 | isa = XCBuildConfiguration; 503 | baseConfigurationReference = 8E1E3125F2235BE421751BA1 /* Pods.release.xcconfig */; 504 | buildSettings = { 505 | FRAMEWORK_SEARCH_PATHS = ( 506 | "$(SDKROOT)/Developer/Library/Frameworks", 507 | "$(inherited)", 508 | ); 509 | INFOPLIST_FILE = UnitTests/Info.plist; 510 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 511 | PRODUCT_NAME = "$(TARGET_NAME)"; 512 | }; 513 | name = Release; 514 | }; 515 | /* End XCBuildConfiguration section */ 516 | 517 | /* Begin XCConfigurationList section */ 518 | 09027B311A3CA71B007625B7 /* Build configuration list for PBXProject "OHPDFImageDemo" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | 09027B571A3CA71B007625B7 /* Debug */, 522 | 09027B581A3CA71B007625B7 /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | defaultConfigurationName = Release; 526 | }; 527 | 09027B591A3CA71B007625B7 /* Build configuration list for PBXNativeTarget "OHPDFImageDemo" */ = { 528 | isa = XCConfigurationList; 529 | buildConfigurations = ( 530 | 09027B5A1A3CA71B007625B7 /* Debug */, 531 | 09027B5B1A3CA71B007625B7 /* Release */, 532 | ); 533 | defaultConfigurationIsVisible = 0; 534 | defaultConfigurationName = Release; 535 | }; 536 | 09027B5C1A3CA71B007625B7 /* Build configuration list for PBXNativeTarget "UnitTests" */ = { 537 | isa = XCConfigurationList; 538 | buildConfigurations = ( 539 | 09027B5D1A3CA71B007625B7 /* Debug */, 540 | 09027B5E1A3CA71B007625B7 /* Release */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | /* End XCConfigurationList section */ 546 | }; 547 | rootObject = 09027B2E1A3CA71B007625B7 /* Project object */; 548 | } 549 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo.xcodeproj/xcshareddata/xcschemes/OHPDFImageDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 17 | 19 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // OHPDFImageDemo 4 | // 5 | // Created by Olivier Halligon on 13/12/2014. 6 | // Copyright (c) 2014 AliSoftware. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // OHPDFImageDemo 4 | // 5 | // Created by Olivier Halligon on 13/12/2014. 6 | // Copyright (c) 2014 AliSoftware. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 18 | // Override point for customization after application launch. 19 | return YES; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Assets/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "size" : "29x29", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "size" : "29x29", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "40x40", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "40x40", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "76x76", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "76x76", 31 | "scale" : "2x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Assets/check.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AliSoftware/OHPDFImage/0edcdf4112a39712def742501d2f1326bdc58167/Example/OHPDFImageDemo/Assets/check.pdf -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Assets/circle.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AliSoftware/OHPDFImage/0edcdf4112a39712def742501d2f1326bdc58167/Example/OHPDFImageDemo/Assets/circle.pdf -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Assets/dingbats.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AliSoftware/OHPDFImage/0edcdf4112a39712def742501d2f1326bdc58167/Example/OHPDFImageDemo/Assets/dingbats.pdf -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Assets/dotmask.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AliSoftware/OHPDFImage/0edcdf4112a39712def742501d2f1326bdc58167/Example/OHPDFImageDemo/Assets/dotmask.pdf -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.alisoftware.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // OHPDFImageDemo 4 | // 5 | // Created by Olivier Halligon on 13/12/2014. 6 | // Copyright (c) 2014 AliSoftware. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // OHPDFImageDemo 4 | // 5 | // Created by Olivier Halligon on 13/12/2014. 6 | // Copyright (c) 2014 AliSoftware. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | 12 | @interface ViewController () 13 | @property (weak, nonatomic) IBOutlet UIImageView *imageView; 14 | @property (weak, nonatomic) IBOutlet UISegmentedControl *segmentedControl; 15 | @property (weak, nonatomic) IBOutlet UISlider *slider; 16 | 17 | @property (weak, nonatomic) IBOutlet UISwitch *bkgColorSwitch; 18 | @property (weak, nonatomic) IBOutlet UISwitch *tintColorSwitch; 19 | @property (weak, nonatomic) IBOutlet UISwitch *shadowSwitch; 20 | @end 21 | 22 | @implementation ViewController 23 | 24 | -(void)viewDidLayoutSubviews 25 | { 26 | // In particular once loaded or on orientation change 27 | [self reloadImage]; 28 | } 29 | 30 | - (IBAction)sliderDidChange:(UISlider *)sender 31 | { 32 | [self reloadImage]; 33 | } 34 | - (IBAction)segmentChanged:(UISegmentedControl *)sender 35 | { 36 | [self reloadImage]; 37 | } 38 | - (IBAction)switchChanged:(UISwitch *)sender 39 | { 40 | [self reloadImage]; 41 | } 42 | 43 | - (void)reloadImage 44 | { 45 | float scale = self.slider.value / self.slider.maximumValue; 46 | CGSize imageSize = (CGSize){ 47 | .width = CGRectGetWidth(self.imageView.superview.bounds)*scale, 48 | .height = CGRectGetHeight(self.imageView.superview.bounds)*scale 49 | }; 50 | 51 | NSString* imageName = (NSString* []){ 52 | @"dingbats", @"circle", @"check", @"dotmask" 53 | }[self.segmentedControl.selectedSegmentIndex]; 54 | 55 | // If no option needed, we can simply use: 56 | // UIImage* image = [UIImage imageWithPDFNamed:imageName fitInSize:imageSize]; 57 | 58 | // But here we want to show all the advanced options, so we manipulate the 59 | // OHVectorImage object to configure it before rendering it as a bitmap image 60 | OHVectorImage* vImage = [OHVectorImage imageWithPDFNamed:imageName]; 61 | 62 | if (self.bkgColorSwitch.on) 63 | { 64 | vImage.backgroundColor = [UIColor colorWithRed:0.9 green:1.0 blue:0.9 alpha:1.0]; 65 | } 66 | if (self.tintColorSwitch.on) 67 | { 68 | vImage.tintColor = [UIColor redColor]; 69 | } 70 | if (self.shadowSwitch.on) 71 | { 72 | vImage.shadow = [NSShadow new]; 73 | vImage.shadow.shadowOffset = CGSizeMake(2, 2); 74 | vImage.shadow.shadowBlurRadius = 3.f; 75 | vImage.shadow.shadowColor = [UIColor darkGrayColor]; 76 | vImage.insets = UIEdgeInsetsMake(0, 0, 5, 5); 77 | } 78 | 79 | UIImage* image = [vImage renderAtSizeThatFits:imageSize]; 80 | self.imageView.image = image; 81 | } 82 | 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Example/OHPDFImageDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // OHPDFImageDemo 4 | // 5 | // Created by Olivier Halligon on 13/12/2014. 6 | // Copyright (c) 2014 AliSoftware. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '6.0' 2 | 3 | link_with 'OHPDFImageDemo', 'UnitTests' 4 | pod 'OHPDFImage', :path => '..' 5 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OHPDFImage (3.2.1) 3 | 4 | DEPENDENCIES: 5 | - OHPDFImage (from `..`) 6 | 7 | EXTERNAL SOURCES: 8 | OHPDFImage: 9 | :path: ".." 10 | 11 | SPEC CHECKSUMS: 12 | OHPDFImage: b5ad5d7d99f4fbadaa8740cc3d1009f1a0b34ef0 13 | 14 | COCOAPODS: 0.37.0 15 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/OHPDFImage/OHPDFDocument.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHPDFDocument.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/OHPDFImage/OHPDFImage.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHPDFImage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/OHPDFImage/OHPDFPage.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHPDFPage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/OHPDFImage/OHVectorImage.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHVectorImage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/OHPDFImage/UIImage+OHPDF.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/UIImage+OHPDF.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/OHPDFImage/OHPDFDocument.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHPDFDocument.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/OHPDFImage/OHPDFImage.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHPDFImage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/OHPDFImage/OHPDFPage.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHPDFPage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/OHPDFImage/OHVectorImage.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/OHVectorImage.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/OHPDFImage/UIImage+OHPDF.h: -------------------------------------------------------------------------------- 1 | ../../../../../OHPDFImage/UIImage+OHPDF.h -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/OHPDFImage.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OHPDFImage", 3 | "version": "3.2.1", 4 | "summary": "OHPDFImage allows you to use a PDF as a vector UIImage", 5 | "description": " OHPDFImage will open PDF files and make it easy to access\n each page of the PDF as a vector image, then render it as\n an UIImage of any size.\n\n This will allow you to use PDF files as vector images in\n your applications, and ensure smooth resizing at any size.\n", 6 | "license": { 7 | "type": "MIT", 8 | "file": "LICENSE" 9 | }, 10 | "authors": { 11 | "Olivier Halligon": "olivier.halligon+ae@gmail.com" 12 | }, 13 | "homepage": "http://github.com/AliSoftware/OHPDFImage", 14 | "platforms": { 15 | "ios": "5.0" 16 | }, 17 | "source": { 18 | "git": "https://github.com/AliSoftware/OHPDFImage.git", 19 | "tag": "3.2.1" 20 | }, 21 | "source_files": "OHPDFImage/**/*.{h,m}", 22 | "frameworks": [ 23 | "QuartzCore", 24 | "UIKit" 25 | ], 26 | "requires_arc": true 27 | } 28 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OHPDFImage (3.2.1) 3 | 4 | DEPENDENCIES: 5 | - OHPDFImage (from `..`) 6 | 7 | EXTERNAL SOURCES: 8 | OHPDFImage: 9 | :path: ".." 10 | 11 | SPEC CHECKSUMS: 12 | OHPDFImage: b5ad5d7d99f4fbadaa8740cc3d1009f1a0b34ef0 13 | 14 | COCOAPODS: 0.37.0 15 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0984BD4C3C6D49FFE761ABF9 /* OHPDFPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 161BEC1A976055787E40EA21 /* OHPDFPage.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 11 | 21E7D4C983C0AB1CA1ED0BAB /* OHPDFPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B5A63AF172FC602069B6596 /* OHPDFPage.h */; }; 12 | 58FA1CD0C43E7E4BE39B62FB /* OHVectorImage.h in Headers */ = {isa = PBXBuildFile; fileRef = F2DF24BD3969B7C58D372237 /* OHVectorImage.h */; }; 13 | 6D0C8A9C832435B5B572E745 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 429EA8A56313ECBB47052C68 /* UIKit.framework */; }; 14 | 6DE2E03FC89D67A4FA94B57C /* Pods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2823C21F4722FA161E6723B6 /* Pods-dummy.m */; }; 15 | 6F8DBD9CC31C74CD00BF7055 /* OHVectorImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6FDB1E4A765F18DBF5C580 /* OHVectorImage.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 16 | 75D90E9CBC81266034651C2F /* UIImage+OHPDF.h in Headers */ = {isa = PBXBuildFile; fileRef = 346EEAB40E740B5E6067C2BC /* UIImage+OHPDF.h */; }; 17 | 75E3C16B734325226BDE8982 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C85087C4CC4494CCF857BDA9 /* Foundation.framework */; }; 18 | 7ACF3278DBE18651C44CCD84 /* OHPDFDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 5066BC3DE5822E510D30DC51 /* OHPDFDocument.h */; }; 19 | ADC338181F48387DF94BECA4 /* OHPDFImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 91123F24BD4E65EE414179EB /* OHPDFImage.h */; }; 20 | B5F148C0F77137BB61000541 /* Pods-OHPDFImage-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A9501E2A51FF2E35A42008 /* Pods-OHPDFImage-dummy.m */; }; 21 | BFE03F266B9EA081F3F11DF1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C85087C4CC4494CCF857BDA9 /* Foundation.framework */; }; 22 | C2ADD33BE9A55998CC4CA12E /* OHPDFDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 1534A91B29171D8A77EB1D41 /* OHPDFDocument.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 23 | CA305DB0E8E1220D826AB340 /* UIImage+OHPDF.m in Sources */ = {isa = PBXBuildFile; fileRef = C791305724DC92E0B14D4797 /* UIImage+OHPDF.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 24 | F1FE16EC8BDF8DA80010B2ED /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1818984D554BFA9EFF478C0 /* QuartzCore.framework */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | F4CD1937F96346413F74E60F /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 79D83A10A0D571CA7849CAFA /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = FAD0EFB9E36C0FB4D501FCEF; 33 | remoteInfo = "Pods-OHPDFImage"; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 00A78E57BFD24BD5BF7CE34D /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.debug.xcconfig; sourceTree = ""; }; 39 | 1534A91B29171D8A77EB1D41 /* OHPDFDocument.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHPDFDocument.m; sourceTree = ""; }; 40 | 161B97607E20BF94AC7E8E3E /* libPods-OHPDFImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OHPDFImage.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 161BEC1A976055787E40EA21 /* OHPDFPage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHPDFPage.m; sourceTree = ""; }; 42 | 2823C21F4722FA161E6723B6 /* Pods-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-dummy.m"; sourceTree = ""; }; 43 | 2F925EF8760DEF4E649B73E3 /* Pods-environment.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-environment.h"; sourceTree = ""; }; 44 | 346EEAB40E740B5E6067C2BC /* UIImage+OHPDF.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "UIImage+OHPDF.h"; sourceTree = ""; }; 45 | 3CC43275731EF6385F605F45 /* Pods-OHPDFImage-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OHPDFImage-Private.xcconfig"; sourceTree = ""; }; 46 | 3EE578B03A5327456CD43039 /* Pods-OHPDFImage-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-OHPDFImage-prefix.pch"; sourceTree = ""; }; 47 | 429EA8A56313ECBB47052C68 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 48 | 5066BC3DE5822E510D30DC51 /* OHPDFDocument.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHPDFDocument.h; sourceTree = ""; }; 49 | 6B5A63AF172FC602069B6596 /* OHPDFPage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHPDFPage.h; sourceTree = ""; }; 50 | 7253700776B516C0082C9A6E /* Pods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-acknowledgements.markdown"; sourceTree = ""; }; 51 | 7CB5FB104A2FF6F8635745BC /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.release.xcconfig; sourceTree = ""; }; 52 | 81FD636FCE04BAAF68094EBA /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 53 | 91123F24BD4E65EE414179EB /* OHPDFImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHPDFImage.h; sourceTree = ""; }; 54 | 971BAB415C40B9507265115F /* Pods-OHPDFImage.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-OHPDFImage.xcconfig"; sourceTree = ""; }; 55 | 9B6FDB1E4A765F18DBF5C580 /* OHVectorImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = OHVectorImage.m; sourceTree = ""; }; 56 | B39A8EFE68E8CA840893E96C /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | B60FE419D4A52A6CEDA3A912 /* Pods-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-acknowledgements.plist"; sourceTree = ""; }; 58 | C755EF0994FBA832AF515F0E /* Pods-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-resources.sh"; sourceTree = ""; }; 59 | C791305724DC92E0B14D4797 /* UIImage+OHPDF.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "UIImage+OHPDF.m"; sourceTree = ""; }; 60 | C85087C4CC4494CCF857BDA9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 61 | D2A9501E2A51FF2E35A42008 /* Pods-OHPDFImage-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-OHPDFImage-dummy.m"; sourceTree = ""; }; 62 | F1818984D554BFA9EFF478C0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; 63 | F2DF24BD3969B7C58D372237 /* OHVectorImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = OHVectorImage.h; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 4FF67E35FE774DE2C6F9D759 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 75E3C16B734325226BDE8982 /* Foundation.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | AF33785DD712A9291ACF036A /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | BFE03F266B9EA081F3F11DF1 /* Foundation.framework in Frameworks */, 80 | F1FE16EC8BDF8DA80010B2ED /* QuartzCore.framework in Frameworks */, 81 | 6D0C8A9C832435B5B572E745 /* UIKit.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 3A565825B0D774C6091DB17F /* Development Pods */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 456FE10DDC2E06EED32BD13F /* OHPDFImage */, 92 | ); 93 | name = "Development Pods"; 94 | sourceTree = ""; 95 | }; 96 | 456FE10DDC2E06EED32BD13F /* OHPDFImage */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 9F7A9CE684E66BD9E412C73D /* OHPDFImage */, 100 | 76C7EC4436782FFAA54E9786 /* Support Files */, 101 | ); 102 | name = OHPDFImage; 103 | path = ../..; 104 | sourceTree = ""; 105 | }; 106 | 5AFD5CC0E554D24967AB341F /* Frameworks */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | E13F88FF16D9D60D67F210D7 /* iOS */, 110 | ); 111 | name = Frameworks; 112 | sourceTree = ""; 113 | }; 114 | 76C7EC4436782FFAA54E9786 /* Support Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 971BAB415C40B9507265115F /* Pods-OHPDFImage.xcconfig */, 118 | 3CC43275731EF6385F605F45 /* Pods-OHPDFImage-Private.xcconfig */, 119 | D2A9501E2A51FF2E35A42008 /* Pods-OHPDFImage-dummy.m */, 120 | 3EE578B03A5327456CD43039 /* Pods-OHPDFImage-prefix.pch */, 121 | ); 122 | name = "Support Files"; 123 | path = "Example/Pods/Target Support Files/Pods-OHPDFImage"; 124 | sourceTree = ""; 125 | }; 126 | 7CE18B10CBD1048BDD5311EF /* Products */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | B39A8EFE68E8CA840893E96C /* libPods.a */, 130 | 161B97607E20BF94AC7E8E3E /* libPods-OHPDFImage.a */, 131 | ); 132 | name = Products; 133 | sourceTree = ""; 134 | }; 135 | 8BD9EBD2A3D92B11A6A35CF8 = { 136 | isa = PBXGroup; 137 | children = ( 138 | 81FD636FCE04BAAF68094EBA /* Podfile */, 139 | 3A565825B0D774C6091DB17F /* Development Pods */, 140 | 5AFD5CC0E554D24967AB341F /* Frameworks */, 141 | 7CE18B10CBD1048BDD5311EF /* Products */, 142 | B876445B4B42A25595BA3656 /* Targets Support Files */, 143 | ); 144 | sourceTree = ""; 145 | }; 146 | 9F7A9CE684E66BD9E412C73D /* OHPDFImage */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 5066BC3DE5822E510D30DC51 /* OHPDFDocument.h */, 150 | 1534A91B29171D8A77EB1D41 /* OHPDFDocument.m */, 151 | 91123F24BD4E65EE414179EB /* OHPDFImage.h */, 152 | 6B5A63AF172FC602069B6596 /* OHPDFPage.h */, 153 | 161BEC1A976055787E40EA21 /* OHPDFPage.m */, 154 | F2DF24BD3969B7C58D372237 /* OHVectorImage.h */, 155 | 9B6FDB1E4A765F18DBF5C580 /* OHVectorImage.m */, 156 | 346EEAB40E740B5E6067C2BC /* UIImage+OHPDF.h */, 157 | C791305724DC92E0B14D4797 /* UIImage+OHPDF.m */, 158 | ); 159 | path = OHPDFImage; 160 | sourceTree = ""; 161 | }; 162 | B876445B4B42A25595BA3656 /* Targets Support Files */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | C913A3847752BD8CC052FDFB /* Pods */, 166 | ); 167 | name = "Targets Support Files"; 168 | sourceTree = ""; 169 | }; 170 | C913A3847752BD8CC052FDFB /* Pods */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 7253700776B516C0082C9A6E /* Pods-acknowledgements.markdown */, 174 | B60FE419D4A52A6CEDA3A912 /* Pods-acknowledgements.plist */, 175 | 2823C21F4722FA161E6723B6 /* Pods-dummy.m */, 176 | 2F925EF8760DEF4E649B73E3 /* Pods-environment.h */, 177 | C755EF0994FBA832AF515F0E /* Pods-resources.sh */, 178 | 00A78E57BFD24BD5BF7CE34D /* Pods.debug.xcconfig */, 179 | 7CB5FB104A2FF6F8635745BC /* Pods.release.xcconfig */, 180 | ); 181 | name = Pods; 182 | path = "Target Support Files/Pods"; 183 | sourceTree = ""; 184 | }; 185 | E13F88FF16D9D60D67F210D7 /* iOS */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | C85087C4CC4494CCF857BDA9 /* Foundation.framework */, 189 | F1818984D554BFA9EFF478C0 /* QuartzCore.framework */, 190 | 429EA8A56313ECBB47052C68 /* UIKit.framework */, 191 | ); 192 | name = iOS; 193 | sourceTree = ""; 194 | }; 195 | /* End PBXGroup section */ 196 | 197 | /* Begin PBXHeadersBuildPhase section */ 198 | 91B9FC6DD31FD6C414A5E9AF /* Headers */ = { 199 | isa = PBXHeadersBuildPhase; 200 | buildActionMask = 2147483647; 201 | files = ( 202 | 7ACF3278DBE18651C44CCD84 /* OHPDFDocument.h in Headers */, 203 | ADC338181F48387DF94BECA4 /* OHPDFImage.h in Headers */, 204 | 21E7D4C983C0AB1CA1ED0BAB /* OHPDFPage.h in Headers */, 205 | 58FA1CD0C43E7E4BE39B62FB /* OHVectorImage.h in Headers */, 206 | 75D90E9CBC81266034651C2F /* UIImage+OHPDF.h in Headers */, 207 | ); 208 | runOnlyForDeploymentPostprocessing = 0; 209 | }; 210 | /* End PBXHeadersBuildPhase section */ 211 | 212 | /* Begin PBXNativeTarget section */ 213 | 56D94702BE89E59A2284721D /* Pods */ = { 214 | isa = PBXNativeTarget; 215 | buildConfigurationList = 4FF78549A01B587E771AEE10 /* Build configuration list for PBXNativeTarget "Pods" */; 216 | buildPhases = ( 217 | FD718089982DDD99FA2C064F /* Sources */, 218 | 4FF67E35FE774DE2C6F9D759 /* Frameworks */, 219 | ); 220 | buildRules = ( 221 | ); 222 | dependencies = ( 223 | 2F97F0D3F5F04D1F43A1A6A5 /* PBXTargetDependency */, 224 | ); 225 | name = Pods; 226 | productName = Pods; 227 | productReference = B39A8EFE68E8CA840893E96C /* libPods.a */; 228 | productType = "com.apple.product-type.library.static"; 229 | }; 230 | FAD0EFB9E36C0FB4D501FCEF /* Pods-OHPDFImage */ = { 231 | isa = PBXNativeTarget; 232 | buildConfigurationList = B2277BAFE3299277C5F7DA67 /* Build configuration list for PBXNativeTarget "Pods-OHPDFImage" */; 233 | buildPhases = ( 234 | D48E110E696B122E6BF707F8 /* Sources */, 235 | AF33785DD712A9291ACF036A /* Frameworks */, 236 | 91B9FC6DD31FD6C414A5E9AF /* Headers */, 237 | ); 238 | buildRules = ( 239 | ); 240 | dependencies = ( 241 | ); 242 | name = "Pods-OHPDFImage"; 243 | productName = "Pods-OHPDFImage"; 244 | productReference = 161B97607E20BF94AC7E8E3E /* libPods-OHPDFImage.a */; 245 | productType = "com.apple.product-type.library.static"; 246 | }; 247 | /* End PBXNativeTarget section */ 248 | 249 | /* Begin PBXProject section */ 250 | 79D83A10A0D571CA7849CAFA /* Project object */ = { 251 | isa = PBXProject; 252 | attributes = { 253 | LastUpgradeCheck = 0640; 254 | }; 255 | buildConfigurationList = 3EBFC7E9158BCBC0835F056A /* Build configuration list for PBXProject "Pods" */; 256 | compatibilityVersion = "Xcode 3.2"; 257 | developmentRegion = English; 258 | hasScannedForEncodings = 0; 259 | knownRegions = ( 260 | en, 261 | ); 262 | mainGroup = 8BD9EBD2A3D92B11A6A35CF8; 263 | productRefGroup = 7CE18B10CBD1048BDD5311EF /* Products */; 264 | projectDirPath = ""; 265 | projectRoot = ""; 266 | targets = ( 267 | 56D94702BE89E59A2284721D /* Pods */, 268 | FAD0EFB9E36C0FB4D501FCEF /* Pods-OHPDFImage */, 269 | ); 270 | }; 271 | /* End PBXProject section */ 272 | 273 | /* Begin PBXSourcesBuildPhase section */ 274 | D48E110E696B122E6BF707F8 /* Sources */ = { 275 | isa = PBXSourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | C2ADD33BE9A55998CC4CA12E /* OHPDFDocument.m in Sources */, 279 | 0984BD4C3C6D49FFE761ABF9 /* OHPDFPage.m in Sources */, 280 | 6F8DBD9CC31C74CD00BF7055 /* OHVectorImage.m in Sources */, 281 | B5F148C0F77137BB61000541 /* Pods-OHPDFImage-dummy.m in Sources */, 282 | CA305DB0E8E1220D826AB340 /* UIImage+OHPDF.m in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | FD718089982DDD99FA2C064F /* Sources */ = { 287 | isa = PBXSourcesBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | 6DE2E03FC89D67A4FA94B57C /* Pods-dummy.m in Sources */, 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | }; 294 | /* End PBXSourcesBuildPhase section */ 295 | 296 | /* Begin PBXTargetDependency section */ 297 | 2F97F0D3F5F04D1F43A1A6A5 /* PBXTargetDependency */ = { 298 | isa = PBXTargetDependency; 299 | name = "Pods-OHPDFImage"; 300 | target = FAD0EFB9E36C0FB4D501FCEF /* Pods-OHPDFImage */; 301 | targetProxy = F4CD1937F96346413F74E60F /* PBXContainerItemProxy */; 302 | }; 303 | /* End PBXTargetDependency section */ 304 | 305 | /* Begin XCBuildConfiguration section */ 306 | 0901CA2D551EA914F925101B /* Debug */ = { 307 | isa = XCBuildConfiguration; 308 | buildSettings = { 309 | ALWAYS_SEARCH_USER_PATHS = NO; 310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 311 | CLANG_CXX_LIBRARY = "libc++"; 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_ENABLE_OBJC_ARC = YES; 314 | CLANG_WARN_BOOL_CONVERSION = YES; 315 | CLANG_WARN_CONSTANT_CONVERSION = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 321 | CLANG_WARN_UNREACHABLE_CODE = YES; 322 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 323 | COPY_PHASE_STRIP = NO; 324 | GCC_C_LANGUAGE_STANDARD = gnu99; 325 | GCC_DYNAMIC_NO_PIC = NO; 326 | GCC_OPTIMIZATION_LEVEL = 0; 327 | GCC_PREPROCESSOR_DEFINITIONS = ( 328 | "DEBUG=1", 329 | "$(inherited)", 330 | ); 331 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 332 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 333 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 334 | GCC_WARN_UNDECLARED_SELECTOR = YES; 335 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 336 | GCC_WARN_UNUSED_FUNCTION = YES; 337 | GCC_WARN_UNUSED_VARIABLE = YES; 338 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 339 | ONLY_ACTIVE_ARCH = YES; 340 | STRIP_INSTALLED_PRODUCT = NO; 341 | SYMROOT = "${SRCROOT}/../build"; 342 | }; 343 | name = Debug; 344 | }; 345 | 54912306DAAD7D06A5894296 /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | baseConfigurationReference = 3CC43275731EF6385F605F45 /* Pods-OHPDFImage-Private.xcconfig */; 348 | buildSettings = { 349 | ENABLE_STRICT_OBJC_MSGSEND = YES; 350 | GCC_PREFIX_HEADER = "Target Support Files/Pods-OHPDFImage/Pods-OHPDFImage-prefix.pch"; 351 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 352 | MTL_ENABLE_DEBUG_INFO = YES; 353 | OTHER_LDFLAGS = ""; 354 | OTHER_LIBTOOLFLAGS = ""; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | SDKROOT = iphoneos; 357 | SKIP_INSTALL = YES; 358 | }; 359 | name = Debug; 360 | }; 361 | 9AB4919E33530918933D0BAD /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | baseConfigurationReference = 3CC43275731EF6385F605F45 /* Pods-OHPDFImage-Private.xcconfig */; 364 | buildSettings = { 365 | ENABLE_STRICT_OBJC_MSGSEND = YES; 366 | GCC_PREFIX_HEADER = "Target Support Files/Pods-OHPDFImage/Pods-OHPDFImage-prefix.pch"; 367 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 368 | MTL_ENABLE_DEBUG_INFO = NO; 369 | OTHER_LDFLAGS = ""; 370 | OTHER_LIBTOOLFLAGS = ""; 371 | PRODUCT_NAME = "$(TARGET_NAME)"; 372 | SDKROOT = iphoneos; 373 | SKIP_INSTALL = YES; 374 | }; 375 | name = Release; 376 | }; 377 | AAD94276E78FA82040022F65 /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | baseConfigurationReference = 00A78E57BFD24BD5BF7CE34D /* Pods.debug.xcconfig */; 380 | buildSettings = { 381 | ENABLE_STRICT_OBJC_MSGSEND = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 383 | MTL_ENABLE_DEBUG_INFO = YES; 384 | OTHER_LDFLAGS = ""; 385 | OTHER_LIBTOOLFLAGS = ""; 386 | PODS_ROOT = "$(SRCROOT)"; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | SDKROOT = iphoneos; 389 | SKIP_INSTALL = YES; 390 | }; 391 | name = Debug; 392 | }; 393 | BE227D5BA2A05818AC4B5D1F /* Release */ = { 394 | isa = XCBuildConfiguration; 395 | baseConfigurationReference = 7CB5FB104A2FF6F8635745BC /* Pods.release.xcconfig */; 396 | buildSettings = { 397 | ENABLE_STRICT_OBJC_MSGSEND = YES; 398 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 399 | MTL_ENABLE_DEBUG_INFO = NO; 400 | OTHER_LDFLAGS = ""; 401 | OTHER_LIBTOOLFLAGS = ""; 402 | PODS_ROOT = "$(SRCROOT)"; 403 | PRODUCT_NAME = "$(TARGET_NAME)"; 404 | SDKROOT = iphoneos; 405 | SKIP_INSTALL = YES; 406 | }; 407 | name = Release; 408 | }; 409 | F67945DE60637764BC0D0CD3 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ALWAYS_SEARCH_USER_PATHS = NO; 413 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 414 | CLANG_CXX_LIBRARY = "libc++"; 415 | CLANG_ENABLE_MODULES = YES; 416 | CLANG_ENABLE_OBJC_ARC = YES; 417 | CLANG_WARN_BOOL_CONVERSION = YES; 418 | CLANG_WARN_CONSTANT_CONVERSION = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 420 | CLANG_WARN_EMPTY_BODY = YES; 421 | CLANG_WARN_ENUM_CONVERSION = YES; 422 | CLANG_WARN_INT_CONVERSION = YES; 423 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 424 | CLANG_WARN_UNREACHABLE_CODE = YES; 425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 426 | COPY_PHASE_STRIP = YES; 427 | ENABLE_NS_ASSERTIONS = NO; 428 | GCC_C_LANGUAGE_STANDARD = gnu99; 429 | GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 437 | STRIP_INSTALLED_PRODUCT = NO; 438 | SYMROOT = "${SRCROOT}/../build"; 439 | VALIDATE_PRODUCT = YES; 440 | }; 441 | name = Release; 442 | }; 443 | /* End XCBuildConfiguration section */ 444 | 445 | /* Begin XCConfigurationList section */ 446 | 3EBFC7E9158BCBC0835F056A /* Build configuration list for PBXProject "Pods" */ = { 447 | isa = XCConfigurationList; 448 | buildConfigurations = ( 449 | 0901CA2D551EA914F925101B /* Debug */, 450 | F67945DE60637764BC0D0CD3 /* Release */, 451 | ); 452 | defaultConfigurationIsVisible = 0; 453 | defaultConfigurationName = Release; 454 | }; 455 | 4FF78549A01B587E771AEE10 /* Build configuration list for PBXNativeTarget "Pods" */ = { 456 | isa = XCConfigurationList; 457 | buildConfigurations = ( 458 | AAD94276E78FA82040022F65 /* Debug */, 459 | BE227D5BA2A05818AC4B5D1F /* Release */, 460 | ); 461 | defaultConfigurationIsVisible = 0; 462 | defaultConfigurationName = Release; 463 | }; 464 | B2277BAFE3299277C5F7DA67 /* Build configuration list for PBXNativeTarget "Pods-OHPDFImage" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | 54912306DAAD7D06A5894296 /* Debug */, 468 | 9AB4919E33530918933D0BAD /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | defaultConfigurationName = Release; 472 | }; 473 | /* End XCConfigurationList section */ 474 | }; 475 | rootObject = 79D83A10A0D571CA7849CAFA /* Project object */; 476 | } 477 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OHPDFImage/Pods-OHPDFImage-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-OHPDFImage.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/OHPDFImage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OHPDFImage" 4 | OTHER_LDFLAGS = ${PODS_OHPDFIMAGE_OTHER_LDFLAGS} -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OHPDFImage/Pods-OHPDFImage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_OHPDFImage : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_OHPDFImage 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OHPDFImage/Pods-OHPDFImage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-OHPDFImage/Pods-OHPDFImage.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_OHPDFIMAGE_OTHER_LDFLAGS = -framework "QuartzCore" -framework "UIKit" -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## OHPDFImage 5 | 6 | - MIT LICENSE - 7 | 8 | Copyright (c) 2012 Olivier Halligon 9 | 10 | 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: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | 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. 15 | Generated by CocoaPods - http://cocoapods.org 16 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | - MIT LICENSE - 18 | 19 | Copyright (c) 2012 Olivier Halligon 20 | 21 | 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: 22 | 23 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 24 | 25 | 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. 26 | Title 27 | OHPDFImage 28 | Type 29 | PSGroupSpecifier 30 | 31 | 32 | FooterText 33 | Generated by CocoaPods - http://cocoapods.org 34 | Title 35 | 36 | Type 37 | PSGroupSpecifier 38 | 39 | 40 | StringsTable 41 | Acknowledgements 42 | Title 43 | Acknowledgements 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // OHPDFImage 10 | #define COCOAPODS_POD_AVAILABLE_OHPDFImage 11 | #define COCOAPODS_VERSION_MAJOR_OHPDFImage 3 12 | #define COCOAPODS_VERSION_MINOR_OHPDFImage 2 13 | #define COCOAPODS_VERSION_PATCH_OHPDFImage 1 14 | 15 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY=$(cd "${1%/*}" && pwd) 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | if [[ "${ACTION}" == "install" ]]; then 63 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 64 | fi 65 | rm -f "$RESOURCES_TO_COPY" 66 | 67 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 68 | then 69 | case "${TARGETED_DEVICE_FAMILY}" in 70 | 1,2) 71 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 72 | ;; 73 | 1) 74 | TARGET_DEVICE_ARGS="--target-device iphone" 75 | ;; 76 | 2) 77 | TARGET_DEVICE_ARGS="--target-device ipad" 78 | ;; 79 | *) 80 | TARGET_DEVICE_ARGS="--target-device mac" 81 | ;; 82 | esac 83 | 84 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 85 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 86 | while read line; do 87 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 88 | XCASSET_FILES+=("$line") 89 | fi 90 | done <<<"$OTHER_XCASSETS" 91 | 92 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 93 | fi 94 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OHPDFImage" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/OHPDFImage" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-OHPDFImage" -framework "QuartzCore" -framework "UIKit" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OHPDFImage" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/OHPDFImage" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-OHPDFImage" -framework "QuartzCore" -framework "UIKit" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/UnitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.alisoftware.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/UnitTests/OHPDFImageTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // OHPDFImageDemoTests.m 3 | // OHPDFImageDemoTests 4 | // 5 | // Created by Olivier Halligon on 13/12/2014. 6 | // Copyright (c) 2014 AliSoftware. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface OHPDFImageDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation OHPDFImageDemoTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | - MIT LICENSE - 2 | 3 | Copyright (c) 2012 Olivier Halligon 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. -------------------------------------------------------------------------------- /OHPDFImage.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = 'OHPDFImage' 4 | s.version = '3.2.1' 5 | s.summary = "OHPDFImage allows you to use a PDF as a vector UIImage" 6 | 7 | s.description = <<-DESC 8 | OHPDFImage will open PDF files and make it easy to access 9 | each page of the PDF as a vector image, then render it as 10 | an UIImage of any size. 11 | 12 | This will allow you to use PDF files as vector images in 13 | your applications, and ensure smooth resizing at any size. 14 | DESC 15 | 16 | s.license = { :type => 'MIT', :file => 'LICENSE' } 17 | s.author = { 'Olivier Halligon' => 'olivier.halligon+ae@gmail.com' } 18 | s.homepage = 'http://github.com/AliSoftware/OHPDFImage' 19 | 20 | s.platform = :ios, '5.0' 21 | 22 | s.source = { :git => 'https://github.com/AliSoftware/OHPDFImage.git', :tag => s.version.to_s } 23 | 24 | s.source_files = 'OHPDFImage/**/*.{h,m}' 25 | 26 | 27 | s.frameworks = 'QuartzCore', 'UIKit' 28 | 29 | s.requires_arc = true 30 | 31 | end 32 | 33 | -------------------------------------------------------------------------------- /OHPDFImage/OHPDFDocument.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import 26 | #import 27 | @class OHPDFPage; 28 | 29 | /***********************************************************************************/ 30 | 31 | /** 32 | * A PDF document. 33 | */ 34 | @interface OHPDFDocument : NSObject 35 | 36 | /** 37 | * The CoreGraphics reference (CGPDFDocumentRef) to the PDF document. 38 | */ 39 | @property(nonatomic, assign, readonly) CGPDFDocumentRef documentRef; 40 | /** 41 | * The number of pages of the document. 42 | */ 43 | @property(nonatomic, assign, readonly) size_t pagesCount; 44 | 45 | #pragma mark - Constructors 46 | /** 47 | * Create an OHPDFDocument from an URL pointing to a PDF file. 48 | * 49 | * @param url The URL pointing to the PDF file to load 50 | * 51 | * @return The OHPDFDocument representing the PDF document. 52 | */ 53 | + (instancetype)documentWithURL:(NSURL*)url; 54 | 55 | /** 56 | * Create an OHPDFDocument instance wrapping a CGPDFDocumentRef reference 57 | * 58 | * @param docRef The CGPDFDocumentRef reference to wrap 59 | * 60 | * @return The OHPDFDocument representing the PDF. 61 | */ 62 | + (instancetype)documentWithRef:(CGPDFDocumentRef)docRef; 63 | 64 | /** 65 | * Create an OHPDFDocument from an NSData created from a PDF file. 66 | * 67 | * @param data The NSData created from the PDF file to load 68 | * 69 | * @return The OHPDFDocument representing the PDF document. 70 | */ 71 | + (instancetype)documentWithData:(NSData*)data; 72 | 73 | #pragma mark - Getting a page 74 | /** 75 | * Return a given page in the PDF. Page indexes starts at 1. 76 | * 77 | * @param pageNumber Page number, starting at 1 78 | * 79 | * @return The specified page in the PDF 80 | */ 81 | - (OHPDFPage*)pageAtIndex:(size_t)pageNumber; 82 | 83 | @end 84 | -------------------------------------------------------------------------------- /OHPDFImage/OHPDFDocument.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import "OHPDFDocument.h" 26 | #import "OHPDFPage.h" 27 | 28 | /***********************************************************************************/ 29 | 30 | @interface OHPDFDocument() 31 | - (instancetype)initWithRef:(CGPDFDocumentRef)docRef NS_DESIGNATED_INITIALIZER; 32 | @end 33 | 34 | @implementation OHPDFDocument 35 | 36 | #pragma mark - Constructors 37 | 38 | + (instancetype)documentWithData:(NSData *)data 39 | { 40 | if (!data) return nil; 41 | CGDataProviderRef dataRef = CGDataProviderCreateWithCFData((__bridge CFDataRef)data); 42 | 43 | if (!dataRef) return nil; 44 | CGPDFDocumentRef docRef = CGPDFDocumentCreateWithProvider(dataRef); 45 | CGDataProviderRelease(dataRef); 46 | 47 | if (!docRef) return nil; 48 | OHPDFDocument* doc = [self documentWithRef:docRef]; 49 | CGPDFDocumentRelease(docRef); 50 | 51 | return doc; 52 | } 53 | 54 | 55 | + (instancetype)documentWithURL:(NSURL*)url 56 | { 57 | CGPDFDocumentRef docRef = CGPDFDocumentCreateWithURL((__bridge CFURLRef)url); 58 | OHPDFDocument* doc = nil; 59 | if (docRef) 60 | { 61 | doc = [self documentWithRef:docRef]; 62 | CGPDFDocumentRelease(docRef); 63 | } 64 | return doc; 65 | } 66 | 67 | + (instancetype)documentWithRef:(CGPDFDocumentRef)docRef 68 | { 69 | return [[self alloc] initWithRef:docRef]; 70 | } 71 | 72 | - (instancetype)initWithRef:(CGPDFDocumentRef)docRef 73 | { 74 | self = [super init]; 75 | if (self) 76 | { 77 | CGPDFDocumentRetain(docRef); 78 | _documentRef = docRef; 79 | _pagesCount = CGPDFDocumentGetNumberOfPages(docRef); 80 | } 81 | return self; 82 | } 83 | 84 | - (void)dealloc 85 | { 86 | if (_documentRef) 87 | { 88 | CGPDFDocumentRelease(_documentRef); 89 | _documentRef = nil; 90 | } 91 | } 92 | 93 | #pragma mark - Getting a page 94 | 95 | - (OHPDFPage*)pageAtIndex:(size_t)pageNumber 96 | { 97 | if (pageNumber > 0 && pageNumber <= _pagesCount) 98 | { 99 | CGPDFPageRef pageRef = CGPDFDocumentGetPage(_documentRef, pageNumber); 100 | if (pageRef) 101 | { 102 | return [OHPDFPage pageWithRef:pageRef]; 103 | } 104 | } 105 | return nil; 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /OHPDFImage/OHPDFImage.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | // For SDK 7.1 Compatibility (as this macro was only included starting SDK 8.0) 26 | #ifndef NS_DESIGNATED_INITIALIZER 27 | #if __has_attribute(objc_designated_initializer) 28 | #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) 29 | #else 30 | #define NS_DESIGNATED_INITIALIZER 31 | #endif 32 | #endif 33 | 34 | #import "OHPDFDocument.h" 35 | #import "OHPDFPage.h" 36 | #import "OHVectorImage.h" 37 | #import "UIImage+OHPDF.h" 38 | -------------------------------------------------------------------------------- /OHPDFImage/OHPDFPage.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import 26 | #import 27 | @class UIImage; 28 | 29 | /***********************************************************************************/ 30 | 31 | /** 32 | * A given page of a PDF document. 33 | */ 34 | @interface OHPDFPage : NSObject 35 | 36 | /** 37 | * The CoreGraphics reference (CGPDFPageRef) to the PDF page. 38 | */ 39 | @property(nonatomic, assign, readonly) CGPDFPageRef pageRef; 40 | 41 | #pragma mark - PDF Page Box Rects 42 | 43 | /** 44 | * The PDF page media box. See kCGPDFMediaBox documentation for details. 45 | */ 46 | @property(nonatomic, readonly) CGRect mediaBox; 47 | /** 48 | * The PDF page crop box. See kCGPDFCropBox documentation for details. 49 | */ 50 | @property(nonatomic, readonly) CGRect cropBox; 51 | /** 52 | * The PDF page bleed box. See kCGPDFBleedBox documentation for details. 53 | */ 54 | @property(nonatomic, readonly) CGRect bleedBox; 55 | /** 56 | * The PDF page trim box. See kCGPDFTrimBox documentation for details. 57 | */ 58 | @property(nonatomic, readonly) CGRect trimBox; 59 | /** 60 | * The PDF page art box. See kCGPDFArtBox documentation for details. 61 | */ 62 | @property(nonatomic, readonly) CGRect artBox; 63 | 64 | #pragma mark - Constructor 65 | 66 | /** 67 | * Create a new OHPDFPage from a CGPDFPageRef 68 | * 69 | * @param pageRef The CGPDFPageRef to use 70 | * 71 | * @return An OHPDFPage object wrapping the CGPDFPageRef 72 | */ 73 | + (instancetype)pageWithRef:(CGPDFPageRef)pageRef; 74 | 75 | #pragma mark - Drawing in a graphic context 76 | 77 | /** 78 | * Draws the page in a Graphic Context 79 | * 80 | * @param context The context to draw the PDF page into 81 | */ 82 | - (void)drawInContext:(CGContextRef)context; 83 | 84 | /** 85 | * Draws the page in a Graphic Context 86 | * 87 | * @param context The context to draw the PDF page into 88 | * @param rect The destination rectangle to draw the image into 89 | * @param flipped If YES, the drawing is flipped when rendered in the context. 90 | * Useful if the context has been created using 91 | * `UIGraphicsBeginImageContext` and not CoreGraphics functions 92 | */ 93 | - (void)drawInContext:(CGContextRef)context rect:(CGRect)rect flipped:(BOOL)flipped; 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /OHPDFImage/OHPDFPage.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import "OHPDFPage.h" 26 | #import 27 | 28 | /***********************************************************************************/ 29 | 30 | @interface OHPDFPage() 31 | - (instancetype)initWithRef:(CGPDFPageRef)pageRef NS_DESIGNATED_INITIALIZER; 32 | @end 33 | 34 | @implementation OHPDFPage 35 | 36 | + (instancetype)pageWithRef:(CGPDFPageRef)pageRef 37 | { 38 | return [[self alloc] initWithRef:pageRef]; 39 | } 40 | 41 | - (instancetype)initWithRef:(CGPDFPageRef)pageRef 42 | { 43 | self = [super init]; 44 | if (self) 45 | { 46 | CGPDFPageRetain(pageRef); 47 | _pageRef = pageRef; 48 | } 49 | return self; 50 | } 51 | 52 | - (void)dealloc 53 | { 54 | if (_pageRef) 55 | { 56 | CGPDFPageRelease(_pageRef); 57 | _pageRef = nil; 58 | } 59 | } 60 | 61 | #pragma mark - PDF Page Box Rects 62 | 63 | - (CGRect)mediaBox 64 | { 65 | return CGPDFPageGetBoxRect(_pageRef, kCGPDFMediaBox); 66 | } 67 | 68 | - (CGRect)cropBox 69 | { 70 | return CGPDFPageGetBoxRect(_pageRef, kCGPDFCropBox); 71 | } 72 | - (CGRect)bleedBox 73 | { 74 | return CGPDFPageGetBoxRect(_pageRef, kCGPDFBleedBox); 75 | } 76 | - (CGRect)trimBox 77 | { 78 | return CGPDFPageGetBoxRect(_pageRef, kCGPDFTrimBox); 79 | } 80 | - (CGRect)artBox 81 | { 82 | return CGPDFPageGetBoxRect(_pageRef, kCGPDFArtBox); 83 | } 84 | 85 | #pragma mark - Drawing in a graphic context 86 | 87 | - (void)drawInContext:(CGContextRef)context 88 | { 89 | [self drawInContext:context rect:self.mediaBox flipped:NO]; 90 | } 91 | 92 | - (void)drawInContext:(CGContextRef)context rect:(CGRect)rect flipped:(BOOL)flipped 93 | { 94 | static CGFloat const kScaleFactorIdentity = 1.0; 95 | CGFloat sx = rect.size.width/self.mediaBox.size.width; 96 | CGFloat sy = rect.size.height/self.mediaBox.size.height; 97 | 98 | CGContextSaveGState(context); 99 | 100 | CGContextConcatCTM(context, CGAffineTransformMakeTranslation(rect.origin.x, rect.origin.y)); 101 | CGContextConcatCTM(context, CGAffineTransformMakeScale(sx, sy)); 102 | if (flipped) 103 | { 104 | CGContextConcatCTM(context, CGAffineTransformMakeScale(kScaleFactorIdentity, -kScaleFactorIdentity)); 105 | CGContextConcatCTM(context, CGAffineTransformMakeTranslation(0, -self.mediaBox.size.height)); 106 | } 107 | CGContextDrawPDFPage(context, _pageRef); 108 | 109 | CGContextRestoreGState(context); 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /OHPDFImage/OHVectorImage.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import 26 | @class OHPDFPage; 27 | 28 | /***********************************************************************************/ 29 | 30 | /** 31 | * This class represents a vector image, typically loaded from a PDF file. 32 | * 33 | * It allows you to query the expected rendering size (mediaBox of the PDF) 34 | * and render it as an `UIImage` using various parameters like a given 35 | * backgroundColor, tintColor, drop shadow, margins/insets and custom size, 36 | * and also compute the size that fits a given input size (for when you need 37 | * to keep original aspect ratio). 38 | */ 39 | @interface OHVectorImage : NSObject 40 | 41 | #pragma mark - Properties 42 | 43 | /** 44 | * The color to tint the image with. 45 | * 46 | * - If `nil` (the default), no special tint is applied. 47 | * - If non-`nil`, the image will be recolored entierly using this color. 48 | * In that case, only the alpha component or the image is used 49 | */ 50 | @property(nonatomic, strong) UIColor* tintColor; 51 | 52 | /** 53 | * The background color to apply to the image when rendering into an `UIImage`. 54 | * 55 | * If `nil` (the default), the image will have a transparent background. 56 | */ 57 | @property(nonatomic, strong) UIColor* backgroundColor; 58 | 59 | /** 60 | * The drop shadow to add when rendering. 61 | * 62 | * If `nil` (the default), no drop shadow will be added. 63 | * 64 | * @note The shadow parameters (especially `shadowOffset` and `shadowBlurRadius`) 65 | * are expressed in the coordinate system of the original vector image, 66 | * (i.e. the scale of the values are the same as those of the `nativeSize`), 67 | * so that they are independant of the size the vector image will be rendered. 68 | */ 69 | @property(nonatomic, strong) NSShadow* shadow; 70 | 71 | /** 72 | * The insets (margins) to add to the vector image. 73 | * 74 | * You may use this property to add margins around the vector image 75 | * when you have set a `shadow`, to ensure its shadow won't be clipped. 76 | * You may also use this property to translate the image or to remove 77 | * margins (using negative values) that are too large in the original PDF. 78 | * 79 | * @note The insets are expressed in the coordinate system of the original 80 | * vector image (i.e. the scale of the values are the same as those of 81 | * the `nativeSize`), so that they are independant of the size the 82 | * vector image will be rendered. 83 | */ 84 | @property(nonatomic, assign) UIEdgeInsets insets; 85 | 86 | /** 87 | * If non-`nil`, this block will be called right before drawing the PDF 88 | * onto the bitmap context. Will allows you to fully customize the graphic 89 | * context for rendering, like applying an affine transform, etc. 90 | */ 91 | @property(nonatomic, copy) void(^prepareContextBlock)(CGContextRef ctx); 92 | 93 | /** 94 | * The size the Vector image was designed to be rendered in. 95 | */ 96 | @property(nonatomic, readonly) CGSize nativeSize; 97 | 98 | #pragma mark - Constructor 99 | 100 | /** 101 | * Returns a vector image from loading the first page of the PDF file 102 | * with the given name in the main bundle. 103 | * 104 | * @param pdfName The name of the PDF file in the main bundle 105 | * 106 | * @return The `OHVectorImage` corresponding to the first page of the PDF. 107 | * 108 | * @note PDF images are cached. 109 | */ 110 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName; 111 | 112 | /** 113 | * Returns a vector image from loading the first page of the PDF file 114 | * with the given name in the given bundle. 115 | * 116 | * @param pdfName The name of the PDF file in the main bundle 117 | * @param bundleOrNil The bundle in which to search the image in. 118 | * If `nil`, will use the main bundle. 119 | * 120 | * @return The `OHVectorImage` corresponding to the first page of the PDF. 121 | * 122 | * @note PDF pages are cached, but requesting a `OHVectorImage` with the same name 123 | * twice will still lead to a new `OHVectorImage` with independant tintColor 124 | * and backgroundColor. 125 | */ 126 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName 127 | inBundle:(NSBundle*)bundleOrNil; 128 | 129 | /** 130 | * Returns a vector image from loading the first page of the PDF file 131 | * at the given URL. 132 | * 133 | * @param pdfURL The URL of the PDF file to load 134 | * 135 | * @return The `OHVectorImage` corresponding to the first page of the PDF 136 | * 137 | * @note PDF pages are cached, but requesting a `OHVectorImage` with the same name 138 | * twice will still lead to a new `OHVectorImage` with independant `tintColor` 139 | * and `backgroundColor`. 140 | */ 141 | + (instancetype)imageWithPDFURL:(NSURL*)pdfURL; 142 | 143 | /** 144 | * Create a vector image from a PDF page 145 | * 146 | * @param pdfPage The OHPDFPage to create the image from 147 | * 148 | * @return The `OHVectorImage` corresponding to the given page of the PDF 149 | */ 150 | + (instancetype)imageWithPDFPage:(OHPDFPage*)pdfPage; 151 | 152 | #pragma mark - Rendering at a given size 153 | 154 | /** 155 | * Returns the horizontal and vertical scales to apply if we want 156 | * to render the PDF image to the given size. 157 | * 158 | * @param size The size to scale the image to. 159 | * 160 | * @return The scale to apply horizontally and vertically to the 161 | * `nativeSize` of the original PDF so that it fill the 162 | * given `size`. 163 | * 164 | * @note This takes the vector image's `insets` into account 165 | * when computing the scale. 166 | * 167 | * @note The method `sizeThatFits` uses the `MIN(width, height)` of the 168 | * `CGSize` returned by this method. 169 | */ 170 | - (CGSize)scaleForSize:(CGSize)size; 171 | 172 | /** 173 | * Returns the CGSize that would make the `OHVectorImage` fit in the 174 | * given size while keeping its aspect ratio. 175 | * 176 | * @param size The bounding box size in which the image should fit. 177 | * Use `CGFLOAT_MAX` for either of the dimensions to force 178 | * fitting only on the other dimension (e.g. use 179 | * `CGSizeMake(20, CGFLOAT_MAX)` to get the size that fits 180 | * a width of 20 points). 181 | * 182 | * @return The maximum size of the image so that it fits in the given 183 | * size without changing its aspect ratio. 184 | * 185 | * @note If the size contains fractional width or height, it is rounded 186 | * to the smallest integer value (using `roundf`) to avoid subpixelling 187 | * and blurry edges on the final image) 188 | */ 189 | - (CGSize)sizeThatFits:(CGSize)size; 190 | 191 | /** 192 | * Render the `OHVectorImage` as a bitmap image with the given size 193 | * 194 | * @param size The size to render the image 195 | * 196 | * @return The `UIImage` obtained by rendering the vector image to the given size. 197 | * 198 | * @note This method uses the various `OHVectorImage`'s properties 199 | * (`tintColor`, `backgroundColor`, `shadow`, `insets`) when rendering. 200 | * 201 | * @note If the size contains fractional width or height, it is rounded 202 | * to the smallest integer value (using `roundf`) to avoid subpixelling 203 | * and blurry edges on the final image) 204 | */ 205 | - (UIImage*)renderAtSize:(CGSize)size; 206 | 207 | 208 | /** 209 | * Render the `OHVectorImage` as a bitmap image with a size fitting the given size 210 | * 211 | * @param size The bounding box size to render the image in. 212 | * Use `CGFLOAT_MAX` for either of the dimensions to force 213 | * fitting only on the other dimension (e.g. use 214 | * `CGSizeMake(20, CGFLOAT_MAX)` to get the size that fits 215 | * a width of 20 points). 216 | * 217 | * @return The `UIImage` obtained by rendering the vector image to size fitting 218 | * the given size. 219 | * 220 | * @note This method is a convenience method that basically calls `renderAtSize:` 221 | * with the size obtained by calling `sizeThatFits:` on the given size. 222 | * 223 | * @note This method uses the various `OHVectorImage`'s properties 224 | * (`tintColor`, `backgroundColor`, `shadow`, `insets`) when rendering. 225 | */ 226 | - (UIImage*)renderAtSizeThatFits:(CGSize)size; 227 | 228 | @end 229 | -------------------------------------------------------------------------------- /OHPDFImage/OHVectorImage.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import "OHVectorImage.h" 26 | #import "OHPDFDocument.h" 27 | #import "OHPDFPage.h" 28 | 29 | /***********************************************************************************/ 30 | 31 | @interface OHVectorImage() 32 | - (instancetype)initWithPDFPage:(OHPDFPage*)pdfPage NS_DESIGNATED_INITIALIZER; 33 | @property(nonatomic, strong) OHPDFPage* pdfPage; 34 | @end 35 | 36 | 37 | @implementation OHVectorImage 38 | 39 | #pragma mark - Constructor 40 | 41 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName 42 | { 43 | return [self imageWithPDFNamed:pdfName inBundle:nil]; 44 | } 45 | 46 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName 47 | inBundle:(NSBundle*)bundleOrNil 48 | { 49 | if (!pdfName) return nil; 50 | 51 | NSString* basename = [pdfName stringByDeletingPathExtension]; 52 | NSString* ext = [pdfName pathExtension]; 53 | if (ext.length == 0) ext = @"pdf"; 54 | NSURL* url = [(bundleOrNil?:[NSBundle mainBundle]) URLForResource:basename withExtension:ext]; 55 | return [self imageWithPDFURL:url]; 56 | } 57 | 58 | + (instancetype)imageWithPDFURL:(NSURL*)pdfURL 59 | { 60 | if (!pdfURL) return nil; 61 | 62 | static size_t const kDefaultPDFPageIndexForVectorImage = 1; // Use first page by default 63 | static NSCache* pdfCache; 64 | static dispatch_once_t onceToken; 65 | dispatch_once(&onceToken, ^{ 66 | pdfCache = [NSCache new]; 67 | }); 68 | 69 | OHPDFPage* page = [pdfCache objectForKey:pdfURL]; 70 | if (!page) 71 | { 72 | OHPDFDocument* doc = [OHPDFDocument documentWithURL:pdfURL]; 73 | page = [doc pageAtIndex:kDefaultPDFPageIndexForVectorImage]; 74 | if (page) 75 | { 76 | [pdfCache setObject:page forKey:pdfURL]; 77 | } 78 | } 79 | 80 | return [self imageWithPDFPage:page]; 81 | } 82 | 83 | + (instancetype)imageWithPDFPage:(OHPDFPage*)pdfPage 84 | { 85 | return [[self alloc] initWithPDFPage:pdfPage]; 86 | } 87 | 88 | - (instancetype)initWithPDFPage:(OHPDFPage*)pdfPage 89 | { 90 | if (!pdfPage) return nil; 91 | 92 | self = [super init]; 93 | if (self) 94 | { 95 | _pdfPage = pdfPage; 96 | _nativeSize = pdfPage.mediaBox.size; 97 | } 98 | return self; 99 | } 100 | 101 | - (id)copyWithZone:(NSZone *)zone 102 | { 103 | OHVectorImage* copy = [OHVectorImage imageWithPDFPage:self.pdfPage]; 104 | copy.tintColor = [self.tintColor copy]; 105 | copy.backgroundColor = [self.backgroundColor copy]; 106 | copy.shadow = [self.shadow copy]; 107 | copy.insets = self.insets; 108 | copy.prepareContextBlock = [self.prepareContextBlock copy]; 109 | return copy; 110 | } 111 | 112 | #pragma mark - Rendering at a given size 113 | 114 | - (CGSize)insetNativeSize 115 | { 116 | return (CGSize){ 117 | .width = self.nativeSize.width + self.insets.left + self.insets.right, 118 | .height = self.nativeSize.height + self.insets.top + self.insets.bottom 119 | }; 120 | } 121 | - (CGSize)scaleForSize:(CGSize)size 122 | { 123 | static CGFloat const kScaleFactorIdentity = 1.0; 124 | CGFloat sx = kScaleFactorIdentity; 125 | CGFloat sy = kScaleFactorIdentity; 126 | 127 | CGSize insetSize = self.insetNativeSize; 128 | if (!CGSizeEqualToSize(insetSize, CGSizeZero)) 129 | { 130 | sx = size.width / insetSize.width; 131 | sy = size.height / insetSize.height; 132 | } 133 | 134 | return CGSizeMake(sx,sy); 135 | } 136 | 137 | - (CGSize)sizeThatFits:(CGSize)size 138 | { 139 | CGSize scale = [self scaleForSize:size]; 140 | CGFloat minScale = MIN(scale.width, scale.height); 141 | 142 | return (CGSize){ 143 | .width = roundf(self.insetNativeSize.width * minScale), 144 | .height = roundf(self.insetNativeSize.height * minScale) 145 | }; 146 | } 147 | 148 | - (UIImage*)renderAtSize:(CGSize)size 149 | { 150 | if ((size.width <= 0) || (size.height <= 0)) 151 | { 152 | return nil; 153 | } 154 | 155 | CGRect fullRect = CGRectIntegral( (CGRect){ .origin = CGPointZero, .size = size } ); 156 | CGSize imageSize = fullRect.size; // Extract it back, because CGRectIntegral may have rounded it 157 | 158 | CGSize scale = [self scaleForSize:size]; 159 | UIEdgeInsets scaledInsets = (UIEdgeInsets){ 160 | .top = self.insets.top * scale.height, 161 | .left = self.insets.left * scale.width, 162 | .bottom = self.insets.bottom * scale.height, 163 | .right = self.insets.right * scale.width 164 | }; 165 | 166 | UIImage* rasterImage = [self generateImageWithSize:imageSize drawingBlock:^(CGContextRef ctx) { 167 | if (self.tintColor) 168 | { 169 | // Generate a mask using the PDF 170 | UIImage* mask = [self generateImageWithSize:imageSize drawingBlock:^(CGContextRef ctx) { 171 | // - flipped=YES because we will use its CGImage with CGContextClipToMask 172 | // which is in CoreGraphics coordinate system — which is inverted compared 173 | // to the UIKit coordinate system. 174 | CGRect insetRect = CGRectIntegral( UIEdgeInsetsInsetRect(fullRect, scaledInsets) ); 175 | [self.pdfPage drawInContext:ctx rect:insetRect flipped:YES]; 176 | }]; 177 | // Use the mask to generate a tinted image 178 | CGContextClipToMask(ctx, fullRect, mask.CGImage); 179 | CGContextSetFillColorWithColor(ctx, self.tintColor.CGColor); 180 | CGContextFillRect(ctx, fullRect); 181 | } 182 | else 183 | { 184 | // Directly render the image in a bitmap context. 185 | // Note: we need to flip the insetRect to match the CoreGraphics orientation 186 | CGRect insetRect = CGRectIntegral( UIEdgeInsetsInsetRect(fullRect, (UIEdgeInsets){ 187 | .top = scaledInsets.bottom, .bottom = scaledInsets.top, 188 | .left = scaledInsets.left, .right = scaledInsets.right 189 | }) ); 190 | [self.pdfPage drawInContext:ctx rect:insetRect flipped:NO]; 191 | } 192 | }]; 193 | 194 | // Render the final image using prepareContextBlock, backgroundColor and shadow 195 | return [self generateImageWithSize:imageSize drawingBlock:^(CGContextRef ctx) { 196 | // If the user provided a block to execute before rendering, apply it now 197 | if (self.prepareContextBlock) self.prepareContextBlock(ctx); 198 | 199 | // If we have a background color, fill the image with it 200 | if (self.backgroundColor != nil) 201 | { 202 | CGContextSetFillColorWithColor(ctx, self.backgroundColor.CGColor); 203 | // Add 1 to width and height to fill everything, even the bottom and right borders 204 | CGRect rect = CGRectMake(0.0f, 0.0f, size.width+1, size.height+1); 205 | CGContextFillRect(ctx, rect); 206 | } 207 | 208 | // If we have a shadow, apply it now 209 | if (self.shadow) 210 | { 211 | UIColor* shadowColor = (UIColor*)self.shadow.shadowColor; 212 | // Convert offset and radius from nativeSize scale to target size scale 213 | CGSize offset = (CGSize){ 214 | .width = self.shadow.shadowOffset.width * scale.width, 215 | .height = self.shadow.shadowOffset.height * scale.height 216 | }; 217 | CGFloat radius = self.shadow.shadowBlurRadius * (scale.width+scale.height)/2; 218 | CGContextSetShadowWithColor(ctx, offset, radius, shadowColor.CGColor); 219 | } 220 | 221 | // Finally, draw the rastered image 222 | CGContextDrawImage(ctx, fullRect, rasterImage.CGImage); 223 | }]; 224 | } 225 | 226 | - (UIImage*)renderAtSizeThatFits:(CGSize)size 227 | { 228 | return [self renderAtSize:[self sizeThatFits:size]]; 229 | } 230 | 231 | #pragma mark - Private Methods 232 | 233 | - (UIImage*)generateImageWithSize:(CGSize)size 234 | drawingBlock:( void(^)(CGContextRef ctx) )drawingBlock 235 | { 236 | UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); 237 | drawingBlock( UIGraphicsGetCurrentContext() ); 238 | UIImage* image = UIGraphicsGetImageFromCurrentImageContext(); 239 | UIGraphicsEndImageContext(); 240 | 241 | return image; 242 | }; 243 | 244 | @end 245 | -------------------------------------------------------------------------------- /OHPDFImage/UIImage+OHPDF.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import 26 | 27 | /***********************************************************************************/ 28 | 29 | /** 30 | * Thic category adds support for PDF files. 31 | * It allows you to use PDF files as vector images and render them at arbitrary 32 | * sizes, ensuring the scaling is done smoothing using vector graphics from the PDF. 33 | */ 34 | @interface UIImage (OHPDFImage) 35 | /** 36 | * Returns an UIImage build from loading the first page of the PDF file 37 | * with the given name in the main bundle and rendering it as the given size 38 | * 39 | * @param pdfName The name of the PDF file in the main bundle 40 | * @param size The bounding box size in which to render the image. 41 | * - If CGSizeZero, it will be rendered using the PDF's MediaBox. 42 | * - Otherwise, the image will be rendered such as it fits in the size 43 | * and keep its aspect ratio. 44 | * - Use `CGFLOAT_MAX` for either of the dimensions to force 45 | * fitting only on the other dimension (e.g. use 46 | * `CGSizeMake(20, CGFLOAT_MAX)` to get the size that fits 47 | * a width of 20 points). 48 | * 49 | * @return The UIImage corresponding to the first page of the PDF rendered at the given size. 50 | * 51 | * @note PDF Images are cached so that requesting it a second time with a different size will 52 | * not load the PDF file again. 53 | */ 54 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName 55 | fitInSize:(CGSize)size; 56 | 57 | /** 58 | * Returns an UIImage build from loading the first page of the PDF file 59 | * with the given name in the given bundle and rendering it as the given size 60 | * 61 | * @param pdfName The name of the PDF file in the main bundle 62 | * @param bundleOrNil The bundle in which to search the image in. If nil, will use the main bundle. 63 | * @param size The bounding box size in which to render the image. 64 | * - If CGSizeZero, it will be rendered using the PDF's MediaBox. 65 | * - Otherwise, the image will be rendered such as it fits in the size 66 | * and keep its aspect ratio 67 | * 68 | * @return The UIImage corresponding to the first page of the PDF rendered at the given size. 69 | * 70 | * @note PDF Images are cached so that requesting it a second time with a different size will 71 | * not load the PDF file again. 72 | */ 73 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName 74 | inBundle:(NSBundle*)bundleOrNil 75 | fitInSize:(CGSize)size; 76 | @end 77 | -------------------------------------------------------------------------------- /OHPDFImage/UIImage+OHPDF.m: -------------------------------------------------------------------------------- 1 | /*********************************************************************************** 2 | * 3 | * Copyright (c) 2014 Olivier Halligon 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | * 23 | ***********************************************************************************/ 24 | 25 | #import "UIImage+OHPDF.h" 26 | #import "OHVectorImage.h" 27 | 28 | /***********************************************************************************/ 29 | 30 | @implementation UIImage (OHPDFImage) 31 | 32 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName 33 | fitInSize:(CGSize)size; 34 | { 35 | return [self imageWithPDFNamed:pdfName inBundle:nil fitInSize:size]; 36 | } 37 | 38 | + (instancetype)imageWithPDFNamed:(NSString*)pdfName 39 | inBundle:(NSBundle*)bundleOrNil 40 | fitInSize:(CGSize)size 41 | { 42 | OHVectorImage* vImage = [OHVectorImage imageWithPDFNamed:pdfName inBundle:bundleOrNil]; 43 | return [vImage renderAtSizeThatFits:size]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OHPDFImage 2 | 3 | 4 | [![Version](http://cocoapod-badges.herokuapp.com/v/OHPDFImage/badge.png)](http://cocoadocs.org/docsets/OHPDFImage) 5 | [![Platform](http://cocoapod-badges.herokuapp.com/p/OHPDFImage/badge.png)](http://cocoadocs.org/docsets/OHPDFImage) 6 | [![Build Status](https://travis-ci.org/AliSoftware/OHPDFImage.png?branch=master)](https://travis-ci.org/AliSoftware/OHPDFImage) 7 | 8 | 9 | This library intends to easily load PDF documents to use them as vector images. 10 | 11 | ## Installation 12 | 13 | The recommended way to install this library is using [CocoaPods](http://guides.cocoapods.org). Simply add it to your `Podfile`: 14 | 15 | ``` 16 | pod 'OHPDFImage' 17 | ``` 18 | 19 | ## Adding PDF files to your project 20 | 21 | If you intend to use a PDF as a vector image, you should add it as a resource in your project. Especially, you should **NOT** add the PDF in your `Images.xcassets` Assets Catalog. 22 | 23 | #### Don't use Assets Catalog for PDF files 24 | 25 | Xcode 6 accept PDF files to be added to an Assets Catalog, but when you do so, it in fact re-create PNG assets at compile time, embedding the rasterized bitmaps in the final application instead of embedding the original PDF vector image. That's why you should add the PDF file as a standard resource and not in the `xcassets` catalog. 26 | 27 | #### Exporting PDF files from Photoshop 28 | 29 | If your vector image has been created using Photoshop and you intend to export it as PDF, you may choose the "Save As…" menu item and choose the "Photoshop PDF" file format to create the PDF. 30 | In that case, be careful to select the **"High Quality Print" preset**, which is the only preset that conserve the PDF transparency / alpha channel. 31 | 32 | ## Using a PDF as an image 33 | 34 | ### The `UIImage` category 35 | 36 | If you simply intend to use the PDF as an image as-is, you can use: 37 | 38 | ```objc 39 | self.imageView.image = [UIImage imageWithPDFNamed:@"vector_image" 40 | fitInSize:self.imageView.bounds.size]; 41 | ``` 42 | 43 | This will load the PDF, use its first page to create an `OHVectorImage`, then rasterize this vector image as an `UIImage` of the requested size, ensuring to keep its aspect ratio. 44 | 45 | > Note: PDF pages are cached, so that requesting an image with the same PDF name, even with a different size, will use the cached version of the PDF instead of loading it again from disk. Thus, only the rasterization into a bitmap image is recreated. 46 | 47 | ### More control with the `OHVectorImage` class 48 | 49 | If you need more options on how the vector image will be rendered, you can directly manipulate `OHVectorImage` objects. Here is what you can do when using `OHVectorImage`: 50 | 51 | * **Change the background color** of the generated image using the `backgroundColor` property (`nil` to generate transparent images); 52 | * **Re-tint the image** using the `tintColor` property (in that case the PDF is merely used as a mask for which only its alpha channel is used); 53 | * **Add a drop shadow** using the `shadow` property (a `NSShadow` object that lets you customize the shadow offset, blur radius and color); 54 | * **Add insets** (`UIEdgeInsets`) to the image when rendering: 55 | * either to translate the image to any direction, 56 | * or to add margins to the image (useful when you add a drop shadow to ensure it is not clipped), 57 | * or to reduce/remove margins present in the original PDF (by using negative insets) 58 | * ... 59 | * **Customize the graphic context** before the vector image is rendered, using the `prepareContextBlock` property 60 | * This is mostly intended for advanced usage, like applying a custom transform or adding a custom clipping path to the `CGContextRef` before rendering the PDF vector image. 61 | 62 | #### Drop shadow and insets 63 | 64 | Drop shadow values (offset and blur radius) as well as insets are expressed in the coordinate system of the vector image (i.e. with the same scale as when the vector image is rendered using its `nativeSize`), so that they can be resolution-independant. 65 | 66 | This way, if you add a drop shadow with `shadowOffset = (CGSize){2,2}` and `blurRadius = 3` then you can safely use an `inset = (UIEdgeInsets){ .right = 5, .bottom = 5 }` to ensure the shadow won't be clipped, without worrying about the size at which the image will be rendered. 67 | 68 | #### Keeping aspect ratio 69 | 70 | * When you call `-[OHVectorImage renderAtSize:]` with the expected size, it does not try to keep the aspect ratio, and simply use the given size as-is, stretching the image if necessary ("Scale to Fill" behavior). 71 | 72 | * If you want to keep the aspect ratio of the original PDF, you can compute the size that fits a given size using `-[OHVectorImage sizeThatFits:]` first, and then use this size when calling `-[OHVectorImage renderAtSize:]`. 73 | 74 | > _Note: This is actually what `+[UIImage imageWithPDFNamed:fitInSize:]` does internally._ 75 | 76 | The `sizeThatFits:` method takes the vector image's `insets` property into account when computing the fitting size — as these `insets` values will be applied when rendering as well. 77 | 78 | * As wanting to keep the aspect ratio is a quite common case, a convenience method `-[OHVectorImage renderAtSizeThatFits:]` is provided that simply calls the two aforementioned methods one after the other. 79 | 80 | * You may also use the `-[OHVectorImage scaleForSize:]` method that returns a `CGSize` containing the scale factors (both horizontal and vertical) to apply to scale the vector image to the given size. This basically returns the result of dividing the given `size` by the vector image's `nativeSize`, but also taking the `insets` into account. 81 | 82 | > Note: `sizeThatFits:` actually uses `MIN(width, height)` of these scale factors to determine the scale factor to "aspect fit" the image in the provided size. If you instead need to scale the image so it does an "aspect fill" scaling — cropping the image if necessary to fill the whole size — you may instead use `MAX(width, height)` to compute the scale and thus the size at which to render the image. 83 | 84 | #### Example 85 | 86 | ```objc 87 | OHVectorImage* vImage = [OHVectorImage imageWithPDFNamed:@"vector_image"]; 88 | vImage.backgroundColor = [UIColor colorWithRed:0.9 green:1.0 blue:0.9 alpha:1.0]; 89 | vImage.tintColor = [UIColor redColor]; 90 | // Shadow & Insets 91 | vImage.shadow = [NSShadow new]; 92 | vImage.shadow.shadowOffset = CGSizeMake(2,2); 93 | vImage.shadow.shadowBlurRadius = 3.f; 94 | vImage.shadow.shadowColor = [UIColor darkGrayColor]; 95 | vImage.insets = UIEdgeInsetsMake(0,0,5,5); 96 | // Render as an UIImage, ensuring to keep aspect ratio 97 | UIImage* image = [vImage renderAtSizeThatFits:imageViewSize]; 98 | ``` 99 | 100 | A complete example is also available in the Demo project provided in this repo. 101 | Don't hesitate to try it (you may use `pod try OHPDFImage` to give it a try even if you haven't cloned the repo yet!) 102 | 103 | ## Loading a PDF document 104 | 105 | The main goal of this library is to use PDF as images using the `UIImage` category or `OHVectorImage` class directly. 106 | 107 | However, you can also use the `OHPDFDocument` and `OHPDFPage` classes to load a PDF document and get its pages, and render those pages individually in a graphic context (`CGContextRef`) you provide. 108 | 109 | You can also use this to fetch an arbitrary page of a given PDF to generate a vector image (instead of using the first page, which is the default). 110 | For example, the following code read every page of a PDF as a vector image and build an animated `UIImage` from it: 111 | 112 | ```objc 113 | NSURL* pdfURL = [[NSBundle mainBundle] URLForResource:@"vector_images" withExtension:@"pdf"]; 114 | OHPDFDocument* doc = [OHPDFDocument documentWithURL:pdfURL]; 115 | NSMutableArray* frames = [NSMutableArray arrayWithCapacity:doc.pagesCount]; 116 | CGSize frameSize = CGSizeMake(100,100); 117 | for(size_t pageNum = 0; pageNum < doc.pagesCount; ++pageNum) 118 | { 119 | OHPDFPage* page = [doc pageAtIndex:pageNum+1]; // Note: page indexes start at 1 120 | OHVectorImage* vImage = [OHVectorImage imageWithPDFPage:page]; 121 | [frames addObject:[vImages renderAtSize:frameSize]]; 122 | } 123 | 124 | NSTimeInterval duration = doc.pagesCount * 2.0; // 2.0s per frame 125 | UIImage* animatedImage = [UIImage animatedImageWithImages:frames 126 | duration:duration]; 127 | ``` 128 | 129 | ## License 130 | 131 | This library is authored by Olivier Halligon and is distributed under the MIT License (see `LICENSE` file). 132 | --------------------------------------------------------------------------------