My PrintHtml Solution for B4J in VB6

Magma

Expert
Licensed User
Longtime User
Hi there...

Last days i am trying to find ways how to print in B4J... (i know some you will tell about java 8 - javafx printing, printhtml... also found another printhtml <--click on it if you wanna check it/open source too...)

there are a lot ways - but all they have good and bad... none of them is a total solution.

Hope that chromium can be a solution because had zillion of command line arguments... but found a limitation that --headless can't be used from any desktop app...
found nice commands but none can run for batch file... - only at command prompt... :-(

command lines you can try...

B4X:
"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --disable-print-preview --no-first-run --kiosk-printing --kiosk "D:\B4J\yourapp\B4J\file.html"
'this print direct to you printer !!!

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"  --headless --disable-gpu --print-to-pdf=D:\file1.pdf D:\B4J\yourapp\B4J\file.html --user-data-dir="D:\"
'this creates PDF !!! very fast...

So I ve just made a step back to vb6 (for 5 minutes) and write a simple code - you can find the project down at this post and you can download/edit it if you have vb6 --> compile it if you make it as you like it.

This simple code just navigate (silent) to your html (or site) and print direct/print-preview/print with gui for selecting printer...

you can use it...
B4X:
yourcompiled.exe c:\yourdir\file.html
' This open dialog to select printer... and then print

yourcompiled.exe c:\yourdir\file.html -nouser
' direct printing to selected/default printer

yourcompiled.exe c:\yourdir\file.html -preview
' nice preview and then prints...

last edit: added compiled exe ready for use into zip + some sleep + showing form (you can disable if edit code... but you must sure when the printing will stop to end the program)

ps: By the way anyone know where to find DHTML Editing Control for Applications Redistributable Package - at an official source (ms not having at all) ???
 

Attachments

  • printhtml-bymagma.zip
    7.9 KB · Views: 116
Last edited:
Top