Thank You for Your Reply.
I wrote a phone gap plugin for print and here the objective c CODE
which i took from
http://marceloprogramming.blogspot.com/2010/12/resolving-runtime-issues-with-airprint.html
when i compiled it at first time i have 3 errors so i fixed them as
below
now , when i call window.plugins.print.printWebPage(); it shows the
printer pop and i select the configuration and print
It prints BUT :
1. my application screen "pone gap web view " shows the printed
page(sign in page) without styles .!
2. it always print the first card which is the (sign in page) not the
current page that displays in my application that i want to print!
Can You Help Please . i want to print the current view of my
application when i press print button without destroy my application
style
i need your help ASAP ,
Thanks
/////////////////////////
- (void)printWebPage:(NSArray*)arguments withDict:
(NSDictionary*)options
{
if ([UIPrintInteractionController class]) {
UIPrintInteractionController *controller =
[UIPrintInteractionController sharedPrintController];
if(!controller){
NSLog(@"Couldn't get shared UIPrintInteractionController!");
return;
}
void (^completionHandler)(UIPrintInteractionController *, BOOL,
NSError *) =
^(UIPrintInteractionController *printController, BOOL completed,
NSError *error) {
if(!completed && error){
NSLog(@"FAILED! due to error in domain %@ with error code %u",
error.domain, error.code);
}
};
if ([UIPrintInfo class]) {
UIPrintInfo *printInfo = [UIPrintInfo printInfo];
printInfo.outputType = UIPrintInfoOutputGeneral;
//printInfo.jobName = [Singleton sharedInstance].globalBlogTitle;///
error1 Singleton undeclared
printInfo.duplex = UIPrintInfoDuplexLongEdge;
controller.printInfo = printInfo;
controller.showsPageRange = YES;
}
if ([UIViewPrintFormatter class]) {
//UIViewPrintFormatter *viewFormatter = [self.blogDetailsWebView
viewPrintFormatter];//error2 blogDetailsWebView undeclared
UIViewPrintFormatter *viewFormatter = [self.webView
viewPrintFormatter];
viewFormatter.startPage = 0;
controller.printFormatter = viewFormatter;
//error 3 navigationItem undeclared
//if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
//[controller
presentFromBarButtonItem:self.navigationItem.rightBarButtonItem
animated:YES completionHandler:completionHandler];
//} else
[controller presentAnimated:YES
completionHandler:completionHandler];
}
}
}
///////////////////////////////////
On Jun 14, 11:00 am, Shazron Abdullah <
shazron.abdul...@nitobi.com>
wrote:
> There is an example how in the Groups, I had a link to it (you'll have to find it). Then create one yourself - if no one steps forward.
> If there was one, most likely its in the Plugins repohttp://
github.com/phonegap/phonegap-plugins