Print HTMLViewer

I can see HTMLViewer1.Print as a means to print the output but this setting does not seem to respect the PageSetup dialogue.

It always seems to print in Portrait.

Can it be changed to Landscape?



Mac? Win? Linux? Web?


with MBS Plugins something like this:

[code] PrintInfo = NSPrintInfoMBS.sharedPrintInfo
PrintInfo.HorizontallyCentered = false
PrintInfo.VerticallyCentered = false
PrintInfo.verticalPagination = PrintInfo.NSAutoPagination
PrintInfo.orientation = PrintInfo.NSLandscapeOrientation

dim o as NSPrintOperationMBS = NSPrintOperationMBS.printOperationWithView(HTMLViewer1, PrintInfo)

o.showsPrintPanel = true
o = nil[/code]

Thanks for your suggestion but cannot afford MBS Plugins so did it with AppleScript:

use framework "Foundation"
use framework "Cocoa"
use framework "AppKit"

-- Calling an Objective-C class method:

set tSharedPrintInfo to current application's class "NSPrintInfo"'s sharedPrintInfo()

tSharedPrintInfo's setLeftMargin:{20.0}
tSharedPrintInfo's setRightMargin:{0.0}
tSharedPrintInfo's setTopMargin:{20.0}
tSharedPrintInfo's setBottomMargin:{10.0}

-- 0 = portrait
-- 1 = Landscape
tSharedPrintInfo's setOrientation:1
tSharedPrintInfo's setVerticallyCentered:false
tSharedPrintInfo's setHorizontallyCentered:false

--tSharedPrintInfo's setHorizontalPagination:1
--tSharedPrintInfo's setVerticalPagination:0
--tSharedPrintInfo's setScalingFactor:{0.8}

current application's class "NSPrintInfo"'s setSharedPrintInfo:tSharedPrintInfo

is there an equivalent for windows ?

i have a PrintSetupString, and i didn’t find a way to use it on Windows + htmlviewer… :frowning:

We do hav ea couple of HTMLViewer functions for Windows:

You can print there.

Yes i look around, but how can i use my print setup on Windows ? On mac it was a charme with your plugin, but on pc… I dont see how :frowning:

You could use a MS Webbrowser ActiveX control instead, and it seems possible to print from that.

Isn’t that what Xojo uses internally for the HTMLViewer?

I don’t know. But there is a lot you can do with the Webbrowser, many things helpfully explained by Carlos M on the old mailing list.


If you do use the Webbrowser you must be sure to set this one correctly ( as discussed several times on this forum )( code cribbed from brainier people here available if needed ).

HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

i’m not sur how it’s relative to my printsetting that i tried to send from Xojo to the htmlviewer ?..