Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS mCL
Printing webview contents

Printing the webview current document, can be done with the following code, it requires the units
MacApi.AppKit
MacApi.ObjectiveC
MacApi.ObjcRuntime
var
  printInfo: NSPrintInfo;
  printOperation: NSPrintOperation;
  fv, dv: NSView;
begin
  printInfo := TNSPrintInfo.Wrap(TNSPrintInfo.OCClass.sharedPrintInfo);
  fv := TNSView.Wrap(objc_msgSend((TMSFMXNativeWebView1.WebView.mainFrame as ILocalObject).GetObjectID, sel_getUid('frameView')));
  dv := TNSView.Wrap(objc_msgSend((fv as ILocalObject).GetObjectID, sel_getUid('documentView')));
  printOperation := TNSPrintOperation.Wrap(TNSPrintOperation.OCClass.printOperationWithView(dv, printInfo));
  printOperation.setShowPanels(True);
  printOperation.runOperation;
end