Iphone sdk custom pdf viewer in uiscrollview

just like in the subject, I am struggling to get pdf view in uiscrollview.
now, first of all - I know I can do it with UIWebView. I am doing so now, but next version of my app - I need to gain much more control, hence need for doing it like that.
I hope one day, apple will create example of quartz vector graphics inside uiscrollview.
now, to the point.
basicaly got two methods:
- (void)renderZoomToBitmap
int w,h;
NSDate *start;
NSTimeInterval elapsed;
start = [NSDate date];
CGPDFPageRef pageref = CGPDFDocumentGetPage(pdf, _page);
CGRect mediaBox = CGPDFPageGetBoxRect(pageref, kCGPDFMediaBox);
mediaBox.size.width *= zoomf;
mediaBox.size.height *= zoomf;
w = mediaBox.size.width+0.5;
h = mediaBox.size.height+0.5;
CGRect viewBounds=CGRectMake(0,0,w,h);
char *renderBuff = malloc( w * h * 4 );
CGContextRef cgContext = CGBitmapContextCreate(renderBuff, w, h, 8, w * 4, CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaNoneSkipLast);
CGContextSetRGBFillColor(cgContext, 0.1, 0.1, 0.1, 1);
CGContextFillRect( cgContext, viewBounds );
CGContextDrawPDFPage(cgContext, pageref);
CGContextFlush( cgContext );
renderPage = CGBitmapContextCreateImage(cgContext);
free(renderBuff);
CGContextRelease(cgContext);
elapsed = [start timeIntervalSinceNow] * -1.0;
// NSLog(@"view bounds past zoom w:%f h:%f", b.size.width, b.size.height);
self.frame = viewBounds;
NSLog(@" renderZoomToBitmap zoom:%f took %f s", zoomf, elapsed );
and one that draws actual bitmap
- (void)drawRect:(CGRect)rect
CGContextRef context = UIGraphicsGetCurrentContext();
NSLog(@"draw rect %f %f %f %f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
CGContextTranslateCTM(context, 0.0, rect.size.height);
CGContextScaleCTM(context, 1, -1);
CGContextTranslateCTM(context, -_offset.x, _offset.y);
CGContextDrawImage(context, rect, renderPage);
[self setNeedsDisplay];
now everytime
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
is called , I set new zoom scale (zoomf) in above UIView instance, and call first method - to refresh bitmap.
it does work okay when zoomf=1.0, but when user starts zooming in/out, it does funky things.
What is the problem , do any one of you fine folks know ? please help me out with this. I am very new to quartz.
thanks.
Message was edited by: gryzman

anyone please?

Similar Messages

  • IPhone SDK custom installation, what do I need?

    FYI, I will be developing iPhone Apps only and don't want to install unnecessary things.
    Options are:
    Developer Tools Essentials (Required.)
    iPhone SDK (Obviously need.)
    System Tools (Do I need? It's checked by default.)
    UNIX Development Support (Do I need? It's checked by default.)
    Mac OS X 10.3.9 Support (Know I don't need, not developing anything for OS X, particularly not an old version.)
    WebObjects (Do I need? It's NOT checked by default.)
    Thanks.

    Hi--
    Welcome to the Apple Discussions.
    System Tools (Do I need? It's checked by default.)
    I would suggest "yes." That's the installer for the performance tools. Shark, especially, can be invaluable for profiling your code.
    UNIX Development Support (Do I need? It's checked by default.)
    I'd suggest "yes." It's command line tools you might want at some point (to help in automating builds, etc.). Some aspects of scripting with OS X can also be made easier if you have the UNIX dev support installed.
    WebObjects (Do I need? It's NOT checked by default.)
    Definitely not, that's a web application framework you'd use if you were building a web site.
    charlie

  • Custom PDF Viewer & Printer

    Hi PDF Gurus,
    I need to develop an application in which I can:
    1- Only view a PDF document (and any other features to browse in PDF document) but not freely print it, save it as... and send it by email.
    2- with a customized button I can print document with some watermarks and text for every pages of PDF document.
    3- this application will open a document in an UNC path with access restrictions only for the application itself.
    4- The application will receive the following parameters:
    PDF file name to open, username and password to access to UNC path.
    5- Application will run on 50 client (up to 15 simultaneously) under Windows 32bit
    IS there someone that already developed it, or otherwise, could you please indicate to me a SDK Library for C++ or VB.net to develop it?
    Thanks in advance
    ENRICO

    I'm looking for a virtual PDF-printer for PPC2003. I need to be able to print out from a database application for recording ECG on the PDA, and then print out the result from the recording to a file that can easily be sent by e-mail via GPRS from the PDA. I've searched everywhere for a virtual PDF-printer for the PPC2002 - 2005 witout success - does anyone know were such printer driver can be found, if there is any?
    WebDoc
    [email protected]

  • [iPhone SDK] Several modal views

    Hello Professionals,
    I have some problems with managing several modal views. So imagine that I have tabBarController with several bars. Then I create another one UIViewController with 2 buttons and display it on top of my tabBarController with help of presentModalViewController method. When I press on one of two buttons I dismiss the first one controller by calling dismissModalViewControllerAnimated and immediately after that create the second controller and display it on the screen (again with help of presentModalViewController). The first controller disappears fine but the second one does not show on the screen at all. tabBarController displays instead of second view controller. What's wrong?
    Thanks.

    Okay, I've run into this same issue. In my case I'm popping up a modal controller to allow a user to enter authentication credentials and then dismissing the modal controller when they select a "login" button. But, if they enter incorrect information, then I pop up a new authentication modal controller to allow the user to correct their authentication credentials. Unfortunately this happens fast enough that the old controller hasn't dismissed yet (using animated:YES) and the attempt to present the new modal controller fails (I presume that the "pending" dismiss zaps both the old modal controller and the new one I was attempting to present).
    So, how does one "wait" for the old modal view controller to finish being dismissed???
    Casey

  • In app pdf viewer plugin

    Hello
    We are developing an app or a customer who wants to be able to show pdf in apps. For this we need a custom pdf viewer or something like a adobe pdf viewer plugin to use.
    Does something like this exist? Thank you!

    Moved to Acrobat SDK

  • IPhone users unable to view PDF fillable form data?

    I've created a form that my staff use to send quotes to our customers.
    The form is sent via email using the submit a form button as 'PDF The complete document'.
    I spent several days testing the form to ensure that everything worked correctly and as far as I could tell everything seemed fine.
    Unfortuntately, several of our customers who own iPhones have informed us that the form arrives blank. None of the fields are showing any data or information that my staff filled in.
    I've read several posts online and they all suggest this is to do with the version of Adobe that is pre-installed on iOS devices. If Adobe Reader is downloaded on the iPhone it should read the form properly.
    Is there any way around this? Ideally I don't want my customers to have to download something before they can read our quote.
    Also several of the text fields have javascript attached to them which I would like to keep, such as the 'Link' text field (it has a hyperlink javascript attached). I considered sending the quotes as a .jpg file instead but this would mean losing these features which took so long to build into the quote.
    I've attached a sample version of my form in case it helps.
    Sample
    Any advice would be much appreciated.
    Thanks,
    Sabri

    I'd suggested flattening the form fields, which converts them to regular page contents. There won't be any interactive fields after you do this though. It is possible to flattten just certain fields so that your script would still work if the form is viewed in a compatible PDF viewer, but this would require a custom script.
    Here's a link to a free JavaScript-based tool that you can use to flatten the fields: http://www.uvsar.com/projects/acrobat/flattener/
    It could be customized to exclude certain fields.

  • [iPhone SDK] Preference view design/implementation

    Hi, everyone!
    I want to add preference view in my application (build on iPhone SDK 3.0), but don't want to use preference bundle for several reasons.
    And I can't find any suitable UI component to do it (maybe it's UITableView with custom views (with rounded corners)?
    Any thoughts on it?
    Thanks for attention.
    Have a good day

    The rounded corners you see in the system Settings app are produced by a UITableView created with UITableViewStyleGrouped. Each group of cells in a rounded frame is a section of the table view, so you can duplicate a typical Settings page by setting the number of sections and the number of rows per section.
    It looks like you could build most of the cells in Settings by simply adding your own images and/or controls to standard UITableViewCell instances.
    Several of the pages in the UICatalog sample app provide good examples of how to code Grouped style table views with cells similar to some of the Settings cells. That sample code is for 3.0, btw, but almost all of the code is appropriate for 2.x as well.
    If you need help with table views and table view cells in general, see the Table View Programming Guide for iPhone OS.
    For more basic instruction, see Chapter 8 of +Beginning iPhone Development: Exploring the iPhone SDK+ by Mark and LaMarche.

  • My HP Officejet 8500a All-In-One forwards faxes (as a tiff file) to my iphone.  Can only view/receive 1st page, embedded into email as a non-attachment.  Iphone receives email(s) pdf attachments well.  What can I do?

    My HP Officejet 8500a All-In-One forwards faxes (as a tiff file) to my iphone.  Can only view/receive 1st page, embedded into email as a non-attachment.  Iphone receives email(s) pdf attachments well.  What can I do?

    Try this app
    http://itunes.apple.com/us/app/fax-reader/id406902152?mt=8

  • Set Adobe Reader iPad/iPhone app to just view pdf instead of downloading it?

    Hello,
    I work for a financial company and it seems that some of our user's were having trouble viewing a pdf document that contained editable text boxes.  The layout of the form itself would show, but none of the text within the text boxes would appear.  So I tested the pdf out on my phone as well and did the same exact thing (layout shows, but no text).   Since everyone was having trouble viewing the text within the document, I downloaded the Adobe Reader App and it worked perfectly.  The only issue that I have is that since we are a financial institution, we get audited quite often and having documents stored on your phone is a big 'no-no' to the auditors.  So I was wondering if it was possible to make the Adobe Reader App just view the pdf instead downloading the pdf to the application and storing it in the docs and the recent docs setting.  A little more info on our part:   We are running Exchange 2010, my iPhone is a 4S and it's running the ios7, and the iPad is running ios 6.1.03 (I think).  Also, I did a little bit of searching but I could find anything but is there some sort of list that will say what does/does not work in regards to pdf's on iPhones or iPads?  Any suggestions/help is very welcome and appreciated!
    Thanks,

    Hi Shradha and thank you for that information.  Now is that only in regards to the Adobe Reader app or does that copy expand to all current pdf viewer apps on iOS?  If it is only in regards to the Adobe Reader app, then do you know of an app that may have the functionality that I am looking for?  I have tried searching for one, but I have been unsuccessful in my searches.
    Thanks,

  • IPhone 3G S - Change Default PDF Viewer?

    Have an iPhone 3GS. Bought Goodreader because I need a PDF viewer that has reflow ability. I also use dropbox to easily link to my important files. However, whenever I open a PDF file, it launches the default iPhone PDF viewer, which does not have reflow. There are ways to get my files into goodreader, but they are cumbersome. In any event, I really just want my default PDF viewer to be goodreader so every time I open any PDF file whether it be from an email, dropbox or whatever, it used goodreader. Is this possible? Thanks.

    Thanks. I tried the g thing and that is a nice time saver. I know about dropboxes' web app to grab files. In fact, I'll use that with your g thing tip. Just trying to save the steps it takes to get it into goodreader from the dropbox web app. Being able to directly load from the dropbox iphone app would be better, but your g thing is quite a bit better than the next best alternative that currently exists. I still wish there was a way to make goodreader the default pdf viewer.. Thanks.

  • How to switch between views in iPhone SDK

    I have been tasked to learn the iPhone SDK. I know Actionscript, Javascript and some Java, but I cannot understand the iPhone SDK at all. I cannot understand the syntax or how the multitude of files work together. Also, there are no tutorials for complete beginners that show step-by-step what to do and why.
    All I am trying to make is an application with a couple of views that change when the user touches a button. What is the easiest way to switch from one view to another?
    Also, what is an AppDelegate? What is "synthesize"? What is "nonatomic,retain"? Why can't I write code like this... theButton.onClick=loadView("NewView");

    Ok, you really need to read up some on how Objective-C and Cocoa work.
    That said, If you make a new project in XCode using the "Utility" template, you can immediately run it and see a view transition (flip).
    Ultimately, however, what you're looking to do is way beyond what you should be expecting to be to be able to do at this point. Programming a scripting language (Javascript, ActionScript) is much different than programming in C/C+/Objective-C/Objective-C+. While not directly applicable to the iPhone, you'll probably want to buy and read Aaron Hillegass' book "Cocoa Programming for Mac OX X 3rd Edition".
    There is a tutorial on the iPhone Dev Center (log in, main page, bottom right, under "resource types", click "Guides", and look for "iPhone Application Tutorial" on the next page) that is worth reading.
    rob.

  • IPhone SDK UISegmentedControl and hiding view

    Hello,
    Im slowly getting to grips with the iPhone SDK but having a problem today, I have a UISegmentedControl setup to a toggleSetting function but this toggleSetting calls a url in the background for some data, but this freezes my application while the web request is taking place, this can take around 2 seconds and so I made another view (loadingView) with a loading screen thats animated and I want to show this whis the connection is taking place and then hide it again once complete.
    I don't have any problems with showing or hiding the view until the web request happens.
    When my app loads I call \[loadingView setHidde:YES] which hides my view straightaway, then my toggleSettings method is below, but this does not cause the view to show while the quest is taking place, I think it is showing an hiding it instantly as if I just ask to show it, it will show but only after the web call is complete. Anyone got any pointers???
    <code>
    -(IBAction)toggleSetting:(id)sender
    [loadingView setHidden:NO];
    UISegmentedControl *segmentedControl = (UISegmentedControl *)sender;
    NSInteger segment = segmentedControl.selectedSegmentIndex;
    if(segment==0) {
    NSURL *url = [NSURL URLWithString:@"http://myurl"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil ];
    [loadingView setHidden:YES];
    </code>

    I don't have code handy but take a look at the class reference for NSURLConnection and related calls.
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self startImmediately:YES]; would be a good start.
    You want to use a call that will create some callbacks to update you when a connection is confirms, how many bytes are transfered, etc. so be sure to write the call functions.

  • IPhone SDK: auto-rotation sets wrong bounds in view?

    Hi all,
    Can anybody confirm if this is a bug in the iPhone SDK? I have a ViewController that defines as its view a DimensionsLogger, which is a trivial subclass of UIView that just logs its frame, bounds and center properties when layoutSubviews is invoked.
    When I set this view as the root view in my application, the dimensions are logged like so (portrait mode):
    Bounds: (0.000000, 0.000000) x (320.000000, 460.000000)
    I rotate it to landscape mode and the bounds are logged:
    Bounds: (0.000000, 0.000000) x (390.000000, 390.000000)
    Bounds: (0.000000, 0.000000) x (480.000000, 300.000000)
    Then back to portrait mode:
    Bounds: (0.000000, 0.000000) x (390.000000, 390.000000)
    Bounds: (0.000000, 0.000000) x (320.000000, 460.000000)
    So far, so good.
    When I add my DimensionLogger + ViewController to a NavigationController, however, the same process (repeated several times) yields the following output:
    Bounds: (0.000000, 0.000000) x (320.000000, 416.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    The bounds value never returns to the original dimensions.
    Am I missing something, or is this a bug? The practical consequence of this is that it seems impossible to combine the following 3 UI elements:
    - "anchoring" something to the bottom of a view, like a UIToolbar (NOT a tabbar)
    - Nesting that view in a UINavigationController
    - Supporting portrait and landscape interface orientation.
    Also, if I file this as a bug, is there any way to search the bug report tool to see if this has already been filed? I've logged into the tool and I see some search functionality but it only seems to search bugs I've previously filed.
    Thanks,
    Russ

    Just wanted to add that I've tried this in the simulator and on a provisioned iPod touch, same results on both.
    Russ

  • Customizing unlock screen (official iPhone SDK)

    Hi,
    I want to write a small application, that implements a customized unlock screen on iPhone. Is there a way to do it using standard iPhone SDK?
    Thanks a lot for a clues
    Nava

    I tried the following :
    NSError *error;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"export.csv"];
    if ([records writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:&error] == NO) {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Export error" message:@"An error occured while writing the file."
    delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [alert show];
    [alert release];
    static NSString *email = @"[email protected]";
    NSString *outMailtoPath = [NSString stringWithFormat:@"mailto:%@?subject=Review&body=%@&attachment=%@", email, @"test", path, nil];
    NSURL *url = [NSURL URLWithString: [(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)outMailtoPath,NULL,NULL,kCFStringEncodingUTF8) autorelease]];
    [[UIApplication sharedApplication] openURL:url]

  • IPad mail sending one page PDF documet as a picture. This picture is not viewing for other people who email open. this problem is from iBooks and from Pages.  (if I sending one page document from Pages from iPhone is ok - PDF)

    iPad mail sending one page PDF documet as a picture. This picture is not viewing for other people who email open. this problem is from iBooks and from Pages.
    (if I sending one page document from Pages from iPhone is ok - PDF. If I sending one page document from iPad is mistake. )

    Turn off rich text in your email signature. Delete images too, if any.

Maybe you are looking for

  • While both synching my nano and trying to copy my library I am getting error 69 and it won't copy or synch

    I amtrying to consolidate my i-tunes library so I canmove it to new computer.  It said it could not complete because of error 69.  Later when I was synching my nano or trying to I got the same error message. susanfrom lombard

  • Widgets...am I the only one who is experiencing this?

    I've never not had any replies to the many posts I've made over the years. This is the first time. Has anyone used or upgraded to iWeb '09 and successfully employed widgets? Even a youtube widget/link? I have tried every work-around I can think of, a

  • Updating button icon issue

    Hi, thanks for stopping by. Working with scriptUI panel and trying to update icon for my button, but something goes wrong with my code, I guess... Can someone write what is the problem here? var mainPanel; function stabpanel(thisObj) {     mainPanel

  • Why am I getting an incorrect password message

    First I was getting a message that my apple id had been disabled. Now it's telling me my password is incorrect, and I can't send or receive email

  • Time of calculation before aggregation is obsolete

    Hi Gurus, I have this message when i try to ejecute my query, can anyone help me to resolve this problem, i have the SAP 7.0 EHP 1, and i just have the upgrade from SAP 3.5. I have a lot of CKF's in my queries and all of those use BEFORE AGGREGATION