Print-View positioning on iPad
This commit is contained in:
@@ -71,9 +71,11 @@
|
||||
|
||||
UIPrintInteractionController* controller = [self printController];
|
||||
|
||||
CGRect rect = [self convertIntoRect:[settings objectForKey:@"bounds"]];
|
||||
|
||||
[self adjustPrintController:controller withSettings:settings];
|
||||
[self loadContent:content intoPrintController:controller];
|
||||
[self presentPrintController:controller];
|
||||
[self presentPrintController:controller fromRect:rect];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,10 +186,9 @@
|
||||
* The prepared print controller with a content
|
||||
*/
|
||||
- (void) presentPrintController:(UIPrintInteractionController*)controller
|
||||
fromRect:(CGRect)rect
|
||||
{
|
||||
if(CDV_IsIPad()) {
|
||||
CGRect rect = CGRectMake(40, 30, 0, 0);
|
||||
|
||||
[controller presentFromRect:rect inView:self.webView animated:YES completionHandler:
|
||||
^(UIPrintInteractionController *ctrl, BOOL ok, NSError *e) {
|
||||
CDVPluginResult* pluginResult =
|
||||
@@ -209,6 +210,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Array into Rect object.
|
||||
*
|
||||
* @param bounds
|
||||
* The bounds
|
||||
*
|
||||
* @return
|
||||
* A converted Rect object
|
||||
*/
|
||||
- (CGRect) convertIntoRect:(NSArray*)bounds
|
||||
{
|
||||
return CGRectMake([[bounds objectAtIndex:0] floatValue],
|
||||
[[bounds objectAtIndex:1] floatValue],
|
||||
[[bounds objectAtIndex:2] floatValue],
|
||||
[[bounds objectAtIndex:3] floatValue]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks either the printing service is avaible or not.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user