Friday, 15 July 2011

Georeferenced PDF using iOS & GDAL -


I've compiled GDAL 1.11.0 for iOS. I can list all the drivers but if I open a known Georeferenced PDF then I get an error ... not recognized as a supported file format. I have to develop mapping applications using GOPDF files. I am trying. Here's my code;

  - (zero) gdalTests {NSLog (@ "GDAL Trial"); GDALAllRegister (); Int a = GDALGetDriverCount (); For (Int B = 1; B & lt; A, B ++) {Anselog (@ "Jeediael driver (% d)% s", B, Jeediaelagetdraivrlog Annam (Jeediaelagetdrivr (B))); If (B == 95) {GDALDriverH drv = GDALGetDriver (b); GDALRegisterDriver (drv); NSLog (@ "PDF driver registered"); }} NSString * filePath = [[NSBundle mainBundle] pathForResource: @ "9030-4N Kurrajong" type: @ "PDF"]; GDALDatasetH Dataset = GDALOpen ([filePath cStringUsingEncoding: [NSString defaultCStringEncoding]], GA_ReadOnly; }  

Here is a part of the output with error.

  2015-03-17 16:52: 05.800 pdfTest [46322: 4110504] GDAL Driver (94) HF2 / HFZ heightfield Raster 2015/03/17 16: 52: 05.800 pdfTest [ 46322: 4,110,504] GDAL driver (95) geospatial PDF 2015/03/17 16: 52: 05.800 pdfTest [46322: 4,110,504] PDF driver registered 2015/03/17 16: 52: 05.800 pdfTest [46322: 4,110,504] GDAL driver (96) OziExplorer image file 2015/03/17 16: 52: 05.800 pdfTest [46322: 4,110,504] GDAL driver (97) USGS LULC overall theme grid 17/03/2015 16: 52: 05,801 PdfTest [46322: 4,110,504] GDAL Driver (98) Arc / Info Export E00 Grid 2015/03/17 16: 52: 05.801 pdfTest [46322: 4,110,504] GDAL Drivers ( 99) ZMap plus grid 2015/03/17 16: 52: 05.801 pdfTest [46322: 4,110,504] GDAL driver (100) NOAA NGS Jioad height grid 2015/03/17 16: 52: 05.801 pdfTest [46322: 4,110,504 ] GDAL driver (101) MBTiles 2015/03/17 16: 52: 05.801 pdfTest [46322: 4,110,504] GDAL driver (102) IRIS data (.PPI, .CAPPi etc.) error 4: `/ users / michealcumming / Library / developer / CoreSimulator / dev ice / 83827FA6-0626-4A6F-8A43-516AD495430B / data / container / bundle / application / 4249E572-0813-4C79-87BF-B1406E139552 / pdfTest.app / 9030-4N KURRAJONG.pdf 'a supported file Not recognized as a format.  

I have solved it using the code here that is to access the document data Is used for. I hope this will help you.

NSString * documentName = @ "9030-4N Kurzong"; NSString * filePath = [[NSBundle Main Bundle] Pathfoster Resource: Document Type: @ "PDF"]; NSURL * documentUrl = [NSURL fileURLWithPath: filePath]; CGPDFDocumentRef Document = CGPDFDocumentCreateWithURL ((CFURLRef) documentUrl); CGPDFStringRef string; CGPDFDictionaryRef InfoDisk; InfoDict = CGPDFDocumentGetInfo (document); NSDictionary * d = YLGetDictionaryFromCGPDFDictionary (infographic); NSLog (@ "Document Information% @", D); CGPDFPageRef page = CGPDFDCartGet page (document, 1); NSArray * ViewPortArray = [d ObjectForcae: @ "VP"); NSLTFromCecepte (CGPDFPageGetboxExp (page, KCGPDFMediabox); CGPDFDictionaryRefFirstPage = CGPDFPageGetDictionary (page); D = YLGetDictionaryFromCGPDFDictionary (First page); NSArray * NSLog (@ "----% @", name); NSLog (@ "% @", d) {NSString * name = [d objectForKey: @ "name"]; NSLog (@ "% @", d) );} (Int x = 0; x & lt; 5; x ++) {CGRX box = CGPDF pagegate boxsector (page, x); NSLo (@ "Pdf box% d =% 0.4 f% 0.4f% 0.4f% 0.4f", x, box.organ.x, box.origin.a, box.image.width, box.size.height); }

No comments:

Post a Comment