Printing with android and Ipad

Hi,

I am working on the app and in which i am suppose to integrate printing feature. I have gone through the guide to implement printing for iphone and its working perfectly fine for that, but for ipad its not working, when i checked the forums it shows i am suppose to pass :

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

            [pic presentFromBarButtonItem:self.printButton animated:YES

                        completionHandler:completionHandler];

        } else {

            [pic presentAnimated:YES completionHandler:completionHandler];

        }

 

this code. But when i am using this code i am getting error for the “self”. Can anyone tell me how can i overcome this?

 

Also can anyone tell me how shall i implement same feature for android as well. As i tried different things but i am getting error while building the app. I am checked the quick guide worked accordingly and it was working fine but when i implemented the printing api provided by android its showing me lots of error. Please guide me as i am suppose to submit the app very very soon.

 

Hoping your reply soon,

 

Regards

Varun

How are you implementing printing?

Rob

Hi Rob,

I want to implement printing with wifi. I have done it for iphone and its working perfectly fine but for ipad and android i am not getting the output, For android according to my study i can use printhelper class but i am getting error in that.

Regards

Varun

Let me reask my question.  How are you printing on your iPhone?  What code are you using for this?

Rob

HI Rob,

This is Varun only from other account, i am using the sample tutorial provided for wifi printing in iphone. Please find the link of the same below:

https://coronalabs.com/blog/2014/04/22/tutorial-image-printing-via-corona-enterprise-ios/

Regards

Varun

Okay, that’s good to know because we have the native.showPopup(“activity”) plugin which provides printing support on iOS using a native dialog.  The “social” plugin may provide printing on Android for free.

As far as Android, I’m not sure where to begin with that.  My native skills are not very good on the Android side.

Rob

Hi Rob,

Thanks for the info can you guide me how can i do printing using native.showPopup(“activity”) plugin. If you can share a sample code it would be great for me.

Regards

Varun

Hi Rob,

Can you tell me what can i do for the printing from ipad, the code i have shown in the post? as ipad its showing error. For android i will use some tactics but if you could help me out with the ipad part it would really be great. 

Hoping your reply soon…

Regards

Varun

The activity plugin takes a text message, an image and a  URL.  Not every activity can use all of them. I doubt the activity plugin would print a link (if it did, it’s just going to be text.

Here is the tutorial for this:  https://coronalabs.com/blog/2015/03/17/tutorial-utilizing-the-activity-popup-plugin-ios/

if (UI\_USER\_INTERFACE\_IDIOM() == UIUserInterfaceIdiomPad) { [pic presentFromBarButtonItem:self.printButton animated:YES completionHandler:completionHandler]; } else { [pic presentAnimated:YES completionHandler:completionHandler]; } }

On the iPad, the box that lets you select the printer has to have a point where it radiates out from.  When you use “presentFromBarButtonItem”, it’s expected that you are using a native Button Bar to drive this.  There is an option to use:  presentFromRect instead.  In this case you just need to create a CGrect object (doens’t have to display anything).   Maybe something like:

CGRect \*spot = new CGRectMake(0, 0, 10, 10);

then

if (UI\_USER\_INTERFACE\_IDIOM() == UIUserInterfaceIdiomPad) { [pic presentFromRect:spot animated:YES completionHandler:completionHandler]; } else { [pic presentAnimated:YES completionHandler:completionHandler]; } }

or something like that (untested)

Rob

Hi Rob, Thanks for the reply, I got that, but in option with presenrFromRect there is one more parameter I.e inView. What shall be mention there? I am sorry actually I new with native coding. Regards Varun

Have you tried it with out specifying “inView”.  It may be optional.

Rob

Hi Rob,

Yes I tried without inView but its compulsory .

You of course are treading into areas I don’t have a lot of experience in, but I would go here:

https://github.com/coronalabs/plugins-source-native-popup-activity/blob/master/ios/Plugin/IOSActivityNativePopupProvider.mm

This is the source code for our Activity popup which uses the same iPad methods.  There is an example of getting the view in there.

Rob

How are you implementing printing?

Rob

Hi Rob,

I want to implement printing with wifi. I have done it for iphone and its working perfectly fine but for ipad and android i am not getting the output, For android according to my study i can use printhelper class but i am getting error in that.

Regards

Varun

Let me reask my question.  How are you printing on your iPhone?  What code are you using for this?

Rob

HI Rob,

This is Varun only from other account, i am using the sample tutorial provided for wifi printing in iphone. Please find the link of the same below:

https://coronalabs.com/blog/2014/04/22/tutorial-image-printing-via-corona-enterprise-ios/

Regards

Varun

Okay, that’s good to know because we have the native.showPopup(“activity”) plugin which provides printing support on iOS using a native dialog.  The “social” plugin may provide printing on Android for free.

As far as Android, I’m not sure where to begin with that.  My native skills are not very good on the Android side.

Rob

Hi Rob,

Thanks for the info can you guide me how can i do printing using native.showPopup(“activity”) plugin. If you can share a sample code it would be great for me.

Regards

Varun

Hi Rob,

Can you tell me what can i do for the printing from ipad, the code i have shown in the post? as ipad its showing error. For android i will use some tactics but if you could help me out with the ipad part it would really be great. 

Hoping your reply soon…

Regards

Varun