├── .gitignore ├── LICENSE ├── LxPDFParser ├── LxPDFParser.h └── LxPDFParser.m ├── LxPDFParserDemo ├── LxPDFParser.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── LxPDFParser │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── CatalogueNodeCell.h │ ├── CatalogueNodeCell.m │ ├── CatalogueNodeCell.xib │ ├── CatalogueTableViewController.h │ ├── CatalogueTableViewController.m │ ├── CatalogueTableViewController.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── PDFBrowserViewController.h │ ├── PDFBrowserViewController.m │ ├── PDFCollectionViewController.h │ ├── PDFCollectionViewController.m │ ├── PDFCollectionViewController.xib │ ├── PDFFacilityCollectionViewCell.h │ ├── PDFFacilityCollectionViewCell.m │ ├── PDFFacilityCollectionViewCell.xib │ ├── PDFNodeDisplayCell.h │ ├── PDFNodeDisplayCell.m │ ├── PDFTableViewController.h │ ├── PDFTableViewController.m │ ├── ViewController.h │ ├── ViewController.m │ ├── ic_drawer_creation_notask.png │ ├── ic_drawer_creation_notask@2x.png │ └── main.m ├── LxPDFParserTests │ ├── Info.plist │ └── LxPDFParserTests.m └── drawingwithquartz2d.pdf └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /LxPDFParser/LxPDFParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // LxPDFParser.h 3 | // PDFCategory 4 | // 5 | // PDF's physical structure and logical structure: 6 | // http://blog.csdn.net/bobob/article/details/4328426 7 | // http://blog.csdn.net/bobob/article/details/4328450 8 | // http://blog.csdn.net/xzz/article/details/4447123 9 | 10 | #import 11 | #import 12 | 13 | typedef void (*CGPDFArrayApplierFunction)(size_t index, CGPDFObjectRef value, void *info); 14 | 15 | void CGPDFArrayApplyFunction(CGPDFArrayRef array, CGPDFArrayApplierFunction function, void * info); 16 | 17 | @interface CatalogueNodeModel : NSObject 18 | 19 | @property (nonatomic,copy) NSString * name; 20 | @property (nonatomic,assign) NSUInteger depth; 21 | @property (nonatomic,strong) NSMutableArray * childNodeArray; 22 | @property (nonatomic,weak) CatalogueNodeModel * parentNode; 23 | @property (nonatomic,assign) NSUInteger pageIndex; // Not implementate temporarily. 24 | 25 | - (instancetype)initWithName:(NSString *)name; 26 | 27 | @end 28 | 29 | @interface LxPDFParser : NSObject 30 | 31 | - (instancetype)initWithPDFDocumentPath:(NSString *)path; 32 | 33 | @property (nonatomic, readonly) NSString * filePath; 34 | @property (nonatomic, readonly) NSInteger pageCount; 35 | @property (nonatomic, readonly) NSDictionary * catalogDictionary; 36 | @property (nonatomic, readonly) CatalogueNodeModel * rootCatalogueNode; 37 | 38 | - (NSArray *)keyArrayOfPDFDictionary:(CGPDFDictionaryRef)pdfDictionary; 39 | 40 | /** 41 | * Return contents for keyPath in PDF file's structure. 42 | * 43 | * @param keyPath Use NSString object represents NSDictionary object's key, NSNumber object represents NSArray object's index. 44 | * 45 | * @return contents for keyPath. 46 | */ 47 | - (id)valueForPDFKeyPath:(NSArray *)keyPath; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /LxPDFParser/LxPDFParser.m: -------------------------------------------------------------------------------- 1 | // 2 | // LxPDFParser.m 3 | // PDFCategory 4 | // 5 | 6 | #import "LxPDFParser.h" 7 | 8 | #define PRINTF(fmt, ...) printf("%s\n",[[NSString stringWithFormat:fmt,##__VA_ARGS__]UTF8String]) 9 | 10 | typedef void (*CGPDFArrayApplierFunction)(size_t index, CGPDFObjectRef value, void *info); 11 | 12 | void CGPDFArrayApplyFunction(CGPDFArrayRef array, CGPDFArrayApplierFunction function, void * info) 13 | { 14 | size_t pdfArrayCount = CGPDFArrayGetCount(array); 15 | for (size_t i = 0; i < pdfArrayCount; i++) { 16 | CGPDFObjectRef pdfObject = 0; 17 | CGPDFArrayGetObject(array, i, &pdfObject); 18 | function(i, pdfObject, info); 19 | } 20 | } 21 | 22 | @implementation CatalogueNodeModel 23 | 24 | - (instancetype)init 25 | { 26 | NSAssert(NO, @"CatalogueNode must use initWithName: method to be instantiated!"); // 27 | return nil; 28 | } 29 | 30 | - (instancetype)initWithName:(NSString *)name 31 | { 32 | if (self = [super init]) { 33 | _name = name; 34 | } 35 | return self; 36 | } 37 | 38 | - (NSMutableArray *)childNodeArray 39 | { 40 | if (_childNodeArray == nil) { 41 | _childNodeArray = [[NSMutableArray alloc]init]; 42 | } 43 | return _childNodeArray; 44 | } 45 | 46 | @end 47 | 48 | @implementation LxPDFParser 49 | { 50 | CGPDFDocumentRef _pdfDocument; 51 | } 52 | @synthesize filePath = _filePath, rootCatalogueNode = _rootCatalogueNode; 53 | 54 | - (void)dealloc 55 | { 56 | if (_pdfDocument) { 57 | CGPDFDocumentRelease(_pdfDocument); 58 | _pdfDocument = 0; 59 | } 60 | } 61 | 62 | - (instancetype)init 63 | { 64 | NSAssert(0, @"LxPDFParser must use initWithPDFDocumentPath: method to be instantiated!"); 65 | return nil; 66 | } 67 | 68 | - (instancetype)initWithPDFDocumentPath:(NSString *)path 69 | { 70 | if (self = [super init]) { 71 | 72 | NSAssert(path.length > 0, @"LxPDFParser: Error PDF document path."); 73 | 74 | CFStringRef pathString = CFStringCreateWithCString(kCFAllocatorDefault, path.UTF8String, kCFStringEncodingUTF8); 75 | 76 | NSAssert(pathString, @"LxPDFParser: Error PDF document path."); 77 | 78 | CFURLRef pathUrl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pathString, kCFURLPOSIXPathStyle, false); 79 | 80 | NSAssert(pathUrl, @"LxPDFParser: Error PDF document path."); 81 | 82 | CFRelease(pathString); 83 | 84 | _pdfDocument = CGPDFDocumentCreateWithURL(pathUrl); 85 | 86 | NSAssert(_pdfDocument, @"LxPDFParser: Error PDF document path."); 87 | 88 | _filePath = path; 89 | } 90 | return self; 91 | } 92 | 93 | - (NSString *)filePath 94 | { 95 | return _filePath; 96 | } 97 | 98 | - (NSInteger)pageCount 99 | { 100 | size_t pageCount = CGPDFDocumentGetNumberOfPages(_pdfDocument); 101 | return (NSInteger)pageCount; 102 | } 103 | 104 | - (NSDictionary *)catalogDictionary 105 | { 106 | CGPDFDictionaryRef pdfCatalogDictionary = CGPDFDocumentGetCatalog(_pdfDocument); 107 | 108 | NSMutableDictionary * catalogDictionary = [NSMutableDictionary dictionary]; 109 | 110 | CGPDFDictionaryApplyFunction(pdfCatalogDictionary, pdfDictionaryHandler, (__bridge void *)(catalogDictionary)); 111 | 112 | return [NSDictionary dictionaryWithDictionary:catalogDictionary]; 113 | } 114 | 115 | #define kOutlines "Outlines" 116 | #define kTitle "Title" 117 | #define kFirst "First" 118 | #define kNext "Next" 119 | 120 | - (CatalogueNodeModel *)rootCatalogueNode 121 | { 122 | if (_rootCatalogueNode != nil) { 123 | return _rootCatalogueNode; 124 | } 125 | 126 | CGPDFDictionaryRef catalogPDFDict = CGPDFDocumentGetCatalog(_pdfDocument); 127 | CGPDFDictionaryRef outlinesPDFDict = 0; 128 | CGPDFDictionaryGetDictionary(catalogPDFDict, kOutlines, &outlinesPDFDict); 129 | CGPDFDictionaryRef outlinesFirstPDFDict = 0; 130 | CGPDFDictionaryGetDictionary(outlinesPDFDict, kFirst, &outlinesFirstPDFDict); 131 | CGPDFStringRef rootCatalogueNodeTitle = 0; 132 | CGPDFDictionaryGetString(outlinesFirstPDFDict, kTitle, &rootCatalogueNodeTitle); 133 | 134 | CFStringRef rootCatalogueNodeTitleString = CGPDFStringCopyTextString(rootCatalogueNodeTitle); 135 | _rootCatalogueNode = [[CatalogueNodeModel alloc]initWithName:(__bridge_transfer NSString *)rootCatalogueNodeTitleString]; 136 | _rootCatalogueNode.parentNode = nil; 137 | _rootCatalogueNode.depth = 0; 138 | [self updateCatalogueNode:_rootCatalogueNode byItsDictionary:outlinesFirstPDFDict]; 139 | 140 | return _rootCatalogueNode; 141 | } 142 | 143 | - (void)updateCatalogueNode:(CatalogueNodeModel *)node byItsDictionary:(CGPDFDictionaryRef)nodeDict 144 | { 145 | CGPDFDictionaryRef firstPDFDict = 0; 146 | CGPDFDictionaryGetDictionary(nodeDict, kFirst, &firstPDFDict); 147 | CGPDFDictionaryRef nextPDFDict = 0; 148 | CGPDFDictionaryGetDictionary(nodeDict, kNext, &nextPDFDict); 149 | 150 | CGPDFStringRef title = 0; 151 | 152 | if (firstPDFDict) { 153 | 154 | CGPDFDictionaryGetString(firstPDFDict, kTitle, &title); 155 | CFStringRef titleString = CGPDFStringCopyTextString(title); 156 | CatalogueNodeModel * childNode = [[CatalogueNodeModel alloc]initWithName:(__bridge_transfer NSString *)titleString]; 157 | childNode.depth = node.depth + 1; 158 | childNode.parentNode = node; 159 | [self updateCatalogueNode:childNode byItsDictionary:firstPDFDict]; 160 | [node.childNodeArray insertObject:childNode atIndex:0]; 161 | } 162 | 163 | if (nextPDFDict) { 164 | 165 | CGPDFDictionaryGetString(nextPDFDict, kTitle, &title); 166 | CFStringRef titleString = CGPDFStringCopyTextString(title); 167 | CatalogueNodeModel * nextNode = [[CatalogueNodeModel alloc]initWithName:(__bridge_transfer NSString *)titleString]; 168 | nextNode.depth = node.depth; 169 | nextNode.parentNode = node.parentNode; 170 | [self updateCatalogueNode:nextNode byItsDictionary:nextPDFDict]; 171 | [node.parentNode.childNodeArray insertObject:nextNode atIndex:0]; 172 | } 173 | } 174 | 175 | void PDFDictionaryGetKeyApplierFunction(const char *key, 176 | CGPDFObjectRef value, void *info) 177 | { 178 | NSMutableArray * keyArray = (__bridge NSMutableArray *)info; 179 | [keyArray addObject:[NSString stringWithUTF8String:key]]; 180 | } 181 | 182 | - (NSArray *)keyArrayOfPDFDictionary:(CGPDFDictionaryRef)pdfDictionary 183 | { 184 | NSMutableArray * keyArray = [NSMutableArray array]; 185 | 186 | CGPDFDictionaryApplyFunction(pdfDictionary, PDFDictionaryGetKeyApplierFunction, (__bridge void *)(keyArray)); 187 | 188 | return [NSArray arrayWithArray:keyArray]; 189 | } 190 | 191 | 192 | - (id)valueForPDFKeyPath:(NSArray *)keyPath 193 | { 194 | id resultValue = nil; 195 | 196 | CGPDFArrayRef pdfArray = 0; 197 | CGPDFDictionaryRef pdfDictionary = CGPDFDocumentGetCatalog(_pdfDocument); 198 | 199 | NSMutableArray * resultArray = [NSMutableArray array]; 200 | NSMutableDictionary * resultDictionary = [NSMutableDictionary dictionary]; 201 | 202 | CGPDFDictionaryApplyFunction(pdfDictionary, pdfDictionaryHandler, (__bridge void *)(resultDictionary)); 203 | resultValue = resultDictionary; 204 | 205 | CGPDFObjectType pdfObjectType = kCGPDFObjectTypeNull; 206 | bool executeCorrect = true; 207 | for (id key in keyPath) { 208 | 209 | CGPDFObjectRef value; 210 | if ([key isKindOfClass:[NSString class]]) { 211 | 212 | CGPDFDictionaryGetObject(pdfDictionary, [key UTF8String], &value); 213 | } 214 | else if ([key isKindOfClass:[NSNumber class]]) { 215 | 216 | CGPDFArrayGetObject(pdfArray, (size_t)[key integerValue], &value); 217 | } 218 | else { 219 | 220 | } 221 | 222 | pdfObjectType = CGPDFObjectGetType(value); 223 | 224 | switch (pdfObjectType) { 225 | case kCGPDFObjectTypeNull: 226 | return @"null"; 227 | break; 228 | case kCGPDFObjectTypeBoolean: 229 | { 230 | CGPDFBoolean pdfBoolean = 0; 231 | executeCorrect = CGPDFObjectGetValue(value, pdfObjectType, &pdfBoolean); 232 | return pdfBoolean ? @1:@0; 233 | } 234 | break; 235 | case kCGPDFObjectTypeInteger: 236 | { 237 | CGPDFInteger pdfInteger = 0; 238 | executeCorrect = CGPDFObjectGetValue(value, pdfObjectType, &pdfInteger); 239 | return @(pdfInteger); 240 | } 241 | break; 242 | case kCGPDFObjectTypeReal: 243 | { 244 | CGPDFReal pdfReal = 0; 245 | executeCorrect = CGPDFObjectGetValue(value, pdfObjectType, &pdfReal); 246 | return @(pdfReal); 247 | } 248 | break; 249 | case kCGPDFObjectTypeName: 250 | { 251 | const char * pdfName = 0; 252 | executeCorrect = CGPDFObjectGetValue(value, pdfObjectType, &pdfName); 253 | return @(pdfName); 254 | } 255 | break; 256 | case kCGPDFObjectTypeString: 257 | { 258 | CGPDFStringRef pdfString = 0; 259 | executeCorrect = CGPDFObjectGetValue(value, pdfObjectType, &pdfString); 260 | CFStringRef string = CGPDFStringCopyTextString(pdfString); 261 | return (__bridge_transfer NSString *)string; 262 | } 263 | break; 264 | case kCGPDFObjectTypeArray: 265 | { 266 | [resultArray removeAllObjects]; 267 | 268 | if ([key isKindOfClass:[NSString class]]) { 269 | CGPDFDictionaryGetArray(pdfDictionary, [key UTF8String], &pdfArray); 270 | } 271 | else if ([key isKindOfClass:[NSNumber class]]) { 272 | CGPDFArrayGetArray(pdfArray, (size_t)[key integerValue], &pdfArray); 273 | } 274 | else { 275 | 276 | } 277 | 278 | CGPDFArrayApplyFunction(pdfArray, pdfArrayHandler, (__bridge void *)(resultArray)); 279 | resultValue = resultArray; 280 | } 281 | break; 282 | case kCGPDFObjectTypeDictionary: 283 | { 284 | [resultDictionary removeAllObjects]; 285 | 286 | if ([key isKindOfClass:[NSString class]]) { 287 | CGPDFDictionaryGetDictionary(pdfDictionary, [key UTF8String], &pdfDictionary); 288 | } 289 | else if ([key isKindOfClass:[NSNumber class]]) { 290 | CGPDFArrayGetDictionary(pdfArray, (size_t)[key integerValue], &pdfDictionary); 291 | } 292 | else { 293 | 294 | } 295 | 296 | CGPDFDictionaryApplyFunction(pdfDictionary, pdfDictionaryHandler, (__bridge void *)(resultDictionary)); 297 | resultValue = resultDictionary; 298 | } 299 | break; 300 | case kCGPDFObjectTypeStream: 301 | { 302 | CGPDFStreamRef pdfStream = 0; 303 | executeCorrect = CGPDFObjectGetValue(value, pdfObjectType, &pdfStream); 304 | CGPDFDataFormat pdfDataFormat; 305 | CFDataRef pdfStreamData = CGPDFStreamCopyData(pdfStream, &pdfDataFormat); 306 | NSString * streamString = [[NSString alloc]initWithData:(__bridge NSData *)pdfStreamData encoding:NSUTF8StringEncoding]; 307 | streamString = streamString ? streamString : @""; 308 | return streamString; 309 | // return @""; 310 | } 311 | break; 312 | default: 313 | break; 314 | } 315 | } 316 | 317 | return resultValue; 318 | } 319 | 320 | void pdfDictionaryHandler(const char * key, CGPDFObjectRef value, void * info) 321 | { 322 | bool executeCorrect = true; 323 | 324 | NSMutableDictionary * newDictionary = (__bridge NSMutableDictionary *)info; 325 | 326 | NSString * keyString = [NSString stringWithUTF8String:key]; 327 | 328 | CGPDFObjectType valueType = CGPDFObjectGetType(value); 329 | 330 | switch (valueType) { 331 | case kCGPDFObjectTypeNull: 332 | { 333 | [newDictionary setValue:@"null" forKey:keyString]; 334 | } 335 | break; 336 | case kCGPDFObjectTypeBoolean: 337 | { 338 | CGPDFBoolean pdfBoolean = 0; 339 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfBoolean); 340 | [newDictionary setValue:pdfBoolean ? @1:@0 forKey:keyString]; 341 | } 342 | break; 343 | case kCGPDFObjectTypeInteger: 344 | { 345 | CGPDFInteger pdfInteger = 0; 346 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfInteger); 347 | [newDictionary setValue:@(pdfInteger) forKey:keyString]; 348 | } 349 | break; 350 | case kCGPDFObjectTypeReal: 351 | { 352 | CGPDFReal pdfReal = 0; 353 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfReal); 354 | [newDictionary setValue:@(pdfReal) forKey:keyString]; 355 | } 356 | break; 357 | case kCGPDFObjectTypeName: 358 | { 359 | const char * pdfName = 0; 360 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfName); 361 | NSString * name = [NSString stringWithUTF8String:pdfName]; 362 | name = name ? name : @""; 363 | [newDictionary setValue:name forKey:keyString]; 364 | } 365 | break; 366 | case kCGPDFObjectTypeString: 367 | { 368 | CGPDFStringRef pdfString = 0; 369 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfString); 370 | CFStringRef string = CGPDFStringCopyTextString(pdfString); 371 | NSString * stringObject = (__bridge_transfer NSString *)string; 372 | stringObject = stringObject ? stringObject : @""; 373 | [newDictionary setValue:stringObject forKey:keyString]; 374 | } 375 | break; 376 | case kCGPDFObjectTypeArray: 377 | { 378 | CGPDFArrayRef pdfArray = 0; 379 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfArray); 380 | 381 | size_t objectsCount = CGPDFArrayGetCount(pdfArray); 382 | [newDictionary setValue:[NSString stringWithFormat:@"[ %d objects ]", (int)objectsCount] forKey:keyString]; 383 | } 384 | break; 385 | case kCGPDFObjectTypeDictionary: 386 | { 387 | CGPDFDictionaryRef pdfDictionary = 0; 388 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfDictionary); 389 | 390 | size_t keyValuePairsCount = CGPDFDictionaryGetCount(pdfDictionary); 391 | [newDictionary setValue:[NSString stringWithFormat:@"{ %d key/value pairs }", (int)keyValuePairsCount] forKey:keyString]; 392 | } 393 | break; 394 | case kCGPDFObjectTypeStream: 395 | { 396 | CGPDFStreamRef pdfStream = 0; 397 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfStream); 398 | CGPDFDataFormat pdfDataFormat; 399 | CFDataRef pdfStreamData = CGPDFStreamCopyData(pdfStream, &pdfDataFormat); 400 | NSString * streamString = [[NSString alloc]initWithData:(__bridge NSData *)pdfStreamData encoding:NSUTF8StringEncoding]; 401 | streamString = streamString ? streamString : @""; 402 | [newDictionary setValue:streamString forKey:keyString]; 403 | // [newDictionary setValue:@"" forKey:keyString]; 404 | } 405 | break; 406 | default: 407 | break; 408 | } 409 | if (!executeCorrect) { 410 | PRINTF(@"LxPDFParser 解析PDF文件发生错误"); // 411 | } 412 | } 413 | 414 | void pdfArrayHandler(size_t index, CGPDFObjectRef value, void * info) 415 | { 416 | bool executeCorrect = true; 417 | 418 | NSMutableArray * newArray = (__bridge NSMutableArray *)info; 419 | 420 | CGPDFObjectType valueType = CGPDFObjectGetType(value); 421 | 422 | switch (valueType) { 423 | case kCGPDFObjectTypeNull: 424 | { 425 | } 426 | break; 427 | case kCGPDFObjectTypeBoolean: 428 | { 429 | CGPDFBoolean pdfBoolean = 0; 430 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfBoolean); 431 | [newArray addObject:pdfBoolean ? @1:@0]; 432 | } 433 | break; 434 | case kCGPDFObjectTypeInteger: 435 | { 436 | CGPDFInteger pdfInteger = 0; 437 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfInteger); 438 | [newArray addObject:@(pdfInteger)]; 439 | } 440 | break; 441 | case kCGPDFObjectTypeReal: 442 | { 443 | CGPDFReal pdfReal = 0; 444 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfReal); 445 | [newArray addObject:@(pdfReal)]; 446 | } 447 | break; 448 | case kCGPDFObjectTypeName: 449 | { 450 | const char * pdfName = 0; 451 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfName); 452 | NSString * name = [NSString stringWithUTF8String:pdfName]; 453 | name = name ? name : @""; 454 | [newArray addObject:name]; 455 | } 456 | break; 457 | case kCGPDFObjectTypeString: 458 | { 459 | CGPDFStringRef pdfString = 0; 460 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfString); 461 | CFStringRef string = CGPDFStringCopyTextString(pdfString); 462 | NSString * stringObject = (__bridge_transfer NSString *)string; 463 | stringObject = stringObject ? stringObject : @""; 464 | [newArray addObject:stringObject]; 465 | } 466 | break; 467 | case kCGPDFObjectTypeArray: 468 | { 469 | CGPDFArrayRef pdfArray = 0; 470 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfArray); 471 | 472 | size_t objectsCount = CGPDFArrayGetCount(pdfArray); 473 | [newArray addObject:[NSString stringWithFormat:@"[ %d objects ]", (int)objectsCount]]; 474 | } 475 | break; 476 | case kCGPDFObjectTypeDictionary: 477 | { 478 | CGPDFDictionaryRef pdfDictionary = 0; 479 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfDictionary); 480 | 481 | size_t keyValuePairsCount = CGPDFDictionaryGetCount(pdfDictionary); 482 | [newArray addObject:[NSString stringWithFormat:@"{ %d key/value pairs }", (int)keyValuePairsCount]]; 483 | } 484 | break; 485 | case kCGPDFObjectTypeStream: 486 | { 487 | CGPDFStreamRef pdfStream = 0; 488 | executeCorrect = CGPDFObjectGetValue(value, valueType, &pdfStream); 489 | CGPDFDataFormat pdfDataFormat; 490 | CFDataRef pdfStreamData = CGPDFStreamCopyData(pdfStream, &pdfDataFormat); 491 | NSString * streamString = [[NSString alloc]initWithData:(__bridge NSData *)pdfStreamData encoding:NSUTF8StringEncoding]; 492 | streamString = streamString ? streamString : @""; 493 | [newArray addObject:streamString]; 494 | // [newArray addObject:@""]; 495 | } 496 | break; 497 | default: 498 | break; 499 | } 500 | if (!executeCorrect) { 501 | PRINTF(@"LxPDFParser 解析PDF文件发生错误"); // 502 | } 503 | } 504 | 505 | @end 506 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 35471C591A92CC39003A738B /* PDFCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 35471C571A92CC39003A738B /* PDFCollectionViewController.m */; }; 11 | 35471C5A1A92CC39003A738B /* PDFCollectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35471C581A92CC39003A738B /* PDFCollectionViewController.xib */; }; 12 | 35471C601A92D38F003A738B /* ic_drawer_creation_notask.png in Resources */ = {isa = PBXBuildFile; fileRef = 35471C5E1A92D38F003A738B /* ic_drawer_creation_notask.png */; }; 13 | 35471C611A92D38F003A738B /* ic_drawer_creation_notask@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 35471C5F1A92D38F003A738B /* ic_drawer_creation_notask@2x.png */; }; 14 | 35471C651A92D3E3003A738B /* PDFFacilityCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 35471C631A92D3E3003A738B /* PDFFacilityCollectionViewCell.m */; }; 15 | 35471C661A92D3E3003A738B /* PDFFacilityCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35471C641A92D3E3003A738B /* PDFFacilityCollectionViewCell.xib */; }; 16 | 35471C6A1A92FDBB003A738B /* CatalogueNodeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 35471C681A92FDBB003A738B /* CatalogueNodeCell.m */; }; 17 | 35471C6B1A92FDBB003A738B /* CatalogueNodeCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35471C691A92FDBB003A738B /* CatalogueNodeCell.xib */; }; 18 | 35471C6F1A933E95003A738B /* CatalogueTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 35471C6D1A933E95003A738B /* CatalogueTableViewController.m */; }; 19 | 35471C701A933E95003A738B /* CatalogueTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35471C6E1A933E95003A738B /* CatalogueTableViewController.xib */; }; 20 | 35471C741A935DE5003A738B /* PDFBrowserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 35471C721A935DE5003A738B /* PDFBrowserViewController.m */; }; 21 | 355CCBA41A763910001186ED /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 355CCBA31A763910001186ED /* main.m */; }; 22 | 355CCBA71A763910001186ED /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 355CCBA61A763910001186ED /* AppDelegate.m */; }; 23 | 355CCBAA1A763910001186ED /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 355CCBA91A763910001186ED /* ViewController.m */; }; 24 | 355CCBAD1A763910001186ED /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 355CCBAB1A763910001186ED /* Main.storyboard */; }; 25 | 355CCBAF1A763910001186ED /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 355CCBAE1A763910001186ED /* Images.xcassets */; }; 26 | 355CCBB21A763910001186ED /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 355CCBB01A763910001186ED /* LaunchScreen.xib */; }; 27 | 355CCBBE1A763910001186ED /* LxPDFParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 355CCBBD1A763910001186ED /* LxPDFParserTests.m */; }; 28 | 355CCBCC1A7639BD001186ED /* PDFNodeDisplayCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 355CCBCA1A7639BD001186ED /* PDFNodeDisplayCell.m */; }; 29 | 355CCBCD1A7639BD001186ED /* PDFTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 355CCBCB1A7639BD001186ED /* PDFTableViewController.m */; }; 30 | 357E0BBB1A7BBD3B0005B4C2 /* drawingwithquartz2d.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 357E0BBA1A7BBD3B0005B4C2 /* drawingwithquartz2d.pdf */; }; 31 | 35C2E3171A7665A9007C1C1A /* LxPDFParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 35C2E3161A7665A9007C1C1A /* LxPDFParser.m */; }; 32 | /* End PBXBuildFile section */ 33 | 34 | /* Begin PBXContainerItemProxy section */ 35 | 355CCBB81A763910001186ED /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 355CCB961A763910001186ED /* Project object */; 38 | proxyType = 1; 39 | remoteGlobalIDString = 355CCB9D1A763910001186ED; 40 | remoteInfo = LxPDFParser; 41 | }; 42 | /* End PBXContainerItemProxy section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | 35471C561A92CC39003A738B /* PDFCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFCollectionViewController.h; sourceTree = ""; }; 46 | 35471C571A92CC39003A738B /* PDFCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFCollectionViewController.m; sourceTree = ""; }; 47 | 35471C581A92CC39003A738B /* PDFCollectionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PDFCollectionViewController.xib; sourceTree = ""; }; 48 | 35471C5E1A92D38F003A738B /* ic_drawer_creation_notask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_drawer_creation_notask.png; sourceTree = ""; }; 49 | 35471C5F1A92D38F003A738B /* ic_drawer_creation_notask@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ic_drawer_creation_notask@2x.png"; sourceTree = ""; }; 50 | 35471C621A92D3E3003A738B /* PDFFacilityCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFFacilityCollectionViewCell.h; sourceTree = ""; }; 51 | 35471C631A92D3E3003A738B /* PDFFacilityCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFFacilityCollectionViewCell.m; sourceTree = ""; }; 52 | 35471C641A92D3E3003A738B /* PDFFacilityCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PDFFacilityCollectionViewCell.xib; sourceTree = ""; }; 53 | 35471C671A92FDBB003A738B /* CatalogueNodeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatalogueNodeCell.h; sourceTree = ""; }; 54 | 35471C681A92FDBB003A738B /* CatalogueNodeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CatalogueNodeCell.m; sourceTree = ""; }; 55 | 35471C691A92FDBB003A738B /* CatalogueNodeCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CatalogueNodeCell.xib; sourceTree = ""; }; 56 | 35471C6C1A933E95003A738B /* CatalogueTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatalogueTableViewController.h; sourceTree = ""; }; 57 | 35471C6D1A933E95003A738B /* CatalogueTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CatalogueTableViewController.m; sourceTree = ""; }; 58 | 35471C6E1A933E95003A738B /* CatalogueTableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CatalogueTableViewController.xib; sourceTree = ""; }; 59 | 35471C711A935DE5003A738B /* PDFBrowserViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFBrowserViewController.h; sourceTree = ""; }; 60 | 35471C721A935DE5003A738B /* PDFBrowserViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFBrowserViewController.m; sourceTree = ""; }; 61 | 355CCB9E1A763910001186ED /* LxPDFParser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LxPDFParser.app; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 355CCBA21A763910001186ED /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | 355CCBA31A763910001186ED /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 64 | 355CCBA51A763910001186ED /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 65 | 355CCBA61A763910001186ED /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 66 | 355CCBA81A763910001186ED /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 67 | 355CCBA91A763910001186ED /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 68 | 355CCBAC1A763910001186ED /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 69 | 355CCBAE1A763910001186ED /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 70 | 355CCBB11A763910001186ED /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 71 | 355CCBB71A763910001186ED /* LxPDFParserTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LxPDFParserTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 72 | 355CCBBC1A763910001186ED /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 73 | 355CCBBD1A763910001186ED /* LxPDFParserTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LxPDFParserTests.m; sourceTree = ""; }; 74 | 355CCBC81A7639BD001186ED /* PDFNodeDisplayCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFNodeDisplayCell.h; sourceTree = ""; }; 75 | 355CCBC91A7639BD001186ED /* PDFTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFTableViewController.h; sourceTree = ""; }; 76 | 355CCBCA1A7639BD001186ED /* PDFNodeDisplayCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFNodeDisplayCell.m; sourceTree = ""; }; 77 | 355CCBCB1A7639BD001186ED /* PDFTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PDFTableViewController.m; sourceTree = ""; }; 78 | 357E0BBA1A7BBD3B0005B4C2 /* drawingwithquartz2d.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = drawingwithquartz2d.pdf; sourceTree = SOURCE_ROOT; }; 79 | 35C2E3151A7665A9007C1C1A /* LxPDFParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LxPDFParser.h; sourceTree = ""; }; 80 | 35C2E3161A7665A9007C1C1A /* LxPDFParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LxPDFParser.m; sourceTree = ""; }; 81 | /* End PBXFileReference section */ 82 | 83 | /* Begin PBXFrameworksBuildPhase section */ 84 | 355CCB9B1A763910001186ED /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | ); 89 | runOnlyForDeploymentPostprocessing = 0; 90 | }; 91 | 355CCBB41A763910001186ED /* Frameworks */ = { 92 | isa = PBXFrameworksBuildPhase; 93 | buildActionMask = 2147483647; 94 | files = ( 95 | ); 96 | runOnlyForDeploymentPostprocessing = 0; 97 | }; 98 | /* End PBXFrameworksBuildPhase section */ 99 | 100 | /* Begin PBXGroup section */ 101 | 3520055B1A9E219000B0950B /* Browser */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 35471C711A935DE5003A738B /* PDFBrowserViewController.h */, 105 | 35471C721A935DE5003A738B /* PDFBrowserViewController.m */, 106 | ); 107 | name = Browser; 108 | sourceTree = ""; 109 | }; 110 | 3520055C1A9E23E100B0950B /* File structure */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 355CCBC91A7639BD001186ED /* PDFTableViewController.h */, 114 | 355CCBCB1A7639BD001186ED /* PDFTableViewController.m */, 115 | 355CCBC81A7639BD001186ED /* PDFNodeDisplayCell.h */, 116 | 355CCBCA1A7639BD001186ED /* PDFNodeDisplayCell.m */, 117 | ); 118 | name = "File structure"; 119 | sourceTree = ""; 120 | }; 121 | 35471C5D1A92D1C7003A738B /* CollectionView */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 35471C561A92CC39003A738B /* PDFCollectionViewController.h */, 125 | 35471C571A92CC39003A738B /* PDFCollectionViewController.m */, 126 | 35471C581A92CC39003A738B /* PDFCollectionViewController.xib */, 127 | 35471C621A92D3E3003A738B /* PDFFacilityCollectionViewCell.h */, 128 | 35471C631A92D3E3003A738B /* PDFFacilityCollectionViewCell.m */, 129 | 35471C641A92D3E3003A738B /* PDFFacilityCollectionViewCell.xib */, 130 | ); 131 | name = CollectionView; 132 | sourceTree = ""; 133 | }; 134 | 355CCB951A763910001186ED = { 135 | isa = PBXGroup; 136 | children = ( 137 | 355CCBA01A763910001186ED /* LxPDFParser */, 138 | 355CCBBA1A763910001186ED /* LxPDFParserTests */, 139 | 355CCB9F1A763910001186ED /* Products */, 140 | ); 141 | sourceTree = ""; 142 | }; 143 | 355CCB9F1A763910001186ED /* Products */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 355CCB9E1A763910001186ED /* LxPDFParser.app */, 147 | 355CCBB71A763910001186ED /* LxPDFParserTests.xctest */, 148 | ); 149 | name = Products; 150 | sourceTree = ""; 151 | }; 152 | 355CCBA01A763910001186ED /* LxPDFParser */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 35C2E3141A7665A9007C1C1A /* LxPDFParser */, 156 | 355CCBA51A763910001186ED /* AppDelegate.h */, 157 | 355CCBA61A763910001186ED /* AppDelegate.m */, 158 | 355CCBA81A763910001186ED /* ViewController.h */, 159 | 355CCBA91A763910001186ED /* ViewController.m */, 160 | 35471C5E1A92D38F003A738B /* ic_drawer_creation_notask.png */, 161 | 35471C5F1A92D38F003A738B /* ic_drawer_creation_notask@2x.png */, 162 | 357E0BBA1A7BBD3B0005B4C2 /* drawingwithquartz2d.pdf */, 163 | 355CCBAB1A763910001186ED /* Main.storyboard */, 164 | 355CCBB01A763910001186ED /* LaunchScreen.xib */, 165 | 355CCBAE1A763910001186ED /* Images.xcassets */, 166 | 35471C5D1A92D1C7003A738B /* CollectionView */, 167 | 3520055B1A9E219000B0950B /* Browser */, 168 | 355CCBC71A763959001186ED /* Catalogue */, 169 | 3520055C1A9E23E100B0950B /* File structure */, 170 | 355CCBA11A763910001186ED /* Supporting Files */, 171 | ); 172 | path = LxPDFParser; 173 | sourceTree = ""; 174 | }; 175 | 355CCBA11A763910001186ED /* Supporting Files */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 355CCBA21A763910001186ED /* Info.plist */, 179 | 355CCBA31A763910001186ED /* main.m */, 180 | ); 181 | name = "Supporting Files"; 182 | sourceTree = ""; 183 | }; 184 | 355CCBBA1A763910001186ED /* LxPDFParserTests */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 355CCBBD1A763910001186ED /* LxPDFParserTests.m */, 188 | 355CCBBB1A763910001186ED /* Supporting Files */, 189 | ); 190 | path = LxPDFParserTests; 191 | sourceTree = ""; 192 | }; 193 | 355CCBBB1A763910001186ED /* Supporting Files */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 355CCBBC1A763910001186ED /* Info.plist */, 197 | ); 198 | name = "Supporting Files"; 199 | sourceTree = ""; 200 | }; 201 | 355CCBC71A763959001186ED /* Catalogue */ = { 202 | isa = PBXGroup; 203 | children = ( 204 | 35471C6C1A933E95003A738B /* CatalogueTableViewController.h */, 205 | 35471C6D1A933E95003A738B /* CatalogueTableViewController.m */, 206 | 35471C6E1A933E95003A738B /* CatalogueTableViewController.xib */, 207 | 35471C671A92FDBB003A738B /* CatalogueNodeCell.h */, 208 | 35471C681A92FDBB003A738B /* CatalogueNodeCell.m */, 209 | 35471C691A92FDBB003A738B /* CatalogueNodeCell.xib */, 210 | ); 211 | name = Catalogue; 212 | sourceTree = ""; 213 | }; 214 | 35C2E3141A7665A9007C1C1A /* LxPDFParser */ = { 215 | isa = PBXGroup; 216 | children = ( 217 | 35C2E3151A7665A9007C1C1A /* LxPDFParser.h */, 218 | 35C2E3161A7665A9007C1C1A /* LxPDFParser.m */, 219 | ); 220 | name = LxPDFParser; 221 | path = ../../LxPDFParser; 222 | sourceTree = ""; 223 | }; 224 | /* End PBXGroup section */ 225 | 226 | /* Begin PBXNativeTarget section */ 227 | 355CCB9D1A763910001186ED /* LxPDFParser */ = { 228 | isa = PBXNativeTarget; 229 | buildConfigurationList = 355CCBC11A763910001186ED /* Build configuration list for PBXNativeTarget "LxPDFParser" */; 230 | buildPhases = ( 231 | 355CCB9A1A763910001186ED /* Sources */, 232 | 355CCB9B1A763910001186ED /* Frameworks */, 233 | 355CCB9C1A763910001186ED /* Resources */, 234 | ); 235 | buildRules = ( 236 | ); 237 | dependencies = ( 238 | ); 239 | name = LxPDFParser; 240 | productName = LxPDFParser; 241 | productReference = 355CCB9E1A763910001186ED /* LxPDFParser.app */; 242 | productType = "com.apple.product-type.application"; 243 | }; 244 | 355CCBB61A763910001186ED /* LxPDFParserTests */ = { 245 | isa = PBXNativeTarget; 246 | buildConfigurationList = 355CCBC41A763910001186ED /* Build configuration list for PBXNativeTarget "LxPDFParserTests" */; 247 | buildPhases = ( 248 | 355CCBB31A763910001186ED /* Sources */, 249 | 355CCBB41A763910001186ED /* Frameworks */, 250 | 355CCBB51A763910001186ED /* Resources */, 251 | ); 252 | buildRules = ( 253 | ); 254 | dependencies = ( 255 | 355CCBB91A763910001186ED /* PBXTargetDependency */, 256 | ); 257 | name = LxPDFParserTests; 258 | productName = LxPDFParserTests; 259 | productReference = 355CCBB71A763910001186ED /* LxPDFParserTests.xctest */; 260 | productType = "com.apple.product-type.bundle.unit-test"; 261 | }; 262 | /* End PBXNativeTarget section */ 263 | 264 | /* Begin PBXProject section */ 265 | 355CCB961A763910001186ED /* Project object */ = { 266 | isa = PBXProject; 267 | attributes = { 268 | LastUpgradeCheck = 0610; 269 | ORGANIZATIONNAME = "Gener-health-li.x"; 270 | TargetAttributes = { 271 | 355CCB9D1A763910001186ED = { 272 | CreatedOnToolsVersion = 6.1.1; 273 | }; 274 | 355CCBB61A763910001186ED = { 275 | CreatedOnToolsVersion = 6.1.1; 276 | TestTargetID = 355CCB9D1A763910001186ED; 277 | }; 278 | }; 279 | }; 280 | buildConfigurationList = 355CCB991A763910001186ED /* Build configuration list for PBXProject "LxPDFParser" */; 281 | compatibilityVersion = "Xcode 3.2"; 282 | developmentRegion = English; 283 | hasScannedForEncodings = 0; 284 | knownRegions = ( 285 | en, 286 | Base, 287 | ); 288 | mainGroup = 355CCB951A763910001186ED; 289 | productRefGroup = 355CCB9F1A763910001186ED /* Products */; 290 | projectDirPath = ""; 291 | projectRoot = ""; 292 | targets = ( 293 | 355CCB9D1A763910001186ED /* LxPDFParser */, 294 | 355CCBB61A763910001186ED /* LxPDFParserTests */, 295 | ); 296 | }; 297 | /* End PBXProject section */ 298 | 299 | /* Begin PBXResourcesBuildPhase section */ 300 | 355CCB9C1A763910001186ED /* Resources */ = { 301 | isa = PBXResourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 35471C661A92D3E3003A738B /* PDFFacilityCollectionViewCell.xib in Resources */, 305 | 355CCBAD1A763910001186ED /* Main.storyboard in Resources */, 306 | 357E0BBB1A7BBD3B0005B4C2 /* drawingwithquartz2d.pdf in Resources */, 307 | 355CCBB21A763910001186ED /* LaunchScreen.xib in Resources */, 308 | 35471C6B1A92FDBB003A738B /* CatalogueNodeCell.xib in Resources */, 309 | 35471C601A92D38F003A738B /* ic_drawer_creation_notask.png in Resources */, 310 | 35471C701A933E95003A738B /* CatalogueTableViewController.xib in Resources */, 311 | 35471C611A92D38F003A738B /* ic_drawer_creation_notask@2x.png in Resources */, 312 | 355CCBAF1A763910001186ED /* Images.xcassets in Resources */, 313 | 35471C5A1A92CC39003A738B /* PDFCollectionViewController.xib in Resources */, 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | }; 317 | 355CCBB51A763910001186ED /* Resources */ = { 318 | isa = PBXResourcesBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | }; 324 | /* End PBXResourcesBuildPhase section */ 325 | 326 | /* Begin PBXSourcesBuildPhase section */ 327 | 355CCB9A1A763910001186ED /* Sources */ = { 328 | isa = PBXSourcesBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | 35471C651A92D3E3003A738B /* PDFFacilityCollectionViewCell.m in Sources */, 332 | 355CCBAA1A763910001186ED /* ViewController.m in Sources */, 333 | 355CCBCC1A7639BD001186ED /* PDFNodeDisplayCell.m in Sources */, 334 | 355CCBCD1A7639BD001186ED /* PDFTableViewController.m in Sources */, 335 | 355CCBA71A763910001186ED /* AppDelegate.m in Sources */, 336 | 35471C591A92CC39003A738B /* PDFCollectionViewController.m in Sources */, 337 | 35471C6A1A92FDBB003A738B /* CatalogueNodeCell.m in Sources */, 338 | 355CCBA41A763910001186ED /* main.m in Sources */, 339 | 35C2E3171A7665A9007C1C1A /* LxPDFParser.m in Sources */, 340 | 35471C6F1A933E95003A738B /* CatalogueTableViewController.m in Sources */, 341 | 35471C741A935DE5003A738B /* PDFBrowserViewController.m in Sources */, 342 | ); 343 | runOnlyForDeploymentPostprocessing = 0; 344 | }; 345 | 355CCBB31A763910001186ED /* Sources */ = { 346 | isa = PBXSourcesBuildPhase; 347 | buildActionMask = 2147483647; 348 | files = ( 349 | 355CCBBE1A763910001186ED /* LxPDFParserTests.m in Sources */, 350 | ); 351 | runOnlyForDeploymentPostprocessing = 0; 352 | }; 353 | /* End PBXSourcesBuildPhase section */ 354 | 355 | /* Begin PBXTargetDependency section */ 356 | 355CCBB91A763910001186ED /* PBXTargetDependency */ = { 357 | isa = PBXTargetDependency; 358 | target = 355CCB9D1A763910001186ED /* LxPDFParser */; 359 | targetProxy = 355CCBB81A763910001186ED /* PBXContainerItemProxy */; 360 | }; 361 | /* End PBXTargetDependency section */ 362 | 363 | /* Begin PBXVariantGroup section */ 364 | 355CCBAB1A763910001186ED /* Main.storyboard */ = { 365 | isa = PBXVariantGroup; 366 | children = ( 367 | 355CCBAC1A763910001186ED /* Base */, 368 | ); 369 | name = Main.storyboard; 370 | sourceTree = ""; 371 | }; 372 | 355CCBB01A763910001186ED /* LaunchScreen.xib */ = { 373 | isa = PBXVariantGroup; 374 | children = ( 375 | 355CCBB11A763910001186ED /* Base */, 376 | ); 377 | name = LaunchScreen.xib; 378 | sourceTree = ""; 379 | }; 380 | /* End PBXVariantGroup section */ 381 | 382 | /* Begin XCBuildConfiguration section */ 383 | 355CCBBF1A763910001186ED /* 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 = 7.0; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | 355CCBC01A763910001186ED /* 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 = 7.0; 454 | MTL_ENABLE_DEBUG_INFO = NO; 455 | SDKROOT = iphoneos; 456 | TARGETED_DEVICE_FAMILY = "1,2"; 457 | VALIDATE_PRODUCT = YES; 458 | }; 459 | name = Release; 460 | }; 461 | 355CCBC21A763910001186ED /* Debug */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 465 | INFOPLIST_FILE = LxPDFParser/Info.plist; 466 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | }; 470 | name = Debug; 471 | }; 472 | 355CCBC31A763910001186ED /* Release */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 476 | INFOPLIST_FILE = LxPDFParser/Info.plist; 477 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 478 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | }; 481 | name = Release; 482 | }; 483 | 355CCBC51A763910001186ED /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | buildSettings = { 486 | BUNDLE_LOADER = "$(TEST_HOST)"; 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 = LxPDFParserTests/Info.plist; 496 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 497 | PRODUCT_NAME = "$(TARGET_NAME)"; 498 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LxPDFParser.app/LxPDFParser"; 499 | }; 500 | name = Debug; 501 | }; 502 | 355CCBC61A763910001186ED /* Release */ = { 503 | isa = XCBuildConfiguration; 504 | buildSettings = { 505 | BUNDLE_LOADER = "$(TEST_HOST)"; 506 | FRAMEWORK_SEARCH_PATHS = ( 507 | "$(SDKROOT)/Developer/Library/Frameworks", 508 | "$(inherited)", 509 | ); 510 | INFOPLIST_FILE = LxPDFParserTests/Info.plist; 511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 512 | PRODUCT_NAME = "$(TARGET_NAME)"; 513 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LxPDFParser.app/LxPDFParser"; 514 | }; 515 | name = Release; 516 | }; 517 | /* End XCBuildConfiguration section */ 518 | 519 | /* Begin XCConfigurationList section */ 520 | 355CCB991A763910001186ED /* Build configuration list for PBXProject "LxPDFParser" */ = { 521 | isa = XCConfigurationList; 522 | buildConfigurations = ( 523 | 355CCBBF1A763910001186ED /* Debug */, 524 | 355CCBC01A763910001186ED /* Release */, 525 | ); 526 | defaultConfigurationIsVisible = 0; 527 | defaultConfigurationName = Release; 528 | }; 529 | 355CCBC11A763910001186ED /* Build configuration list for PBXNativeTarget "LxPDFParser" */ = { 530 | isa = XCConfigurationList; 531 | buildConfigurations = ( 532 | 355CCBC21A763910001186ED /* Debug */, 533 | 355CCBC31A763910001186ED /* Release */, 534 | ); 535 | defaultConfigurationIsVisible = 0; 536 | defaultConfigurationName = Release; 537 | }; 538 | 355CCBC41A763910001186ED /* Build configuration list for PBXNativeTarget "LxPDFParserTests" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | 355CCBC51A763910001186ED /* Debug */, 542 | 355CCBC61A763910001186ED /* Release */, 543 | ); 544 | defaultConfigurationIsVisible = 0; 545 | defaultConfigurationName = Release; 546 | }; 547 | /* End XCConfigurationList section */ 548 | }; 549 | rootObject = 355CCB961A763910001186ED /* Project object */; 550 | } 551 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | 8 | @interface AppDelegate : UIResponder 9 | 10 | @property (strong, nonatomic) UIWindow *window; 11 | 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LxPDFParser 4 | // 5 | 6 | #import "AppDelegate.h" 7 | 8 | @interface AppDelegate () 9 | 10 | @end 11 | 12 | @implementation AppDelegate 13 | 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 16 | // Override point for customization after application launch. 17 | return YES; 18 | } 19 | 20 | - (void)applicationWillResignActive:(UIApplication *)application { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application { 26 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 27 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 28 | } 29 | 30 | - (void)applicationWillEnterForeground:(UIApplication *)application { 31 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 32 | } 33 | 34 | - (void)applicationDidBecomeActive:(UIApplication *)application { 35 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 36 | } 37 | 38 | - (void)applicationWillTerminate:(UIApplication *)application { 39 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/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 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/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 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/CatalogueNodeCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CatalogueNodeCell.h 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | 8 | @interface CatalogueNodeCell : UITableViewCell 9 | 10 | @property (nonatomic,assign) NSUInteger depth; 11 | @property (nonatomic,strong) UILabel *nameLabel; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/CatalogueNodeCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CatalogueNodeCell.m 3 | // LxPDFParser 4 | // 5 | 6 | #import "CatalogueNodeCell.h" 7 | 8 | const CGFloat DEPTH_INDENTATION = 32; 9 | 10 | @implementation CatalogueNodeCell 11 | 12 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 13 | { 14 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 15 | 16 | self.selectionStyle = UITableViewCellSelectionStyleNone; 17 | 18 | [self configView]; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)configView 24 | { 25 | self.depth = 0; 26 | 27 | self.nameLabel = [[UILabel alloc]init]; 28 | self.nameLabel.layer.borderWidth = 1; 29 | self.nameLabel.layer.borderColor = [UIColor whiteColor].CGColor; 30 | self.nameLabel.layer.cornerRadius = 2; 31 | self.nameLabel.clipsToBounds = YES; 32 | [self.contentView addSubview:self.nameLabel]; 33 | } 34 | 35 | - (void)setDepth:(NSUInteger)depth 36 | { 37 | CGRect contentViewBounds = self.contentView.bounds; 38 | contentViewBounds.origin.x = depth * DEPTH_INDENTATION; 39 | contentViewBounds.size.width -= contentViewBounds.origin.x; 40 | 41 | self.nameLabel.frame = contentViewBounds; 42 | 43 | self.nameLabel.backgroundColor = [UIColor colorWithRed:30 * depth/255.0 green:0.5 blue:(255 - 30 * depth)/255.0 alpha:1]; 44 | 45 | _depth = depth; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/CatalogueNodeCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/CatalogueTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CatalogueTableViewController.h 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | #import "LxPDFParser.h" 8 | 9 | @interface CatalogueTableViewController : UITableViewController 10 | 11 | @property (nonatomic,strong) LxPDFParser * pdfParser; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/CatalogueTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CatalogueTableViewController.m 3 | // LxPDFParser 4 | // 5 | 6 | #import "CatalogueTableViewController.h" 7 | #import "CatalogueNodeCell.h" 8 | 9 | static NSString * CatalogueNodeCellIdentifier = @"CatalogueNodeCellIdentifier"; 10 | 11 | @interface CatalogueTableViewController () 12 | 13 | @property (nonatomic,strong) NSMutableArray * catalogueNodeArray; 14 | 15 | @end 16 | 17 | @implementation CatalogueTableViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.title = @"Catalogue"; 23 | self.tableView.tableFooterView = [[UIView alloc]init]; 24 | 25 | [self.tableView registerClass:[CatalogueNodeCell class] forCellReuseIdentifier:CatalogueNodeCellIdentifier]; 26 | } 27 | 28 | - (void)setPdfParser:(LxPDFParser *)pdfParser 29 | { 30 | if (_pdfParser != pdfParser) { 31 | 32 | [self.catalogueNodeArray removeAllObjects]; 33 | [self.catalogueNodeArray addObject:pdfParser.rootCatalogueNode]; 34 | 35 | _pdfParser = pdfParser; 36 | } 37 | } 38 | 39 | - (NSMutableArray *)catalogueNodeArray 40 | { 41 | if (_catalogueNodeArray == nil) { 42 | _catalogueNodeArray = [[NSMutableArray alloc]init]; 43 | } 44 | return _catalogueNodeArray; 45 | } 46 | 47 | #pragma mark - Table view data source 48 | 49 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 50 | 51 | return 1; 52 | } 53 | 54 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 55 | 56 | return self.catalogueNodeArray.count; 57 | } 58 | 59 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 60 | 61 | CatalogueNodeCell *cell = [tableView dequeueReusableCellWithIdentifier:CatalogueNodeCellIdentifier forIndexPath:indexPath]; 62 | 63 | CatalogueNodeModel * catagueNodeModel = self.catalogueNodeArray[indexPath.row]; 64 | 65 | cell.depth = catagueNodeModel.depth; 66 | cell.nameLabel.text = catagueNodeModel.name; 67 | 68 | return cell; 69 | } 70 | 71 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 72 | 73 | CatalogueNodeModel * catagueNodeModel = self.catalogueNodeArray[indexPath.row]; 74 | 75 | BOOL childNodeArrayIsOpened = NO; 76 | 77 | if (indexPath.row == self.catalogueNodeArray.count - 1) { 78 | 79 | childNodeArrayIsOpened = NO; 80 | } 81 | else { 82 | CatalogueNodeModel * nextCatagueNodeModel = self.catalogueNodeArray[indexPath.row + 1]; 83 | childNodeArrayIsOpened = nextCatagueNodeModel.depth > catagueNodeModel.depth; 84 | } 85 | 86 | if (childNodeArrayIsOpened) { 87 | 88 | NSMutableArray * deleteIndexPathArray = [NSMutableArray array]; 89 | NSMutableIndexSet * deleteIndexSet = [NSMutableIndexSet indexSet]; 90 | 91 | for (NSInteger i = indexPath.row + 1; i < self.catalogueNodeArray.count; i++) { 92 | 93 | CatalogueNodeModel * nextCatalogueNodeModel = self.catalogueNodeArray[i]; 94 | 95 | if (nextCatalogueNodeModel.depth > catagueNodeModel.depth) { 96 | 97 | [deleteIndexSet addIndex:i]; 98 | 99 | [deleteIndexPathArray addObject:[NSIndexPath indexPathForRow:i inSection:0]]; 100 | } 101 | } 102 | 103 | [self.catalogueNodeArray removeObjectsAtIndexes:deleteIndexSet]; 104 | 105 | [tableView beginUpdates]; 106 | 107 | [tableView deleteRowsAtIndexPaths:deleteIndexPathArray withRowAnimation:UITableViewRowAnimationAutomatic]; 108 | 109 | [tableView endUpdates]; 110 | } 111 | else { 112 | 113 | NSMutableArray * insertIndexPathArray = [NSMutableArray array]; 114 | NSMutableIndexSet * insertIndexSet = [NSMutableIndexSet indexSet]; 115 | 116 | for (NSInteger i = 0; i < catagueNodeModel.childNodeArray.count; i++) { 117 | NSIndexPath * insertIndexPath = [NSIndexPath indexPathForRow:indexPath.row + i + 1 inSection:0]; 118 | [insertIndexPathArray addObject:insertIndexPath]; 119 | [insertIndexSet addIndex:indexPath.row + i + 1]; 120 | } 121 | 122 | [self.catalogueNodeArray insertObjects:catagueNodeModel.childNodeArray atIndexes:insertIndexSet]; 123 | 124 | [tableView beginUpdates]; 125 | 126 | [tableView insertRowsAtIndexPaths:insertIndexPathArray withRowAnimation:UITableViewRowAnimationAutomatic]; 127 | 128 | [tableView endUpdates]; 129 | } 130 | } 131 | @end 132 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/CatalogueTableViewController.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.gener-tech-bj.LxFTPRequestDemo.$(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 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFBrowserViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PDFBrowserViewController.h 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | 8 | @interface PDFBrowserViewController : UIViewController 9 | 10 | @property (nonatomic,copy) NSString * pdfFilePath; 11 | @property (nonatomic,assign) UIPageViewControllerTransitionStyle transitionStyle; 12 | @property (nonatomic,assign) UIPageViewControllerNavigationOrientation navigationOrientation; 13 | @property (nonatomic,assign) UIPageViewControllerSpineLocation spineLocation; 14 | @property (nonatomic,assign) CGFloat interPageSpacing; 15 | @property (nonatomic,assign) UIPageViewControllerNavigationDirection navigationDirection; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFBrowserViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PDFBrowserViewController.m 3 | // LxPDFParser 4 | // 5 | 6 | #import "PDFBrowserViewController.h" 7 | 8 | @interface PDFSinglePageViewControler : UIViewController 9 | 10 | @property (nonatomic,copy) NSString * path; 11 | @property (nonatomic,assign) NSUInteger page; 12 | @property (nonatomic,strong) UIWebView * pdfSinglePageWebView; 13 | 14 | @end 15 | 16 | @implementation PDFSinglePageViewControler 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | 22 | self.pdfSinglePageWebView = [[UIWebView alloc]init]; 23 | self.pdfSinglePageWebView.backgroundColor = [UIColor clearColor]; 24 | self.pdfSinglePageWebView.delegate = self; 25 | self.pdfSinglePageWebView.scrollView.minimumZoomScale = 1; 26 | self.pdfSinglePageWebView.scrollView.maximumZoomScale = 3; 27 | [self.view addSubview:self.pdfSinglePageWebView]; 28 | 29 | self.pdfSinglePageWebView.translatesAutoresizingMaskIntoConstraints = NO; 30 | 31 | NSArray * constraintH = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_pdfSinglePageWebView]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(_pdfSinglePageWebView)]; 32 | NSArray * constraintV = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_pdfSinglePageWebView]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(_pdfSinglePageWebView)]; 33 | 34 | [self.view addConstraints:constraintH]; 35 | [self.view addConstraints:constraintV]; 36 | 37 | [self.view addSubview:self.pdfSinglePageWebView]; 38 | 39 | [self.pdfSinglePageWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:self.singlePagePDFFilePath]]]; 40 | } 41 | 42 | - (NSString *)pdfFileName 43 | { 44 | return self.path.lastPathComponent.stringByDeletingPathExtension; 45 | } 46 | 47 | - (NSString *)singlePagePDFDirectoryPath 48 | { 49 | NSString * singlePagePDFDirectoryPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:self.pdfFileName]; 50 | 51 | NSError * error = nil; 52 | 53 | BOOL createDirectorySuccess = [[NSFileManager defaultManager] createDirectoryAtPath:singlePagePDFDirectoryPath withIntermediateDirectories:YES attributes:nil error:&error]; 54 | 55 | NSAssert(createDirectorySuccess, @"创建单页PDF目录失败: %@", error.localizedDescription); // 56 | 57 | return singlePagePDFDirectoryPath; 58 | } 59 | 60 | - (NSString *)singlePagePDFFilePath 61 | { 62 | NSString * singlePagePDFFilePath = [self.singlePagePDFDirectoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ p%u.pdf", self.pdfFileName, self.page]]; 63 | 64 | BOOL isDirectory = NO; 65 | BOOL fileExists = [[NSFileManager defaultManager]fileExistsAtPath:singlePagePDFFilePath isDirectory:&isDirectory]; 66 | 67 | if (fileExists && !isDirectory) { 68 | 69 | } 70 | else { 71 | 72 | NSURL * pdfFileUrl = [NSURL fileURLWithPath:self.path]; 73 | 74 | CGPDFDocumentRef pdfDocument = CGPDFDocumentCreateWithURL((CFURLRef)pdfFileUrl); 75 | 76 | NSAssert(pdfDocument, @"创建PDF Document失败"); // 77 | 78 | CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdfDocument, self.page); 79 | 80 | CGRect pdfPageBoxRect = CGPDFPageGetBoxRect(pdfPage, kCGPDFMediaBox); 81 | 82 | CFURLRef singlePagePDFFileUrl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (__bridge CFStringRef)singlePagePDFFilePath, kCFURLPOSIXPathStyle, false); 83 | 84 | NSAssert(singlePagePDFFileUrl, @"生成单页PDF文件地址失败"); // 85 | 86 | CGDataConsumerRef singlePagePDFFileDataConsumer = CGDataConsumerCreateWithURL(singlePagePDFFileUrl); 87 | 88 | NSAssert(singlePagePDFFileDataConsumer, @"生成单页PDF DataConsumer失败"); // 89 | 90 | CGContextRef singlePagePDFFileContext = CGPDFContextCreate(singlePagePDFFileDataConsumer, &pdfPageBoxRect, 0); 91 | 92 | NSAssert(singlePagePDFFileContext, @"生成单页PDF Context失败"); // 93 | 94 | CGContextBeginPage(singlePagePDFFileContext, &pdfPageBoxRect); 95 | CGContextSetFillColorWithColor(singlePagePDFFileContext, [UIColor whiteColor].CGColor); 96 | CGContextFillRect(singlePagePDFFileContext, pdfPageBoxRect); 97 | CGContextDrawPDFPage(singlePagePDFFileContext, pdfPage); 98 | CGContextEndPage(singlePagePDFFileContext); 99 | CGPDFContextClose(singlePagePDFFileContext); 100 | 101 | CGContextRelease(singlePagePDFFileContext); 102 | CGDataConsumerRelease(singlePagePDFFileDataConsumer); 103 | CFRelease(singlePagePDFFileUrl); 104 | } 105 | 106 | return singlePagePDFFilePath; 107 | } 108 | 109 | - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 110 | { 111 | NSLog(@"absoluteString = %@", request.URL.absoluteString); // 112 | 113 | return YES; 114 | } 115 | 116 | @end 117 | 118 | 119 | 120 | 121 | 122 | @interface PDFBrowserViewController () 123 | 124 | @property (nonatomic,strong) UIPageViewController * pageViewController; 125 | 126 | @end 127 | 128 | @implementation PDFBrowserViewController 129 | 130 | - (void)viewDidLoad { 131 | 132 | [super viewDidLoad]; 133 | 134 | self.view.backgroundColor = [UIColor blackColor]; 135 | 136 | [self configPageViewController]; 137 | } 138 | 139 | - (void)configPageViewController 140 | { 141 | [self.childViewControllers makeObjectsPerformSelector:@selector(removeFromParentViewController)]; 142 | [self.view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; 143 | 144 | self.pageViewController = nil; 145 | 146 | self.pageViewController = [[UIPageViewController alloc]initWithTransitionStyle:self.transitionStyle 147 | navigationOrientation:self.navigationOrientation 148 | options:@{UIPageViewControllerOptionSpineLocationKey:@(self.spineLocation), UIPageViewControllerOptionInterPageSpacingKey:@(self.interPageSpacing)}]; 149 | self.pageViewController.delegate = self; 150 | self.pageViewController.dataSource = self; 151 | 152 | PDFSinglePageViewControler * pdfSinglePageViewController1 = [self singlePageViewControlerAtPageIndex:1]; 153 | 154 | [self.pageViewController setViewControllers:@[pdfSinglePageViewController1] direction:self.navigationDirection animated:YES completion:^(BOOL finished) { 155 | 156 | }]; 157 | 158 | self.pageViewController.view.backgroundColor = [UIColor blackColor]; 159 | self.pageViewController.view.translatesAutoresizingMaskIntoConstraints = NO; 160 | 161 | [self addChildViewController:self.pageViewController]; 162 | [self.view addSubview:self.pageViewController.view]; 163 | 164 | self.pageViewController.view.translatesAutoresizingMaskIntoConstraints = NO; 165 | 166 | NSArray * constraintH = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[pageViewControllerView]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:@{@"pageViewControllerView":self.pageViewController.view}]; 167 | NSArray * constraintV = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-64-[pageViewControllerView]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:@{@"pageViewControllerView":self.pageViewController.view}]; 168 | [self.view addConstraints:constraintH]; 169 | [self.view addConstraints:constraintV]; 170 | } 171 | 172 | - (void)setPdfFilePath:(NSString *)pdfFilePath 173 | { 174 | if (_pdfFilePath != pdfFilePath) { 175 | 176 | BOOL isDirectory = NO; 177 | BOOL pdfFileExists = [[NSFileManager defaultManager] fileExistsAtPath:pdfFilePath isDirectory:&isDirectory]; 178 | 179 | NSAssert(pdfFileExists && !isDirectory, @"输入PDF文件路径错误"); // 180 | 181 | _pdfFilePath = [pdfFilePath copy]; 182 | } 183 | } 184 | 185 | - (size_t)pdfDocumentPageCount 186 | { 187 | NSURL * pdfFileUrl = [NSURL fileURLWithPath:self.pdfFilePath]; 188 | 189 | CGPDFDocumentRef pdfDocument = CGPDFDocumentCreateWithURL((CFURLRef)pdfFileUrl); 190 | 191 | NSAssert(pdfDocument, @"创建PDF Document失败"); // 192 | 193 | size_t pdfDocumentPageCount = CGPDFDocumentGetNumberOfPages(pdfDocument); 194 | 195 | CGPDFDocumentRelease(pdfDocument); 196 | 197 | return pdfDocumentPageCount; 198 | } 199 | 200 | - (PDFSinglePageViewControler *)singlePageViewControlerAtPageIndex:(NSUInteger)pageIndex 201 | { 202 | PDFSinglePageViewControler * pdfSinglePageViewController = [[PDFSinglePageViewControler alloc]init]; 203 | pdfSinglePageViewController.path = self.pdfFilePath; 204 | pdfSinglePageViewController.page = pageIndex; 205 | return pdfSinglePageViewController; 206 | } 207 | 208 | - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController 209 | { 210 | PDFSinglePageViewControler * pdfSinglePageViewController = (PDFSinglePageViewControler *)viewController; 211 | NSUInteger beforePage = pdfSinglePageViewController.page - 1; 212 | 213 | if (beforePage == 0) { 214 | return nil; 215 | } 216 | else { 217 | return [self singlePageViewControlerAtPageIndex:beforePage]; 218 | } 219 | } 220 | 221 | - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController 222 | { 223 | PDFSinglePageViewControler * pdfSinglePageViewController = (PDFSinglePageViewControler *)viewController; 224 | NSUInteger afterPage = pdfSinglePageViewController.page + 1; 225 | 226 | if (afterPage > self.pdfDocumentPageCount) { 227 | return nil; 228 | } 229 | else { 230 | return [self singlePageViewControlerAtPageIndex:afterPage]; 231 | } 232 | } 233 | 234 | - (void)pageViewController:(UIPageViewController *)pageViewController 235 | didFinishAnimating:(BOOL)finished 236 | previousViewControllers:(NSArray *)previousViewControllers 237 | transitionCompleted:(BOOL)completed 238 | { 239 | 240 | } 241 | 242 | @end 243 | 244 | 245 | 246 | 247 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFCollectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PDFCollectionViewController.h 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | 8 | @interface PDFCollectionViewController : UICollectionViewController 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFCollectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PDFCollectionViewController.m 3 | // LxPDFParser 4 | // 5 | 6 | #import "PDFCollectionViewController.h" 7 | #import "PDFFacilityCollectionViewCell.h" 8 | #import "LxPDFParser.h" 9 | #import "CatalogueTableViewController.h" 10 | #import "PDFTableViewController.h" 11 | #import "PDFBrowserViewController.h" 12 | 13 | @interface PDFCollectionViewController () 14 | 15 | @end 16 | 17 | @implementation PDFCollectionViewController 18 | 19 | static NSString * const reuseIdentifier = @"PDFCollectionCellReuseIdentifier"; 20 | 21 | - (void)viewDidLoad { 22 | [super viewDidLoad]; 23 | 24 | self.title = @"LxPDFParser"; 25 | 26 | // Uncomment the following line to preserve selection between presentations 27 | // self.clearsSelectionOnViewWillAppear = NO; 28 | 29 | // Register cell classes 30 | [self.collectionView registerClass:[PDFFacilityCollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier]; 31 | 32 | // Do any additional setup after loading the view. 33 | } 34 | 35 | #pragma mark 36 | 37 | - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { 38 | 39 | return 1; 40 | } 41 | 42 | 43 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 44 | 45 | return 3; 46 | } 47 | 48 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 49 | 50 | PDFFacilityCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; 51 | 52 | switch (indexPath.row) { 53 | case 0: 54 | { 55 | cell.titleLabel.text = @"Browser"; 56 | } 57 | break; 58 | case 1: 59 | { 60 | cell.titleLabel.text = @"Catalogue"; 61 | } 62 | break; 63 | case 2: 64 | { 65 | cell.titleLabel.text = @"File structure"; 66 | } 67 | break; 68 | default: 69 | break; 70 | } 71 | 72 | return cell; 73 | } 74 | 75 | #pragma mark 76 | 77 | - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 78 | { 79 | NSString * path = [[NSBundle mainBundle]pathForResource:@"drawingwithquartz2d" ofType:@"pdf"]; 80 | 81 | LxPDFParser * pdfParser = [[LxPDFParser alloc]initWithPDFDocumentPath:path]; 82 | NSLog(@"pdfParser.filePath = %@", pdfParser.filePath); // 83 | NSLog(@"pdfParser.pageCount = %d", pdfParser.pageCount); // 84 | NSLog(@"pdfParser.catalogDictionary = %@", pdfParser.catalogDictionary); // 85 | 86 | id content = [pdfParser valueForPDFKeyPath:@[@"Pages", @"Kids", @2, @"Kids", @2, @"Contents", @0]]; 87 | 88 | NSLog(@"content = %@", content); // 89 | 90 | 91 | switch (indexPath.row) { 92 | case 0: 93 | { 94 | PDFBrowserViewController * pbvc = [[PDFBrowserViewController alloc]init]; 95 | pbvc.pdfFilePath = path; 96 | [self.navigationController pushViewController:pbvc animated:YES]; 97 | } 98 | break; 99 | case 1: 100 | { 101 | CatalogueTableViewController * ctvc = [[CatalogueTableViewController alloc]initWithNibName:@"CatalogueTableViewController" bundle:nil]; 102 | ctvc.pdfParser = pdfParser; 103 | ctvc.title = @"Catalogue"; 104 | 105 | [self.navigationController pushViewController:ctvc animated:YES]; 106 | } 107 | break; 108 | case 2: 109 | { 110 | PDFTableViewController * ptvc = [[PDFTableViewController alloc]init]; 111 | ptvc.pdfParser = pdfParser; 112 | ptvc.title = @"Catalog"; 113 | 114 | [self.navigationController pushViewController:ptvc animated:YES]; 115 | } 116 | break; 117 | default: 118 | break; 119 | } 120 | } 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFCollectionViewController.xib: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFFacilityCollectionViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PDFFacilityCollectionViewCell.h 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | 8 | @interface PDFFacilityCollectionViewCell : UICollectionViewCell 9 | 10 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFFacilityCollectionViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PDFFacilityCollectionViewCell.m 3 | // LxPDFParser 4 | // 5 | 6 | #import "PDFFacilityCollectionViewCell.h" 7 | 8 | @implementation PDFFacilityCollectionViewCell 9 | 10 | - (instancetype)initWithFrame:(CGRect)frame 11 | { 12 | self = [super initWithFrame:frame]; 13 | if (self) { 14 | 15 | NSArray * nibArray = [[NSBundle mainBundle]loadNibNamed:@"PDFFacilityCollectionViewCell" owner:self options:nil]; 16 | 17 | if (nibArray.count < 1 || ![nibArray.firstObject isKindOfClass:[UICollectionViewCell class]]) { 18 | return nil; 19 | } 20 | 21 | self = nibArray.firstObject; 22 | } 23 | return self; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFFacilityCollectionViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFNodeDisplayCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PDFNodeDisplayCell.h 3 | // PDFCategory 4 | // 5 | 6 | #import 7 | 8 | extern const CGFloat NODE_DISPLAY_CELL_HEIGHT; 9 | 10 | @interface PDFNodeDisplayCell : UITableViewCell 11 | 12 | @property (nonatomic, strong) UILabel * displayLabel; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFNodeDisplayCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PDFNodeDisplayCell.m 3 | // PDFCategory 4 | // 5 | 6 | #import "PDFNodeDisplayCell.h" 7 | 8 | const CGFloat NODE_DISPLAY_CELL_HEIGHT = 44; 9 | 10 | @implementation PDFNodeDisplayCell 11 | 12 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 13 | { 14 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 15 | 16 | self.selectionStyle = UITableViewCellSelectionStyleBlue; 17 | 18 | self.displayLabel = [[UILabel alloc]init]; 19 | self.displayLabel.numberOfLines = 0; 20 | self.displayLabel.font = [UIFont systemFontOfSize:13]; 21 | [self.contentView addSubview:self.displayLabel]; 22 | 23 | self.displayLabel.translatesAutoresizingMaskIntoConstraints = NO; 24 | 25 | NSArray * constraintsH = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[_displayLabel]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(_displayLabel)]; 26 | NSArray * constraintsV = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_displayLabel]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(_displayLabel)]; 27 | 28 | [self.contentView addConstraints:constraintsH]; 29 | [self.contentView addConstraints:constraintsV]; 30 | } 31 | return self; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PDFTableViewController.h 3 | // PDFCategory 4 | // 5 | 6 | #import 7 | #import "LxPDFParser.h" 8 | 9 | @interface PDFTableViewController : UITableViewController 10 | 11 | @property (nonatomic,strong) LxPDFParser * pdfParser; 12 | @property (nonatomic,strong) NSMutableArray * keyPathArray; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/PDFTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PDFTableViewController.m 3 | // PDFCategory 4 | // 5 | 6 | #import "PDFTableViewController.h" 7 | #import "PDFNodeDisplayCell.h" 8 | 9 | #define CELL_REUSE_ID @"cellReuseId" 10 | 11 | @interface PDFTableViewController () 12 | 13 | @property (nonatomic, strong) NSMutableArray * contentArray; 14 | 15 | @end 16 | 17 | @implementation PDFTableViewController 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | 23 | self.tableView.tableFooterView = [[UIView alloc]init]; 24 | 25 | [self.contentArray removeAllObjects]; 26 | 27 | id content = [self.pdfParser valueForPDFKeyPath:self.keyPathArray]; 28 | 29 | if ([content isKindOfClass:[NSDictionary class]]) { 30 | 31 | NSDictionary * dictionary = (NSDictionary *)content; 32 | for (id key in dictionary.allKeys) { 33 | [self.contentArray addObject:[NSString stringWithFormat:@"%@ : %@", key, dictionary[key]]]; 34 | } 35 | } 36 | else if ([content isKindOfClass:[NSArray class]]) { 37 | 38 | NSArray * array = (NSArray *)content; 39 | for (int i = 0; i < array.count; i++) { 40 | id obj = array[i]; 41 | [self.contentArray addObject:[NSString stringWithFormat:@"%i、 %@", i, [obj description]]]; 42 | } 43 | } 44 | else { 45 | 46 | [self.contentArray addObject:[content description]]; 47 | } 48 | 49 | [self.tableView reloadData]; 50 | } 51 | 52 | - (NSMutableArray *)contentArray 53 | { 54 | if (_contentArray == nil) { 55 | _contentArray = [[NSMutableArray alloc]init]; 56 | } 57 | return _contentArray; 58 | } 59 | 60 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 61 | { 62 | return self.contentArray.count; 63 | } 64 | 65 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 66 | { 67 | PDFNodeDisplayCell * cell = [[PDFNodeDisplayCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL_REUSE_ID]; 68 | NSString * displayContent = self.contentArray[indexPath.row]; 69 | cell.displayLabel.text = displayContent; 70 | 71 | return cell.frame.size.height; 72 | } 73 | 74 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 75 | { 76 | PDFNodeDisplayCell * cell = [tableView dequeueReusableCellWithIdentifier:CELL_REUSE_ID]; 77 | if (cell == nil) { 78 | cell = [[PDFNodeDisplayCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL_REUSE_ID]; 79 | } 80 | 81 | NSString * displayContent = self.contentArray[indexPath.row]; 82 | cell.displayLabel.text = displayContent; 83 | 84 | return cell; 85 | } 86 | 87 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 88 | { 89 | NSMutableArray * newKeyPathArray = [NSMutableArray arrayWithArray:self.keyPathArray]; 90 | 91 | id content = [self.pdfParser valueForPDFKeyPath:self.keyPathArray]; 92 | if ([content isKindOfClass:[NSDictionary class]]) { 93 | 94 | NSString * displayContent = self.contentArray[indexPath.row]; 95 | NSString * displayKey = [displayContent componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" :"]].firstObject; 96 | 97 | [newKeyPathArray addObject:displayKey]; 98 | } 99 | else if ([content isKindOfClass:[NSArray class]]) { 100 | 101 | [newKeyPathArray addObject:@(indexPath.row)]; 102 | } 103 | else { 104 | return; 105 | } 106 | 107 | typeof(self) ptvc = [[PDFTableViewController alloc]init]; 108 | ptvc.pdfParser = self.pdfParser; 109 | ptvc.keyPathArray = newKeyPathArray; 110 | ptvc.title = [newKeyPathArray.lastObject description]; 111 | [self.navigationController pushViewController:ptvc animated:YES]; 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | 8 | @interface ViewController : UIViewController 9 | 10 | 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LxPDFParser 4 | // 5 | 6 | #import "ViewController.h" 7 | #import "AppDelegate.h" 8 | #import "PDFCollectionViewController.h" 9 | 10 | @interface ViewController () 11 | 12 | @end 13 | 14 | @implementation ViewController 15 | 16 | - (void)viewDidLoad { 17 | [super viewDidLoad]; 18 | 19 | PDFCollectionViewController * pcvc = [[PDFCollectionViewController alloc]initWithNibName:@"PDFCollectionViewController" bundle:nil]; 20 | UINavigationController * pcnc = [[UINavigationController alloc]initWithRootViewController:pcvc]; 21 | AppDelegate * appDelegate = [UIApplication sharedApplication].delegate; 22 | appDelegate.window.rootViewController = pcnc; 23 | } 24 | 25 | - (void)didReceiveMemoryWarning { 26 | [super didReceiveMemoryWarning]; 27 | // Dispose of any resources that can be recreated. 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/ic_drawer_creation_notask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxPDFParser/8bad84c40c5c9f9a946a1a70639a41439efbeb82/LxPDFParserDemo/LxPDFParser/ic_drawer_creation_notask.png -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/ic_drawer_creation_notask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxPDFParser/8bad84c40c5c9f9a946a1a70639a41439efbeb82/LxPDFParserDemo/LxPDFParser/ic_drawer_creation_notask@2x.png -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParser/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LxPDFParser 4 | // 5 | 6 | #import 7 | #import "AppDelegate.h" 8 | 9 | int main(int argc, char * argv[]) { 10 | @autoreleasepool { 11 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParserTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.gener-tech-bj.LxFTPRequestDemo.$(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 | -------------------------------------------------------------------------------- /LxPDFParserDemo/LxPDFParserTests/LxPDFParserTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LxPDFParserTests.m 3 | // LxPDFParserTests 4 | // 5 | 6 | #import 7 | #import 8 | 9 | @interface LxPDFParserTests : XCTestCase 10 | 11 | @end 12 | 13 | @implementation LxPDFParserTests 14 | 15 | - (void)setUp { 16 | [super setUp]; 17 | // Put setup code here. This method is called before the invocation of each test method in the class. 18 | } 19 | 20 | - (void)tearDown { 21 | // Put teardown code here. This method is called after the invocation of each test method in the class. 22 | [super tearDown]; 23 | } 24 | 25 | - (void)testExample { 26 | // This is an example of a functional test case. 27 | XCTAssert(YES, @"Pass"); 28 | } 29 | 30 | - (void)testPerformanceExample { 31 | // This is an example of a performance test case. 32 | [self measureBlock:^{ 33 | // Put the code you want to measure the time of here. 34 | }]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /LxPDFParserDemo/drawingwithquartz2d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxPDFParser/8bad84c40c5c9f9a946a1a70639a41439efbeb82/LxPDFParserDemo/drawingwithquartz2d.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LxPDFParser 2 | A delightful iOS library. Simply parse the PDF file's structure. The foundation to come true more complicated functions. 3 | Installation 4 | ------------ 5 | You only need drag LxPDFParser.h and LxPDFParser.m to your project. 6 | Support 7 | ------------ 8 | Minimum support iOS version: iOS 2.0. Demo runs on iOS 7.0 and later. 9 | How to use 10 | ----------- 11 | #import "LxPDFParser.h" 12 | ### 13 | #define PDFKitGuide_File_Path @"..." 14 | 15 | LxPDFParser * pdfParser = [[LxPDFParser alloc]initWithPDFDocumentPath:PDFKitGuide_File_Path]; 16 | NSLog(@"pdfParser.filePath = %@", pdfParser.filePath); // 17 | NSLog(@"pdfParser.pageCount = %ld", pdfParser.pageCount); // 18 | NSLog(@"pdfParser.catalogDictionary = %@", pdfParser.catalogDictionary); // 19 | 20 | id content = [pdfParser valueForPDFKeyPath:@[@"Pages", @"Kids", @2, @"Kids", @2, @"Contents", @0]]; 21 | NSLog(@"content = %@", content); // 22 | 23 | ............. 24 | 25 | Be careful 26 | ----------- 27 | Use NSString object represents NSDictionary object's key and NSNumber object represents NSArray object's index. 28 | License 29 | ----------- 30 | LxPDFParser is available under the Apache License 2.0. See the LICENSE file for more info. 31 | --------------------------------------------------------------------------------