facebook

AirPrint Code

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #325034 Reply

    adam.chavez
    Member

    Is there a print code (AirPrint) built into Mobione?
    window.print() doesn’t seem to work…

    #325080 Reply

    support-michael
    Keymaster

    Hi Adam,

    Are you planning to create a mobile webapp or a native app?

    If you are creating a mobile webapp then your snippet window.print() will activate the printer service and follow it to completion. The Test Center does not understand printing and thus will ignore the window.print() command.

    If you are wanting to create a native app with print service the api is not yet supported.

    #346440 Reply

    MalakSadik
    Participant

    how can i print the entire page(scrolled) rather than printing the visible part of the screen

    #346451 Reply

    Hi angelsprincess1,

    App print services are not provided by mobione.

    #346452 Reply

    MalakSadik
    Participant

    thank you octavio
    window.print worked for me but it only prints the visible part of the screen is there any other way to work around. something like oppening the page with another program or even open it in a new browser window(window.open() window.document.write(theHTMLwidget content)) and then print?
    do you have any other suggestions?

    #346453 Reply

    MalakSadik
    Participant

    just worked fine using new window
    but i have another question: in my page i have an HTML widget and followed by a next button. the html is dynamically resized(portraite and lanscape) but the button appears far down the page when rotating to landscape in the simulator. how can i fix that?

    Attachments:
    You must be logged in to view attached files.
    #346489 Reply

    Hi angelsprincess1,

    Please take a look at this Advanced UI Design – Cross-Platform Development to learn more about how to config your widgets and set them well for different screen sizes.

    #353540 Reply

    MalakSadik
    Participant

    I’m creating native ios app, how can I add the print service where it prints the whole page not only the visible part? With the webapp i used to open a new safari window and then print but this doesn’t work with native apps.

    #353542 Reply

    Hi,

    If you are building using MyEclipse there are some print plugins you can try. I have not tested them so I can’t really say which one would be the best for you to use. But it is an option. Using MobiOne you are limited to the window.print which doesn’t really have any options that I know of, other than using a separate css for the printing:
    http://stackoverflow.com/questions/10845621/window-print-is-not-printing-the-whole-page

    #353546 Reply

    MalakSadik
    Participant

    Ok can i open a new safari window from my native ios app and then print use window.print. And how to do this?

    #353547 Reply

    Hi,

    As MobiOne does not have any print services and I don’t believe native apps can print to the child browser without the use a plugin.

    You can open a new safari window using the javascript command:

    window.open(‘http://google.com’,’_system’);

    But, once you do this you are leaving your native app and would have no way to print it unless it was supported on the page you are opening side. Your best, and maybe only option, would be to use PhoneGap plugins, which means building using MyEclipse or an alternative build provider like PhoneGap Build.

    #353586 Reply

    MalakSadik
    Participant

    Where can I find such plugins. And how to use them in myeclipse?
    Another thing is that i cant edit my design from myeclipse. What’s mobione alternative especially for new users?

    Regards

    #353588 Reply

    Hi,

    If you are using the phone gap build services you can search their plugins: https://build.phonegap.com/plugins

    Correct, MyEclipse cannot edit mobione files. They are proprietary to MobiOne. This is why we suggest to design in MobiOne then import into MyEclipse to build the app. You can always go back into MobiOne and edit your project, then just re-generate from MobiOne and when you are ready to build reimport the edited files into MyEclipse using the ant script file, this will bring in the newly edited files and should be ready to build.

    “What’s mobione alternative especially for new users?”
    Im not sure what you mean by this.

    #353590 Reply

    MalakSadik
    Participant

    From the config.xml, I installed cordova plugin printer. How can i use this in the js button action. When i used cordova.plugins.printer.print(pagecontent,”doc.html”,…) it didn’t work. So what are the correct steps.
    Thank you for your quick response.

    #353591 Reply

    Hi,

    I havent actually tested this. But, with a brief look at the documents for it I would try something like this.
    First check if the print service is available you an do this in your device ready function;
    cordova.plugins.printer.isAvailable(
    function (isAvailable) {
    alert(isAvailable ? ‘Service is available’ : ‘Service NOT available’);
    }
    );

    If its not available below will do no good.
    If it is available, in your buttons run javascript you could put something like this to print the file called doc.html:

    // Either a DOM node or a string
    var page = document.body;

    cordova.plugins.printer.print(page, ‘doc.html’, function () {
    alert(‘printing finished or canceled’)
    });

    According to the docs this should print the entire page.

Viewing 15 posts - 1 through 15 (of 17 total)
Reply To: AirPrint Code

You must be logged in to post in the forum log in