C# Класс ConvertPDF.PDFConvert

Create by : TaGoH URL of the last version: http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx Description: Class to convert a pdf to an image using GhostScript DLL A big Credit for this code go to:Rangel Avulso I mainly create a better interface and refactor it to made it ready to use!
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
output StringBuilder

Открытые методы

Метод Описание
AnsiZtoString ( IntPtr strz ) : string

Convert a Pointer to a string to a real string

Convert ( string inputFile, string outputFile ) : bool

Convert a single file!

You must pass all the parameter for the conversion as Proprieties of this class

Convert ( string inputFile, string outputFile, string parameters ) : bool

Convert a single file!

Thanks to tchu_2000 for the help!

GetRevision ( ) : GhostScriptRevision
Initialize ( string sArgs ) : bool
PDFConvert ( ) : System
PDFConvert ( IntPtr objHandle ) : System
gsdll_stderr ( IntPtr intGSInstanceHandle, IntPtr strz, int intBytes ) : int
gsdll_stdin ( IntPtr intGSInstanceHandle, IntPtr strz, int intBytes ) : int
gsdll_stdout ( IntPtr intGSInstanceHandle, IntPtr strz, int intBytes ) : int

Приватные методы

Метод Описание
ClearParameters ( GCHandle &aGCHandle, GCHandle &gchandleArgs ) : void

Remove the memory allocated

Convert ( string inputFile, string outputFile, bool throwException, string options ) : bool

Convert a single file!

You must pass all the parameter for the conversion as Proprieties of this class

CopyMemory ( IntPtr Destination, IntPtr Source, uint Length ) : void
GetGeneratedArgs ( string inputFile, string outputFile, string otherParameters ) : string[]

This function create the list of parameters to pass to the dll with parameters given directly from the program

Be very Cautious using this! code provided and modified from tchu_2000

SaveOutputToImage ( object sender, System e ) : void
StringToAnsiZ ( string str ) : byte[]

Convert a Unicode string to a null terminated Ansi string for Ghostscript. The result is stored in a byte array

gsapi_delete_instance ( IntPtr instance ) : void
gsapi_delete_instance32 ( IntPtr instance ) : void
gsapi_delete_instance64 ( IntPtr instance ) : void
gsapi_exit ( IntPtr instance ) : void
gsapi_exit32 ( IntPtr instance ) : int
gsapi_exit64 ( IntPtr instance ) : int
gsapi_init_with_args ( IntPtr instance, int argc, IntPtr argv ) : int
gsapi_init_with_args32 ( IntPtr instance, int argc, IntPtr argv ) : int
gsapi_init_with_args64 ( IntPtr instance, int argc, IntPtr argv ) : int
gsapi_new_instance ( IntPtr &pinstance, IntPtr caller_handle ) : int
gsapi_new_instance32 ( IntPtr &pinstance, IntPtr caller_handle ) : int
gsapi_new_instance64 ( IntPtr &pinstance, IntPtr caller_handle ) : int
gsapi_revision ( GS_Revision &pGSRevisionInfo, int intLen ) : int
gsapi_revision32 ( GS_Revision &pGSRevisionInfo, int intLen ) : int
gsapi_revision64 ( GS_Revision &pGSRevisionInfo, int intLen ) : int
gsapi_set_stdio ( IntPtr lngGSInstance, StdioCallBack gsdll_stdin, StdioCallBack gsdll_stdout, StdioCallBack gsdll_stderr ) : int
gsapi_set_stdio32 ( IntPtr lngGSInstance, StdioCallBack gsdll_stdin, StdioCallBack gsdll_stdout, StdioCallBack gsdll_stderr ) : int
gsapi_set_stdio64 ( IntPtr lngGSInstance, StdioCallBack gsdll_stdin, StdioCallBack gsdll_stdout, StdioCallBack gsdll_stderr ) : int

Описание методов

AnsiZtoString() публичный статический Метод

Convert a Pointer to a string to a real string
public static AnsiZtoString ( IntPtr strz ) : string
strz System.IntPtr the pointer to the string in memory
Результат string

Convert() публичный Метод

Convert a single file!
You must pass all the parameter for the conversion as Proprieties of this class
public Convert ( string inputFile, string outputFile ) : bool
inputFile string The file PDf to convert
outputFile string The image file that will be created
Результат bool

Convert() публичный Метод

Convert a single file!
Thanks to tchu_2000 for the help!
public Convert ( string inputFile, string outputFile, string parameters ) : bool
inputFile string The file PDf to convert
outputFile string The image file that will be created
parameters string You must pass all the parameter for the conversion here
Результат bool

GetRevision() публичный Метод

public GetRevision ( ) : GhostScriptRevision
Результат GhostScriptRevision

Initialize() публичный Метод

public Initialize ( string sArgs ) : bool
sArgs string
Результат bool

PDFConvert() публичный Метод

public PDFConvert ( ) : System
Результат System

PDFConvert() публичный Метод

public PDFConvert ( IntPtr objHandle ) : System
objHandle System.IntPtr
Результат System

gsdll_stderr() публичный Метод

public gsdll_stderr ( IntPtr intGSInstanceHandle, IntPtr strz, int intBytes ) : int
intGSInstanceHandle System.IntPtr
strz System.IntPtr
intBytes int
Результат int

gsdll_stdin() публичный Метод

public gsdll_stdin ( IntPtr intGSInstanceHandle, IntPtr strz, int intBytes ) : int
intGSInstanceHandle System.IntPtr
strz System.IntPtr
intBytes int
Результат int

gsdll_stdout() публичный Метод

public gsdll_stdout ( IntPtr intGSInstanceHandle, IntPtr strz, int intBytes ) : int
intGSInstanceHandle System.IntPtr
strz System.IntPtr
intBytes int
Результат int

Описание свойств

output публичное свойство

public StringBuilder output
Результат StringBuilder