[Printer Plugin] Printer Plugin - How to use it

Forge Component
(2)
Published on 2018-10-08 by Luís Rondão
2 votes
Published on 2018-10-08 by Luís Rondão

Since I didn't have the time to build a sample application yet, and someone asked me how to use the plugin, here is a brief how to.

In the screen that you want to print you just need to:
1. insert a button/link in the screen;
2. in the action associated with the button/link call the public action "PrintCurrentPage" of the PrinterPlugin.

To test you need to generate a native app and install it in a device, it won't work in the Web Preview or with OutSystems Now.
When you tap the button/link it will open the operating system's printer screen:

Luís Rondão wrote:

Since I didn't have the time to build a sample application yet, and someone asked me how to use the plugin, here is a brief how to.

In the screen that you want to print you just need to:
1. insert a button/link in the screen;
2. in the action associated with the button/link call the public action "PrintCurrentPage" of the PrinterPlugin.

To test you need to generate a native app and install it in a device, it won't work in the Web Preview or with OutSystems Now.
When you tap the button/link it will open the operating system's printer screen:

Thank you very much, worked fine!!!


Luís Rondão wrote:

Since I didn't have the time to build a sample application yet, and someone asked me how to use the plugin, here is a brief how to.

In the screen that you want to print you just need to:
1. insert a button/link in the screen;
2. in the action associated with the button/link call the public action "PrintCurrentPage" of the PrinterPlugin.

To test you need to generate a native app and install it in a device, it won't work in the Web Preview or with OutSystems Now.
When you tap the button/link it will open the operating system's printer screen:

Hello Luís Rondão,

I am using this plugin in my application and getting below error:

A fatal error has occurred. Please contact OutSystems support: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference


error details:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
at de.appplant.cordova.plugin.printer.reflect.Meta.invokeMethod(Meta.java:87)
at de.appplant.cordova.plugin.printer.Printer.initWebView(Printer.java:232)
at de.appplant.cordova.plugin.printer.Printer.access$300(Printer.java:62)
at de.appplant.cordova.plugin.printer.Printer$3.run(Printer.java:174)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)


Any pointer on this?

Thanks,

Preeti kumari