csharp: Cyotek.GhostScript.Pdf Conversion pdf convert image x64
NativeMethods.cs x64
using System; using System.Runtime.InteropServices; namespace Cyotek.GhostScript { /// <summary> /// 64位 /// https://github.com/kelter-antunes/Cyotek.GhostScript.x64 64位 /// </summary> internal class NativeMethods { #region Public Class Methods // void gsapi_delete_instance (void *instance); [DllImport("gsdll64.dll", EntryPoint = "gsapi_delete_instance")] public static extern void gsapi_delete_instance(IntPtr instance); // int gsapi_exit (void *instance); [DllImport("gsdll64.dll", EntryPoint = "gsapi_exit")] public static extern int gsapi_exit(IntPtr instance); // int gsapi_set_poll (void *instance, int(*poll_fn)(void *caller_handle)); // int gsapi_set_display_callback (void *instance, display_callback *callback); // int gsapi_init_with_args (void *instance, int argc, char **argv); [DllImport("gsdll64.dll", EntryPoint = "gsapi_init_with_args")] public static extern int gsapi_init_with_args(IntPtr instance, int argc, IntPtr argv); //int gsapi_new_instance (void **pinstance, void *caller_handle); [DllImport("gsdll64.dll", EntryPoint = "gsapi_new_instance")] public static extern int gsapi_new_instance(out IntPtr pinstance, IntPtr caller_handle); // int gsapi_revision (gsapi_revision_t *pr, int len); [DllImport("gsdll64.dll", EntryPoint = "gsapi_revision")] public static extern int gsapi_revision(out NativeStructs.GS_Revision pr, int len); // int gsapi_run_string_begin (void *instance, int user_errors, int *pexit_code); // int gsapi_run_string_continue (void *instance, const char *str, unsigned int length, int user_errors, int *pexit_code); // int gsapi_run_string_end (void *instance, int user_errors, int *pexit_code); // int gsapi_run_string_with_length (void *instance, const char *str, unsigned int length, int user_errors, int *pexit_code); // int gsapi_run_string (void *instance, const char *str, int user_errors, int *pexit_code); // int gsapi_run_file (void *instance, const char *file_name, int user_errors, int *pexit_code); [DllImport("gsdll64.dll", EntryPoint = "gsapi_run_file")] public static extern int gsapi_run_file(IntPtr instance, string file_name, int user_errors, int pexit_code); //int gsapi_set_stdio (void *instance, int(*stdin_fn)(void *caller_handle, char *buf, int len), int(*stdout_fn)(void *caller_handle, const char *str, int len), int(*stderr_fn)(void *caller_handle, const char *str, int len)); [DllImport("gsdll64.dll", EntryPoint = "gsapi_set_stdio")] public static extern int gsapi_set_stdio(IntPtr instance, StdioCallBack stdin_fn, StdioCallBack stdout_fn, StdioCallBack stderr_fn); #endregion Public Class Methods // int gsapi_set_visual_tracer (gstruct vd_trace_interface_s *I); } }
NativeMethods.cs x32
using System; using System.Runtime.InteropServices; namespace Cyotek.GhostScript { /// <summary> /// 32位 /// https://github.com/kelter-antunes/Cyotek.GhostScript.x64 64位 /// </summary> internal class NativeMethods { #region Public Class Methods // void gsapi_delete_instance (void *instance); [DllImport("gsdll32.dll", EntryPoint = "gsapi_delete_instance")] public static extern void gsapi_delete_instance(IntPtr instance); // int gsapi_exit (void *instance); [DllImport("gsdll32.dll", EntryPoint = "gsapi_exit")] public static extern int gsapi_exit(IntPtr instance); // int gsapi_set_poll (void *instance, int(*poll_fn)(void *caller_handle)); // int gsapi_set_display_callback (void *instance, display_callback *callback); // int gsapi_init_with_args (void *instance, int argc, char **argv); [DllImport("gsdll32.dll", EntryPoint = "gsapi_init_with_args")] public static extern int gsapi_init_with_args(IntPtr instance, int argc, IntPtr argv); //int gsapi_new_instance (void **pinstance, void *caller_handle); [DllImport("gsdll32.dll", EntryPoint = "gsapi_new_instance")] public static extern int gsapi_new_instance(out IntPtr pinstance, IntPtr caller_handle); // int gsapi_revision (gsapi_revision_t *pr, int len); [DllImport("gsdll32.dll", EntryPoint = "gsapi_revision")] public static extern int gsapi_revision(out NativeStructs.GS_Revision pr, int len); // int gsapi_run_string_begin (void *instance, int user_errors, int *pexit_code); // int gsapi_run_string_continue (void *instance, const char *str, unsigned int length, int user_errors, int *pexit_code); // int gsapi_run_string_end (void *instance, int user_errors, int *pexit_code); // int gsapi_run_string_with_length (void *instance, const char *str, unsigned int length, int user_errors, int *pexit_code); // int gsapi_run_string (void *instance, const char *str, int user_errors, int *pexit_code); // int gsapi_run_file (void *instance, const char *file_name, int user_errors, int *pexit_code); [DllImport("gsdll32.dll", EntryPoint = "gsapi_run_file")] public static extern int gsapi_run_file(IntPtr instance, string file_name, int user_errors, int pexit_code); //int gsapi_set_stdio (void *instance, int(*stdin_fn)(void *caller_handle, char *buf, int len), int(*stdout_fn)(void *caller_handle, const char *str, int len), int(*stderr_fn)(void *caller_handle, const char *str, int len)); [DllImport("gsdll32.dll", EntryPoint = "gsapi_set_stdio")] public static extern int gsapi_set_stdio(IntPtr instance, StdioCallBack stdin_fn, StdioCallBack stdout_fn, StdioCallBack stderr_fn); #endregion Public Class Methods // int gsapi_set_visual_tracer (gstruct vd_trace_interface_s *I); } }
pdf View 在线预览 Web or Win
https://www.cyotek.com/blog/convert-a-pdf-into-a-series-of-images-using-csharp-and-ghostscript
https://www.cyotek.com/source-code
https://www.codeproject.com/Articles/317700/Convert-a-PDF-into-a-series-of-images-using-Csharp
https://www.cyotek.com/blog/extending-the-imagebox-component-to-display-the-contents-of-a-pdf-file-using-csharp#files
https://github.com/ArtifexSoftware/ghostpdl-downloads/releases
https://www.ghostscript.com/releases/gsdnld.html
webform:
winform:
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)