Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
  • EO.WebBrowser
  • EO.Wpf
  • Common Topics
  • Reference
    • .NET API Reference
      • EO.Base
      • EO.Base.UI
      • EO.Extensions
      • EO.Pdf
      • EO.Pdf.Acm
      • EO.Pdf.Contents
      • EO.Pdf.Drawing
      • EO.Pdf.Mvc
      • EO.Web
      • EO.WebBrowser
      • EO.WebBrowser.DOM
      • EO.WebEngine
      • EO.WinForm
      • EO.Wpf
      • EO.Wpf.Gauge
      • EO.Wpf.Gauge.Shapes
      • EO.Wpf.Primitives
      • EO.Wpf.Themes.Aero
      • EO.Wpf.Themes.Classic
      • EO.Wpf.Themes.Luna
      • EO.Wpf.Themes.Metro
      • EO.Wpf.Themes.Royale
    • JavaScript API Reference
HtmlToPdfSession.EscapeScriptString Method (String, Boolean)

Escapes a string so that it is suitable to be passed as a JavaScript string literal to form JavaScript code.

Syntax
 public static string EscapeScriptString(
   string s,
   bool withQuote
);

Parameters

s
The string value to be escaped.
withQuote
Whether the returned result should be enclosed in double quotes.
Remarks

This is a utility function that you may find useful when formating JavaScript code to be passed to ExecScript. For example, the following code calls this function when filling a form field:

//Format the JavaScript code that sets the value for
//form field 'comment'
string script = 
    "document.getElementById('comment').value = " + 
    EscapeScriptString(UserComment, true);
    
//Execute the JavaScript
ExecuteScript(script);
See Also