Question

Some month ago I created a PDF Creator using FPDF (PHP Class). Now I was using NSData to fetch the PDF data from a URL into a UIWebView. Because I'm implementing offline functionalities into my app I want to convert the FPDF PHP Script into cocoa touch.

The unit used in my PHP script is mm. Now I want to know how I can convert mm to the unit used in CGRectMake() (I think it is pixels, am I right?).

Thanks for help, with kind regards, Julian

Was it helpful?

Solution

Well, simple math will get you the answer. Look up the PPI of a non-retina display, divide that by 25.4 (mm per inch) and you have your answer in pixels. However, non-retina is 1 pixel per point, so your answer in points will be the same (can be used on retina and non-retina both, retina is simply 4 pixels per point but that is taken care of for you). I'm almost sure this will be different between iPhone and iPad, so you will need to account for both.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top