Innlegg

Viser innlegg med etiketten PDF

6 posts on #iPhone & #iPad Enterprise Resource Programming: Database and PDF-reporting are covered

Bilde
Creating enterprise apps for iPhone and iPad isn't trivial. In @iFacturas we used 21 months to get out the current version. Now I'm diving into enterprise programming myself, in order to find a better way to do it.  If you know me, you also know I'm loving accounting, specially accounting program design. In many years, there has been two important parts of accounting programs, entering data and reports. Entering data has to do with database and database view programming. Reports with the same database and presenting reports, normally on PDF. I've just finished a roundtrip on database and PDF programming, and have documented the process and the source here in 6 blogposts: I may have found the golden egg in #iOS database programming! It's @sensiblecocoa I've earlier told you about that programming iPhone isn't that hard. That was only partly true however. For database programming in iPhon... Update: Hands-on with @sensibleCocoa #...

My #iOS PDF programming posts are coming to and end. This last tells you how to to finish it.

Bilde
I've combined the  iPhone 4 Development Essesials for XCode  Chapters 32 and 33, with    Apple's print tutorial for iOS .   Most of it is wrapped into the following savePdfFile method: - ( IBAction )savePDFFile:( id )sender {     NSString * path = [[ NSBundle mainBundle ] pathForResource : @"sampleData" ofType : @"plist" ];          // get a temprorary filename for this PDF     path = NSTemporaryDirectory ();     self . pdfFilePath = [path stringByAppendingPathComponent :                         [ NSString stringWithFormat : @"%d.pdf" ,                           [[ NSDate date ]                            timeIntervalSince1970 ] ]];          // Prepare the text using a Core Text Framesetter     CFAttributedStringRef currentText = CFAttributedStringCreate ( NULL ,                                                                   ( CFStringRef ) textView . text , NULL );     if (currentText) {         CTFramesetterRef fram...

#iOS programming is too hard to risk the code. A sidestep on using #git and @github to control it.

Bilde
When preparing for the following, and hopefully last, post, I decided to try to store the project in github.com to let you easily share it. That drove my tutorial to an halt. Without really knowing anything, I did a git init and git commit command, and suddenly all my source-files disappeared! I ceratinly had done something wrong, and had to try to learn Git in order to finish my small tutorial. At least I had to use Time Machine to restore the files, and recreate the project using Apple's built-in Git support. During the work I had a lot of help from the website to the book " Pro Git " by Scott Chaconn. He almost succeded in make me understand it. Way better than the "Git for dummies" wikis, which are made for much more advanced pupils than myself. I had to redo my project, marking it for the use of Git. Then I followed the steps in on github help . So now you can get the the PDF-tutorial files at https://github.com/mortjac/PDF-tutorial . In order to get...

#iOS PDF programming is still not that difficult. Now we dive into #PDF itself ;)

In the last post I described how to "draw" on iOS, which served me well in getting me started on iOS PDF programming. Now I will combine  Apple's print tutorial for iOS  and what I've learned about drawing: As with "drawing", writing PDF isn't that complicated if you sit down and decipher it. And    Apple's print tutorial for iOS  does a good job explaining it. But sadly, the tutorial has a bug in this call. The tutorial wrongly writes: currentRange = [self renderPageWithTextRange:currentRange andFramesetter:framesetter]; instead of the correct: currentRange = [self renderPage:currentPage withTextRange:currentRange andFramesetter:framesetter]; So I got this part running pretty well with the following code: - ( IBAction )savePDFFile:( id )sender

#iOS PDF programming isn't that difficult either. The hard part is to know where to start ;)

Bilde
I like to create a PDF file in my iPhone app. I then did spent to much time looking at various PDF framework. I didn't want to reinvent anything, but the frameworks I looked at just made things more complicated. So today I started to do it the Apple way, that's using Quartz 2D framework in iOS SDK. Happily I already have  iPhone 4 Development Essesials for XCode 4  in my Kindle, so I started on Chapters 32 and 33, which gives an introduction and lesson in Quarts 2D programming. I started with drawing lines, rectangles and ended up with ellipses. And the code drawing the image wasn't difficult at all: - ( void )drawRect:( CGRect )rect {     // Setting context     CGContextRef context = UIGraphicsGetCurrentContext ();      // Setting line width      CGContextSetLineWidth (context, 2.0 );      // Setting color      CGContextSetStrokeColorWithColor (context, [ UIColor blueColor ]. CGColor );      // Create a rectangle      CGRect rectangle = CGRectMake ( 60 , 170 , ...