zoukankan      html  css  js  c++  java
  • 打印内存高解决方案

    只要在ScriptObject里面加上以下代码,然后打印的时候通过调用window.external.PrintView就可以了
     

    private static object printObj;

     

    public void PrintView(string xml, string encoding, string type, string alwaysReload)

    {

        string path = Path.Combine(Application.StartupPath, "HTEMREditorLib.exe");

        string typeName = "HTEMREditorLib.Gui.EMRPrintView";

        if (alwaysReload == "1")

        {

            AppDomain domain = AppDomain.CreateDomain("PrintView");

            object obj = domain.CreateInstanceFromAndUnwrap(path, typeName);

            obj.GetType().GetMethod("PrintView").Invoke(obj, new object[] { xml, encoding, type });

            obj = null;

            AppDomain.Unload(domain);

        }

        else

        {

            if (printObj == null)

            {

                Assembly assembly = Assembly.LoadFrom(path);

                printObj = assembly.CreateInstance(typeName);

            }

            printObj.GetType().GetMethod("PrintView").Invoke(printObj, new object[] { xml, encoding, type });

        }

    }

     
  • 相关阅读:
    python环境搭建以及jupyter notebook的安装和启动
    Python base(三)
    Python base(二)
    Python base(一)
    python之装饰器
    python 内置函数 (二)
    函数的简单写法
    python中set的用法
    python在终端运行时增加一些效果
    序列化写到类里
  • 原文地址:https://www.cnblogs.com/quietwalk/p/4182289.html
Copyright © 2011-2022 走看看