{"id":201354,"date":"2013-11-12T19:01:07","date_gmt":"2013-11-12T15:01:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=201354"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=201354","title":{"rendered":"<span class=\"post_title\">Developing Titanium module for iOS<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/361\/c0e\/6f3\/361c0e6f39c3dd6228c73d7ca39094f2.png\" align=\"left\"\/> \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e iOS \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f <a href=\"http:\/\/www.appcelerator.com\/titanium\/\">Titanium<\/a>. \u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0435\u0449\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 Titanium \u043c\u043e\u0434\u0443\u043b\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b \u043d\u0435 \u0431\u043e\u044f\u043b\u0438\u0441\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c\/\u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b Titanium.SDK. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 pdf \u0444\u0430\u0439\u043b\u0430 \u0441 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u043f\u043e\u0432\u0435\u0440\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446.<\/p>\n<p>  \u041a\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2014 <a href=\"https:\/\/github.com\/peinguin\/titanium-pdfsaver\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>.<\/p>\n<p>  Titanium \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 JavaScript. \u041d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 phonegap \u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 html5 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 WebView, \u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 nodeJS \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f. \u0412\u0441\u0435 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0441 pdf JavaScript \u043f\u043e\u043a\u0430 \u043f\u043b\u043e\u0445\u043e \u0434\u0440\u0443\u0436\u0438\u0442. \u0414\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0435\u0441\u0442\u044c <a href=\"http:\/\/mozilla.github.io\/pdf.js\/\">pdf.js<\/a> \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0444\u0430\u0440\u0438 \u043d\u0435 \u0432\u0441\u0435 \u0433\u043b\u0430\u0434\u043a\u043e, \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c <a href=\"http:\/\/parall.ax\/products\/jspdf\">jspdf<\/a> \u0433\u0434\u0435 \u043f\u043e\u043c\u0438\u043c\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0430\u0439\u043b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u041e\u0417\u0423 \u0438 \u043f\u043e\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u043d\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u041e\u0421 \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0444\u0430\u0439\u043b \u0443\u0441\u043f\u0435\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f.<br \/>  \u0418\u0442\u0430\u043a, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Titanium SDK \u043d\u0435 \u043d\u0438\u0436\u0435 3\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 titanium \u043d\u0430 \u0432\u0430\u0448 MacOS \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u00abtitanium\u00bb, \u044d\u0442\u043e \u043d\u0435 \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e. \u0410 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043c \u00abtitanium.py\u00bb \u0438\u0437 &quot;~\/Library\/Application\\ Support\/Titanium\/mobilesdk\/osx\/[SDK Version]\/&quot;. \u0414\u043e\u0434\u0430\u0439\u0442\u0435 \u0430\u043b\u0438\u0430\u0441\u044b, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435.<\/p>\n<pre><code class=\"bash\">$ cat ~\/.bash_profile  alias ios_builder=&quot;\/Users\/peinguin\/Library\/Application\\ Support\/Titanium\/mobilesdk\/osx\/3.1.3.GA\/iphone\/builder.py&quot; alias titanium.py=&quot;\/Users\/peinguin\/Library\/Application\\ Support\/Titanium\/mobilesdk\/osx\/3.1.3.GA\/titanium.py&quot; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043a\u0435\u043b\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044f.<\/p>\n<pre><code class=\"bash\">$ titanium.py create --platform=iphone --type=module --dir=\/Volumes\/yanpix_projects --name=pdfsaver --id=ti.pdfsaver <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">$ .\/build.py <\/code><\/pre>\n<p>  \u041d\u043e \u043f\u043e\u043a\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435\u0447\u0435\u0433\u043e. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0447\u0435\u0440\u0442\u0438\u0442\u044c \u043a\u0430\u043a \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 pdf \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0438 canvas \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0435\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u043f\u043e\u043c\u0435\u0442\u043a\u0430\u043c\u0438. \u0415\u0449\u0435 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b thumbnail \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b pdf \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c, \u043e\u043f\u0438\u0448\u0438\u0442\u0435 \u0435\u0433\u043e \u0432 \u00abexample\/app.js\u00bb.<\/p>\n<pre><code class=\"javascript\">\/\/ TODO: write your module tests here var pdfsaver = require('ti.pdfsaver'); Ti.API.info(&quot;module is =&gt; &quot; + pdfsaver);  var old = Titanium.Filesystem.getFile(Titanium.Filesystem.getTempDirectory(),'test.pdf'); var newpdf = Titanium.Filesystem.getFile(Titanium.Filesystem.getTempDirectory(),'export.pdf');  pdfsaver.saveInExportFileWithDrawings( \told.resolve(), \tnewpdf.resolve(), \t{ \t\t1: 'data:image\/png;base64,[base64 image representation], \t\t4: 'data:image\/png;base64,[base64 image representation]' \t}, \t1 );  var jpeg = Titanium.Filesystem.getFile(Titanium.Filesystem.getTempDirectory(),'export.jpeg');  pdfsaver.saveThumbnail( \tnewpdf.resolve(), \tjpeg.resolve() ); <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u00abResource directory\u00bb, \u0442\u043e \u0432 \u0434\u0430\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0432 \u00abTemp directory\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (~\/Library\/Application Support\/iPhone Simulator\/5.1\/Applications\/[app ID]\/tmp).<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0442\u043e \u00abTiPdfsaverModuleAssets.h\u00bb \u0438 \u00abTiPdfsaverModuleAssets.m\u00bb \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u2014 \u0432\u0441\u0435\u0440\u0430\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0442\u0438\u0440\u0430\u044e\u0442\u0441\u044f. \u0421\u0432\u043e\u0439 \u043a\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u00abTiPdfsaverModule.m\u00bb \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u00abTiPdfsaverModule.h\u00bb. \u0412\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code>#pragma Public APIs  -(void)saveThumbnail:(id)args{ \tNSString *pdf = [args objectAtIndex:0]; \tNSString *jpeg = [args objectAtIndex:1];  \tCFURLRef url = CFURLCreateWithFileSystemPath (NULL, (CFStringRef)pdf, kCFURLPOSIXPathStyle, 0); \tCGPDFDocumentRef templateDocument = CGPDFDocumentCreateWithURL(url); \tCFRelease(url);  \tCGPDFPageRef templatePage = CGPDFDocumentGetPage(templateDocument, 1); \/\/ get the first page \tCGRect templatePageBounds = CGPDFPageGetBoxRect(templatePage, kCGPDFCropBox); \tUIGraphicsBeginImageContext(templatePageBounds.size);  \tCGContextRef contextRef = UIGraphicsGetCurrentContext();  \tCGContextTranslateCTM(contextRef, 0.0, templatePageBounds.size.height); \tCGContextScaleCTM(contextRef, 1.0, -1.0);  \tCGContextDrawPDFPage(contextRef, templatePage);  \tUIImage *imageToReturn = UIGraphicsGetImageFromCurrentImageContext(); \tUIGraphicsEndImageContext(); \tCGPDFDocumentRelease(templateDocument);  \t[UIImageJPEGRepresentation(imageToReturn, 1.0) writeToFile:jpeg atomically:YES]; }  -(void)saveInExportFileWithDrawings:(id)args{  \tNSString *fresh = [args objectAtIndex:0]; \tNSString *exportpath = [args objectAtIndex:1]; \tNSDictionary *drawings = [args objectAtIndex:2]; \tNSNumber *all = [args objectAtIndex:3]; \tCFURLRef url = CFURLCreateWithFileSystemPath (NULL, (CFStringRef)fresh, kCFURLPOSIXPathStyle, 0); \tCGPDFDocumentRef templateDocument = CGPDFDocumentCreateWithURL(url); \tCFRelease(url); \tsize_t count = CGPDFDocumentGetNumberOfPages(templateDocument);  \tUIGraphicsBeginPDFContextToFile(exportpath, CGRectMake(0, 0, 612, 792), nil); \tfor (int pageNumber = 1; pageNumber &lt;= count; pageNumber++) { \t\tid image = [drawings objectForKey:[NSString stringWithFormat:@&quot;%d&quot;,pageNumber ]]; \t\tif(image == nil && [all boolValue] == NO){ \t\t\tcontinue; \t\t}  \t    CGPDFPageRef templatePage = CGPDFDocumentGetPage(templateDocument, pageNumber); \t    CGRect templatePageBounds = CGPDFPageGetBoxRect(templatePage, kCGPDFCropBox); \t    UIGraphicsBeginPDFPageWithInfo(templatePageBounds, nil); \t    CGContextRef context = UIGraphicsGetCurrentContext(); \t    CGContextTranslateCTM(context, 0.0, templatePageBounds.size.height); \t    CGContextScaleCTM(context, 1.0, -1.0);  \t    CGContextDrawPDFPage(context, templatePage);  \t    CGContextTranslateCTM(context, 0.0, templatePageBounds.size.height); \t    CGContextScaleCTM(context, 1.0, -1.0);  \t    if(image != nil){ \t    \tNSURL *url = [NSURL URLWithString:image];     \t\t\tNSData *imageData = [NSData dataWithContentsOfURL:url]; \t\t\tUIImage *ret = [UIImage imageWithData:imageData];  \t    \t[ret drawInRect:CGRectMake(0, 0, templatePageBounds.size.width, templatePageBounds.size.height)]; \t    } \t} \tCGPDFDocumentRelease(templateDocument); \tUIGraphicsEndPDFContext(); } <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u00abobjectAtIndex\u00bb. \u0418\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430. \u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<pre><code class=\"bash\">$ titanium.py run <\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0421\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u00abbuild.py\u00bb \u0438 \u0440\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0439\u0442\u0435 zip \u0444\u0430\u0439\u043b, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u0440\u043d\u0435 \u043c\u043e\u0434\u0443\u043b\u044f, \u0432 \u043a\u043e\u0440\u0435\u043d\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u0442\u0435\u0433 \u00abmodule\u00bb \u0432 \u0442\u0435\u0433 \u00abmodules\u00bb \u0432 \u0444\u0430\u0439\u043b\u0435 \u00abtiapp.xml\u00bb \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<pre><code class=\"xml\">&lt;modules&gt;     &lt;module platform=&quot;iphone&quot;&gt;ti.pdfsaver&lt;\/module&gt; &lt;\/modules&gt; <\/code><\/pre>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0435\u0449\u0438. \u041d\u0438 \u0441\u043b\u043e\u0432\u0430 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043e View \u0438 Proxy. \u041d\u043e \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0438\u0442 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0432 \u0434\u0435\u043f\u0440\u0435\u0441\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a \u043f\u0440\u043e\u0441\u0438\u0442 \u0447\u0442\u043e-\u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c \u043d\u0430 JS, \u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043d\u0443\u043b\u044f \u0443\u0436\u0435 \u043f\u043e\u0437\u043d\u043e. \u041d\u0430 JS \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043b\u043e\u0432\u0438\u0442\u044c exception`\u044b, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434. \u042f \u0434\u0443\u043c\u0430\u044e \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043c\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043d\u0430 objective-c \u0447\u0442\u043e \u0434\u0430\u0441\u0442, \u0432 \u0438\u0442\u043e\u0433\u0435, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u0441\u044f \u043e\u0442 Titanium.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/201354\/\"> http:\/\/habrahabr.ru\/post\/201354\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/361\/c0e\/6f3\/361c0e6f39c3dd6228c73d7ca39094f2.png\" align=\"left\"\/> \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e iOS \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f <a href=\"http:\/\/www.appcelerator.com\/titanium\/\">Titanium<\/a>. \u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0435\u0449\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 Titanium \u043c\u043e\u0434\u0443\u043b\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b \u043d\u0435 \u0431\u043e\u044f\u043b\u0438\u0441\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c\/\u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b Titanium.SDK. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 pdf \u0444\u0430\u0439\u043b\u0430 \u0441 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u043f\u043e\u0432\u0435\u0440\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446.<\/p>\n<p>  \u041a\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0434\u043e \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u2014 <a href=\"https:\/\/github.com\/peinguin\/titanium-pdfsaver\">\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>.<\/p>\n<p>  Titanium \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 JavaScript. \u041d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 phonegap \u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 html5 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 WebView, \u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 nodeJS \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f. \u0412\u0441\u0435 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0441 pdf JavaScript \u043f\u043e\u043a\u0430 \u043f\u043b\u043e\u0445\u043e \u0434\u0440\u0443\u0436\u0438\u0442. \u0414\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0435\u0441\u0442\u044c <a href=\"http:\/\/mozilla.github.io\/pdf.js\/\">pdf.js<\/a> \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0444\u0430\u0440\u0438 \u043d\u0435 \u0432\u0441\u0435 \u0433\u043b\u0430\u0434\u043a\u043e, \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c <a href=\"http:\/\/parall.ax\/products\/jspdf\">jspdf<\/a> \u0433\u0434\u0435 \u043f\u043e\u043c\u0438\u043c\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0430\u0439\u043b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u041e\u0417\u0423 \u0438 \u043f\u043e\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u043d\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u041e\u0421 \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0444\u0430\u0439\u043b \u0443\u0441\u043f\u0435\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f.<br \/>  \u0418\u0442\u0430\u043a, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-201354","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/201354","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=201354"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/201354\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=201354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=201354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=201354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}