I am developing an app where I need to show PDF documents. After many hours of googling I was able to build up a view to show the PDF document fetched from a URL.
I know only to display a single page. using CGPDFDocumentGetPage(ref, pageNumber).
What I would like to have.
Pagination function.
Zoom
Scrolling
Why not using the UIWebView instead of reinventing the wheel?
Related
I am wondering if anyone can offer any advice towards solving this problem.
I am building an app that uses a UIScrollView with paging enabled, with each page corresponding to downloaded and parsed XML data. Part of that XML data is a URL to an image.
Now, it would take forever to load an app that downloads the image for every XML entry and then push it to the respective UIScrollView page created on runtime with the rest of the XML data.
Is there a way to be able to detect which UIScrollView page you are on and then download the image as needed and still allow the rest of the data to download at runtime?
Try to read SDWebImage or Apple's LazyTableImages
Just as referenece, I solved it by adding all of the image views into an NSArray. Using the scroll view delegate, I was able to determine which page number I was on, and translated that page number to an integer that I used to access the appropriate uiimage view located within the array.
It seems to work great!
Might you offer a better solution?
I am currently using QLPreviewController to view PDFs (250MB+) However it cannot deal with real large files. Either I get the info that not the whole file has been loaded or the whole app just dies.
I also need to customize the view which is nit possible using QLPreviewController.
What should I do? Use UIWebView instead? Or will I have to use CGContextDrawPDFPage?
Using the latter, how will I get zooming implemented?
I would go with your suggestion of using a UIWebView. Doing so will automatically give you zoom support and the UIWebView should handle loading extremely large PDF's.
If you have decided to go with Quartz, this link looks very promising for zoom support.
I have a requirement to grab images from an rss feed and display these images in much the same way as browsing your picture library and I really dont know where to start first.
I can get tutorials on the rss reader but I really dont know the component to use to allow the user to "swish" through the images on screen.
There is a an open source grid view called AQGridView
That will help you in laying out the images in a grid like the photo apps "Camera Roll".
As for swiping between images, you should look into using a UIScrollView.
The Three20 library has a photo view controller, but it's cumbersome and difficult to set up if you don't know the three20 library very well.
how load a pdf into iphone and my pdf is of 200 pages then it should allow to turn the pages as we do with while reading book manually means use animation to turn a page one by one ..
Thanking you ..
Loading a large PDF and having page flipping animation isn't very simple. You can use a UIWebView like #Jim says to load the entire thing by just pointing the UIWebView's URL to the PDF but you won't get page animation. However to get full control requires that you render the PDF page by page manually to a view, and create the view's turning animation your self. Its nontrivial, and given your question you don't sound like you know enough to realistically achieve this right off.
Use UIWebView Control to load pdf files.
I have a PDF loaded in an iPhone app using UIWebView and it displays page numbers when the pages are scrolled manually. But I've had no luck figuring out how to access those numbers and set the page displayed. Any suggestions would be welcomed. Thanks.
There's no way to do this using the methods available through the SDK. If you really need this functionality you can file a bug report.
Since you're using a uiwebview it can interpret javascript for navigation, even with a pdf. determine the pixel size of each page, and you can theoretically calculate your location on any given page and and navigate accordingly.
You can do this using Quartz Core Api in Iphone SDK.
You can use Quartz to do it, as explained here : http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html
Get the length of the scroll view content and then divide it by page number.
That will give you length of each page. There is a way to get number of pages from uiwebview.