This is a showcase to demonstrate printing web content of a Omnis Studio oBrowser GUI component.
- Omnis Studio 8.1.7.2 or higher
- Some basic understanding of Javascript
- Some knowledge of the Omnis HTML controls. Documentation about the structure and usage of the oBrowser component and Omnis HTML controls can be found in the Omnis Programming Manual.
- If you did not use custom HTML controls before you als have to set the user HTML control folder in the config.json folder. Otherwise you can skip to the step where you copy the HTML control to Omnis Studio/htmlcontrol folder
- Open Finder and goto the folder
~/Library/Application Support/Omnis/Omnis Studio 8.1.7.2/studio
- Open de file
config.json
in a texteditor - Change the property
defaultHtmlcontrolsFolderInDataFolder
fromfalse
totrue
and save the file. - Copy the HTML control folder
printSample
to the folder~/Library/Application Support/Omnis Software/Omnis Studio 8.1.7.2
There are two ways to do it. For both you need to add some javascript to the webcontent. I am sure this can be done in several ways. Below you can find two simple ways. There actually quite similar.
- Implement a print function in the OmnisCallBackObject
- Implement a print button in the htm page
The difference between these is that with the first one you have an Omnis pushbutton to invoke the print of the contents. With the latter you have a HTML button which prints the contents. Both have theire (dis)advantages. With both methods it comes down to a javascript command window.print().