Apple iPad and PDF support - ipad

I have few questions related to the PDF and its use on the Apple iPad:
1) Does the iPad support all Quartz PDF functions (i.e. all CGPDFxxx functions/classes)?
2) Does the iPad support the PDF Kit?
3) Is it possible with any of one of both APIs, based on the coordinates of the finger touch to detect the underlying PDF item (e.g. article, text, annotations) ?
4) What is the difference between the Quartz PDF functions and PDF Kit?
Thanks a lot
Regards,
STeN

1) Yes, at least, I haven't come across any unsupported functions.
2) No.
3) Not natively but you may be able to inspect the PDF (in the docs somewhere) and determine position/size/type of various elements and create an overlay or use hitTest.
4) PDF Kit includes an PDF specific UIView subclass (usable in IB) and tons of methods for easily interacting with the content of the PDF including images, text selection, annotation, etc. Essentially it's just a bunch of features built on top of Quartz for your convenience.

Related

Software to open titled geo PNG file?

I'm trying to extract some a data (a map image) from a PNG file which is tiled somehow. The file itself is only 256x256 pixels (according to 'get info' on the mac) but is is 23MB. It is from an iPad app called Mud Map and it contains a map that I purchased but I've lost the original that I converted to this format. When I view this file (renamed to a .PNG) I see one section of the map - 256x256px.
I'm asking this question on StackOverflow because I want to know more about these tiled images. How does one create a tiled PNG and what is the software that will open and or create these things. I'm interested in what metadata is required too. I'm loving the outdoors and mapping!!
The answer to this question, is that it cannot be done in manner I have described.
The images in the PNG are not tiled, the the files are just merged together which is no doubt an individual feature of the program as is it does not appear to be any kind of standard.
I have no access to application you mentioned in IPad. Just share some thought about possible situation here.
1) Map tiles are commonly used in GIS web application such as Google maps and so on. It is used to improve the performance especially when user pan very often. A map displayed typical map window is divided into for instance 4*4 separate calls. So maybe only 4 call will be made when user just pan a little bit instead of get the whole map for the 16 tiles.
The source image for this tiles can be in pre-generated tiles or just one static map.
2) Assemble separate images to one in GIS is called image mosaic function. GIS server can read a collection of images and mosaiced them into one with the overlapping part handle based on a certain rule. And the images are in pre defined grid format which are seamless and no overlapping, then it is called tiled images. We could pre-generated the tiles from one mosaiced image, or we can server it on the fly. Some GIS server/library/application does have the tile server function built in.

How can I cleanly draw on a PDF both statically and dynamically on iOS?

I am currently working on an app where we would like to download a PDF from a remote server and then draw on it. We would like to draw Google Maps pin-like annotations on the PDF (the static draw part). Furthermore, we would like to detect if a user has touched a pin and then draw a calloutBox over this PDF (dynamic draw part). We obviously would like the pdf to be scrollable/zoomable. Does anyone know of a good way to achieve this?
Things I have researched:
1) Render in a UIWebView. This seems like a great solution but its not clear to me how to then implement the draw code on the PDF. I have heard people say create a transparent UIView above the UIWebView for the drawing. This seems to come with its issues, how will it handle zooming and scrolling?
2) Use Quartz 2D and generate my own PDF from the PDF I fetch from the server. As I draw my own PDF content I can draw the static marker pins. Once I have this PDF, I can then shove it in a WebView. The problem with this approach however is I still need to handle the dynamic drawing of the call-out boxes when a user taps on the pin and this then kinda takes me back to problem 1.
You're correct that Apple does not offer much in terms of this issue. There's UIWebView which can preview and show PDF documents, but it's really not suited to adding annotations, and any "solution" with views will be very fragile, if you manage to do it at all. It's meant as a black box to read PDF documents, not for annotating.
You have to go all the way back to CGContextRef and take over the scrolling, zooming and touch handling/drawing yourself. Apple's ZoomingPDFViewer example is a good start.
I have been working on this problem since 2010 and we offer a commercial solution for PDF annotating for iOS, Android and Web called PSPDFKit. We ship a custom renderer which is better and more exact than Apple's CoreGraphics renderer, but the more interesting part is that we can deal with all common PDF annotation types. You can use note annotations to represent your pins and move them around, add notes, interact/override the default tap handling (and e.g. show your own popover when people tap on them). They are also always the same size - so they can be anchored at an exact point in the PDF and then you can zoom in while they stay the same size. The best part is that this is all part of the PDF spec, so they will also work with Apple's Preview app or Adobe Acrobat, so people can save/customize the markup and then everything can be saved in the PDF. The architecture is flexible so you can also simply save everything in a database or sync it back up to your server and simply use it for touch handling.
You can also build that yourself - the basic architecture is a UIScrollView and views that are managed. It quickly gets tricky when you do zooming and have views that need to stay the same size + touch handling and maybe you also want things like multi-select or regular ink drawing. You will also want to add some sort of image caching layer, since rendering PDF documents can be quite slow on mobile devices. Oh, and if you want to make text selectable or implement search, be ready for a rabbit hole that is called the Adobe CMap and CIDFont
Files Specification.

View 3D PDF on iOS using objective-c

I have at hand a 3D PDF export using AUTOCAD, has some way to view this file in iOS?
Note that do not want to simply display a common PDF, I want to display a 3D object that is in it.
Any solution with other file formats like 3drw is already of great help.
Edit:
Note: I do not mean the applications that are in the apple store, what
I need is a way to implement the code as necessary to integrate it
into the app I'm working on.
3D PDF viewing on iOS is definitely possible. But it works a bit differently than it does on a PC. When you view a 3D PDF on a PC, Adobe Reader displays both the 2D and 3D portions of the PDF file. On iOS, the 3D portion is viewed using a separate app. CHeck out the free 3D PDF Reader from Tech Soft 3D for this:
https://itunes.apple.com/us/app/3d-pdf-reader

Create a ttf file on iOS

I want to create a simple ttf font within an iphone/ipad app. The concept is that the user will draw each letter and I will create a collection to build the ttf file.
Initially, I thought I would have to export the images from the app to a font editor such as fontforge on a server, but I am now convinced that it is possible to generate a ttf file on the device.
Here is what I think needs to happen:
1) Enable the drawing using OpenGL
2) Save the images. Is this in a vector format or as bitmap?
3) Organize the collection as a ttf file
Can someone point me in a successful direction?
1) Enable the drawing using OpenGL
And herein lies your first misconception. OpenGL is best thought as a one way device. You put drawing commands into it, and it produces a nice picture on the screen. But OpenGL is neither a geometry nor a math library.
2) Save the images
For the creation of a TTF the raw data you send to OpenGL is much more useful, than anything you could read back from OpenGL.
In particular you'll have a list of strokes, which you could convert into an outline, that then can be converted into a glyph.

PDFs with multiple layers and iOS' CGPDF* library

Has anyone here had experience with rendering PDFs with multiple layers in iOS using CGPDF* (i.e., native API)? Can you please share your experience? Did you run into performance problems?
PDF layers are called optional content in PDF specification. They are implemented on top of standard page content, begin/end layer tags are used to mark parts of page content as part of the layer. The iOS CGPDF API ignores the layer tags and displays the entire page content. Because of this there is no performance difference between a PDF file with layers and one without.

Resources