Do exists an real alternative for Webview.PrintHTML in B4i?
I've tried with Canvas.InitializePDF and then draw the Webview to the file but depending on the screen resolution of the device I had to zoom the Webview to get all of its content visible on the drawed screenshot. So I'm unable to test and set a zoom level for every screen size because I don't have a real iOS device and the simulator don't returns the real screen sizes.
It's a self written HTML form containing a large table and texts. I've choosen a HTML file instead of a B4X Table because it's needed to zoom and to merge some cells.
Here's what i actually do:
B4X:
Dim oCanvas As Canvas
Dim Rect As Rect
PrintMode = True
SaveSettingsToDB(True)
PaintHtml(SelectedMonth, SelectedYear) '<- that builds the html string a load it to the Webview
Rect.Initialize(10, 20, 595, 842)
oCanvas.InitializePDF(File.DirDocuments, FileName, 595, 842)
oCanvas.DrawView(WW_Webview, Rect)
oCanvas.Release
DocInteraction.Initialize("DocInteraction", File.DirDocuments, FileName)
DocInteraction.PreviewFile(Page1)
It views the document in the preview but its only a part of the html table. So I've tried to zoom out the webview before to get all the content visible but depending on the screen resolution of the device many different zoom levels were needed. My next try will be to change the HTML code at PrintMode to fill the HTML table to the height of the screen.
It's just a bad workarround. I only want to get the HTML table to the preview and to print it in full A4 size.
Hi Stephan, did you find a way to style the document for printing? I am currently facing the same problem and would be interested in your solution. Thanks, Thomas