Printershare intent

Rusty

Well-Known Member
Licensed User
Longtime User
I have contacted Printershare and they have indicated that an app can print via intent through their software.
I've tried to create a proper intent and point it toward the file I wish to print.
The below is my attempt at the intent, but instead of printing, it is opening a file editor.
B4X:
'the recommended intent from Printershare    
            'Intent i = new Intent(Intent.ACTION_VIEW);
            'i.setPackage("com.dynamixsoftware.printershare");
            'i.setDataAndType(data_uri, data_type);
            'StartActivity(i);

'my b4a intent 
    Dim Instl As Intent
    Instl.Initialize(Instl.ACTION_VIEW, "com.dynamixsoftware.printershare")
    Instl.SetType("text/html")
    Instl.PutExtra("data_uri", File.DirRootExternal & "/survey/Facilities.txt")
    StartActivity(Instl)
Any advice is appreciated
Thanks, Rusty
 

Dman

Active Member
Licensed User
Longtime User
I make reports in html and use printershare. I don't call printershare directly, I call a browser and the first time you click on it, you can select printershare as the default. Then it opens up in printershare every time from then on. I don't know if that is what you want but it works pretty good for me.

B4X:
   Dim browser As Intent
      browser.Initialize(browser.ACTION_VIEW, "file:///" & File.DirDefaultExternal & "/techsheet.html")
      browser.SetType("text/html")
       StartActivity(browser)
 
Last edited:
Upvote 0

Derek Johnson

Active Member
Licensed User
Longtime User
I just came across this topic and I thought I would reply as someone else might have the same issue.
I have found a solution to using PrinterShare directly via an Intent in B4A

B4X:
    log("Using PrinterShare to print " & url)
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW,url)
    i.PutExtra(url,"text/html")
    i.SetComponent("com.dynamixsoftware.printershare/")
    StartActivity(i)

eg Using PrinterShare to print file:///storage/emulated/0/Download/myfile.html

I think that you have to download the file first to local storage.
 
Upvote 0
Top