Software Archive
Read-only legacy content
17061 Discussions

How to print page

Tony_T_
Beginner
574 Views

using intel xdk 2807.

Building android apk 

using bootstrap framework

os windows 10

I have tried using Google Cloud Print and jquery printThis.js with no success yet.

I have design page with images on it and a page that has a dynamically generated table. Both pages show in application. How do I print the pages or is it even possible to print the pages.

Note: Both pages print from the emulator. Neither print once I build apk.

0 Kudos
6 Replies
Dale_S_Intel
Employee
574 Views

What plugin are you using to print?  Any chance you could provide a complete xdk project we could look at to try to figure out what's happening?

Thanks!

Dale

 

0 Kudos
Anusha_M_Intel1
Employee
574 Views

This is one of the more popular print plugins - https://github.com/katzer/cordova-plugin-printer

Its for iOS and Android and users have had good luck working with it. 

0 Kudos
Tony_T_
Beginner
574 Views

Used https://github.com/katzer/cordova-plugin-printer and finally got it to working partially.

The initial problem seems to be tablets I was using. 

First tablet is RCA 10 Viking Pro running android 5.0 - print does not work crashes when line --

cordova.plugins.printer.print(page, 'Document.html', function () { alert('printing finished or canceled') });

-- is called.

Second Tablet is nextbook 8 inch running android 5.0 crashes exact same line of code.

Third phablet Galaxy Note 4 running android 5.0.1 app works printing works.

Forth Galaxy S4 running android 5.0.1 app works printing works.

Trying to determine why not apk not working on tablets

0 Kudos
Anusha_M_Intel1
Employee
574 Views

Interesting. Have you added the device plugin? You will need that. It might be a coincidence but your non-updated devices seem to be causing the issue. 

Could you zip your project and send me via IM? I can test it on my devices. 

0 Kudos
Amrita_C_Intel
Employee
574 Views

I would recommend try building with Android crosswalk instead of Android. This might solve the issue with other tablets.

0 Kudos
Tony_T_
Beginner
574 Views

Printing now working - have not checked every possibility yet.

Here is what I found so far.

The following lines were added by program:

       <!--   <a style="text-decoration:none; " onclick="window.print(); ">
                    <span class="uib_shim "></span>
                </a> -->
            </div>
            <!-- <a style="text-decoration:none; " onclick="window.print(); ">
            </a> -->

        </div>
        <!-- <a style="text-decoration:none; " onclick="window.print(); ">
        </a> -->

 Once I commented out the links that were calling window.print() function print started working.

I had a onclick event for the entire page: <div class="upage vertical-col left hidden" id="stndpg" onclick="myprint('stndpg')">

I do not know if I did something that caused all the onclick events to be added or not.

Thanks for all the responses.

I can not explain why to Samsung worked yet other two devices did not until I commented out lines..

Tony

0 Kudos
Reply