Android Question PrintHTML - No Job Sent to Printer

bocker77

Active Member
Licensed User
Longtime User
I have finally gotten around to trying Erel's suggestion in a previous post from May that is too old to post to now. I was too busy painting the rest of my military miniature armies.

Erel wrote:
Quote:
Are you using PrintHtml? You can reference files from any folder.

Code:
Sub Print
printer.PrintHtml("job", $"<b>Hello world!!!</b><br/>
<h1>second line</h1>
<img src="file://${File.Combine(File.DirRootExternal, "smiley.png")}"/>"$)
End Sub
EndQuote:

My code looks like this. I had to remove the title and header to get it to compile. It looked to me that the syntax with them in was treating the "File" method as part of the HTML.
B4X:
printer.PrintHtml("Print Game Map", $"<img src="file://${File.Combine(File.DirDefaultExternal, "GameMap.png")}"/>"$)

I get this message in the log "JobName: Print Game Map" but nothing gets sent to the printer. I view the tablet's notifications and see nothing getting sent. Earlier on in my program I call the Excel app and I can print from there so I know that the communication between the tablet and wireless printer is working. I do see the spreadsheet getting sent in Notifications.

Am I missing something in my approach?
 

bocker77

Active Member
Licensed User
Longtime User
The Printer plug-in does get called but the dialog is flashed on the screen and goes away as my app continues on. I was able to use the dialog with a breakpoint right after the PrintHTML command. Is there a way to bypass the dialog and go directly to the printer? Also my bitmap needs to be resized to fit on one piece of paper instead of four. I believe there are examples in the Forum to achieve that.
 
Upvote 0

bocker77

Active Member
Licensed User
Longtime User
Erel,

Disregard about that. I was mistaken about not compiling. What I should have written
is that it looked as if it wouldn't compile because the File method had the same color
as the html statements. Anyway I have all of my issues solved and am continuing on.
 
Upvote 0
Top