Ejemplo n.º 1
0
        public void SetProgressChangedCallback(IntPtr converter, IntCallback callback)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Setting progress change callback (wkhtmltoimage_set_progress_changed_callback)");

            WkhtmltoxBindings.wkhtmltoimage_set_progress_changed_callback(converter, callback);

            m_pinnedCallbacks.Register(converter, callback);
        }
Ejemplo n.º 2
0
        public void SetErrorCallback(IntPtr converter, StringCallback callback)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Setting error callback (wkhtmltoimage_set_error_callback)");

            WkhtmltoxBindings.wkhtmltoimage_set_error_callback(converter, callback);

            m_pinnedCallbacks.Register(converter, callback);
        }
Ejemplo n.º 3
0
        public void SetFinishedCallback(IntPtr converter, IntCallback callback)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Setting finished callback (wkhtmltoimage_set_finished_callback)");

            WkhtmltoxBindings.wkhtmltoimage_set_finished_callback(converter, callback);

            m_pinnedCallbacks.Register(converter, callback);
        }
Ejemplo n.º 4
0
        public void SetPhaseChangedCallback(IntPtr converter, VoidCallback callback)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Setting phase change callback (wkhtmltopdf_set_phase_changed_callback)");

            WkhtmltoxBindings.wkhtmltopdf_set_phase_changed_callback(converter, callback);

            m_pinnedCallbacks.Register(converter, callback);
        }
Ejemplo n.º 5
0
        public void DestroyConverter(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Destroying converter (wkhtmltoimage_destroy_converter)");

            WkhtmltoxBindings.wkhtmltoimage_destroy_converter(converter);

            m_pinnedCallbacks.Unregister(converter);
        }
Ejemplo n.º 6
0
        public void SetWarningCallback(IntPtr converter, StringCallback callback)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Setting warning callback (wkhtmltopdf_set_warning_callback)");

            WkhtmltoxBindings.wkhtmltopdf_set_warning_callback(converter, callback);

            m_pinnedCallbacks.Register(converter, callback);
        }
Ejemplo n.º 7
0
        public byte[] GetConverterResult(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting converter result (wkhtmltoimage_get_output)");

            IntPtr tmp;
            var    len    = WkhtmltoxBindings.wkhtmltoimage_get_output(converter, out tmp);
            var    output = new byte[len];

            Marshal.Copy(tmp, output, 0, output.Length);
            return(output);
        }
Ejemplo n.º 8
0
        public void Unload()
        {
            if (Loaded)
            {
                WkhtmltoxBindings.wkhtmltoimage_deinit();

                if (Unloaded != null)
                {
                    Unloaded(this, EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 9
0
        public int SetGlobalSetting(IntPtr setting, string name, string value)
        {
            Tracer.Trace(
                String.Format(
                    "T:{0} Setting global setting '{1}' to '{2}' for config {3}",
                    Thread.CurrentThread.Name,
                    name,
                    value,
                    setting));

            var success = WkhtmltoxBindings.wkhtmltoimage_set_global_setting(setting, name, value);

            Tracer.Trace(String.Format("...setting was {0}", success == 1 ? "successful" : "not successful"));

            return(success);
        }
Ejemplo n.º 10
0
        public void Load(IDeployment deployment)
        {
            if (Loaded)
            {
                return;
            }

            if (deployment != null)
            {
                Deployment = deployment;
            }

            WinApiHelper.SetDllDirectory(Deployment.Path);
            WkhtmltoxBindings.wkhtmltoimage_init(0);

            Loaded = true;
        }
Ejemplo n.º 11
0
        public unsafe string GetGlobalSetting(IntPtr setting, string name)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Getting global setting (wkhtmltoimage_get_global_setting)");

            byte[] buf = new byte[2048];

            fixed(byte *p = buf)
            {
                WkhtmltoxBindings.wkhtmltoimage_get_global_setting(setting, name, p, buf.Length);
            }

            int walk = 0;

            while (walk < buf.Length && buf[walk] != 0)
            {
                walk++;
            }

            return(Encoding.UTF8.GetString(buf, 0, walk));
        }
Ejemplo n.º 12
0
        public unsafe string GetObjectSetting(IntPtr setting, string name)
        {
            Tracer.Trace(string.Format(
                             "T:{0} Getting object setting '{1}' for config {2}",
                             Thread.CurrentThread.Name,
                             name,
                             setting));

            byte[] buf = new byte[2048];

            fixed(byte *p = buf)
            {
                WkhtmltoxBindings.wkhtmltopdf_get_object_setting(setting, name, p, buf.Length);
            }

            int walk = 0;

            while (walk < buf.Length && buf[walk] != 0)
            {
                walk++;
            }

            return(Encoding.UTF8.GetString(buf, 0, walk));
        }
Ejemplo n.º 13
0
        public int GetPhaseNumber(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting current phase (wkhtmltoimage_current_phase)");

            return(WkhtmltoxBindings.wkhtmltoimage_current_phase(converter));
        }
Ejemplo n.º 14
0
        public IntPtr CreateGlobalSettings()
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Creating global settings (wkhtmltoimage_create_global_settings)");

            return(WkhtmltoxBindings.wkhtmltoimage_create_global_settings());
        }
Ejemplo n.º 15
0
        public void AddObject(IntPtr converter, IntPtr objectConfig, byte[] html)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Adding byte[] object (wkhtmltopdf_add_object)");

            WkhtmltoxBindings.wkhtmltopdf_add_object(converter, objectConfig, html);
        }
Ejemplo n.º 16
0
        public IntPtr CreateConverter(IntPtr globalSettings)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Creating converter (wkhtmltoimage_create_converter)");

            return(WkhtmltoxBindings.wkhtmltoimage_create_converter(globalSettings, null));
        }
Ejemplo n.º 17
0
        public IntPtr CreateObjectSettings()
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Creating object settings (wkhtmltopdf_create_object_settings)");

            return(WkhtmltoxBindings.wkhtmltopdf_create_object_settings());
        }
Ejemplo n.º 18
0
        public bool PerformConversion(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Starting conversion (wkhtmltoimage_convert)");

            return(WkhtmltoxBindings.wkhtmltoimage_convert(converter) != 0);
        }
Ejemplo n.º 19
0
        public int GetHttpErrorCode(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting http error code (wkhtmltoimage_http_error_code)");

            return(WkhtmltoxBindings.wkhtmltoimage_http_error_code(converter));
        }
Ejemplo n.º 20
0
        public string GetProgressDescription(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting progress string (wkhtmltoimage_progress_string)");

            return(Marshal.PtrToStringAnsi(WkhtmltoxBindings.wkhtmltoimage_progress_string(converter)));
        }
Ejemplo n.º 21
0
        public string GetPhaseDescription(IntPtr converter, int phase)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting phase description (wkhtmltoimage_phase_description)");

            return(Marshal.PtrToStringAnsi(WkhtmltoxBindings.wkhtmltoimage_phase_description(converter, phase)));
        }
Ejemplo n.º 22
0
        public int GetPhaseCount(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting phase count (wkhtmltoimage_phase_count)");

            return(WkhtmltoxBindings.wkhtmltoimage_phase_count(converter));
        }