예제 #1
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);

            pinnedCallbacks.Register(converter, callback);
        }
예제 #2
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);

            pinnedCallbacks.Register(converter, callback);
        }
예제 #3
0
        public void DestroyConverter(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Destroying converter (wkhtmltoimage_destroy_converter)");

            WkhtmltoxBindings.wkhtmltoimage_destroy_converter(converter);

            pinnedCallbacks.Unregister(converter);
        }
예제 #4
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);

            pinnedCallbacks.Register(converter, callback);
        }
예제 #5
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);

            pinnedCallbacks.Register(converter, callback);
        }
예제 #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);

            pinnedCallbacks.Register(converter, callback);
        }
예제 #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);
        }
예제 #8
0
        public void Unload()
        {
            if (Loaded)
            {
                WkhtmltoxBindings.wkhtmltoimage_deinit();

                if (Unloaded != null)
                {
                    Unloaded(this, EventArgs.Empty);
                }
            }
        }
예제 #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);
        }
예제 #10
0
        public void Load(IDeployment deployment = null)
        {
            if (Loaded)
            {
                return;
            }

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

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

            Loaded = true;
        }
예제 #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));
        }
예제 #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));
        }
예제 #13
0
        public bool PerformConversion(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Starting conversion (wkhtmltoimage_convert)");

            return(WkhtmltoxBindings.wkhtmltoimage_convert(converter) != 0);
        }
예제 #14
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);
        }
예제 #15
0
        public IntPtr CreateGlobalSettings()
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Creating global settings (wkhtmltoimage_create_global_settings)");

            return(WkhtmltoxBindings.wkhtmltoimage_create_global_settings());
        }
예제 #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));
        }
예제 #17
0
        public IntPtr CreateObjectSettings()
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Creating object settings (wkhtmltopdf_create_object_settings)");

            return(WkhtmltoxBindings.wkhtmltopdf_create_object_settings());
        }
예제 #18
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));
        }
예제 #19
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)));
        }
예제 #20
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)));
        }
예제 #21
0
        public int GetPhaseCount(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting phase count (wkhtmltoimage_phase_count)");

            return(WkhtmltoxBindings.wkhtmltoimage_phase_count(converter));
        }
예제 #22
0
        public int GetPhaseNumber(IntPtr converter)
        {
            Tracer.Trace("T:" + Thread.CurrentThread.Name + " Requesting current phase (wkhtmltoimage_current_phase)");

            return(WkhtmltoxBindings.wkhtmltoimage_current_phase(converter));
        }