Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GhostScript gsdll32.Dll
Message
From
19/10/2015 10:11:58
Marcus Hüneke
Heidelberger Druckmaschinen
Wiesloch, Germany
 
 
To
19/10/2015 09:56:58
Marcus Hüneke
Heidelberger Druckmaschinen
Wiesloch, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01626146
Message ID:
01626153
Views:
57
OK, here is the sourcecode which doesn't work:
Clear All

Set Default To c:\foxpro9\ppdauto

*ghostscript must be called in this row

*!*	1.gsapi_new_instance
*!*	2.gsapi_init_with_args
*!*	3.gsapi_exit
*!*	4.gsapi_delete_instance

Declare Long gsapi_new_instance In gsdll32.Dll Long @, Long
Declare Long gsapi_delete_instance In gsdll32.Dll Long
Declare Long gsapi_init_with_args In gsdll32.Dll Long, Long, Long
Declare Long gsapi_exit In gsdll32.Dll Long


Store 0 To lnGsinstancehandle, lnCallerhandle, lnElementcount, lnCounter, lnReturn, lnGsinstancehandle, params, lhMemory

lnReturn = gsapi_new_instance(@lnGsinstancehandle,@lnCallerhandle)

If lnReturn  = 0  && Succsess
	tcFileout =  "-tiffg4-%03d.tif"
	tcFilein = "new.pdf"


	Dimension laArgs[6]
	laArgs[1] = "dummy"
	laArgs[2] = "-dBATCH"
	laArgs[3] = "-r"+"600X600"
	laArgs[4] = "-sDEVICE=tiffg4"
	laArgs[5] = "-sOutputFile="+tcFileout
	laArgs[6] = tcFilein



	lnPtr = VFP2BinArray(@laArgs,@params,@lhMemory)
    
    
    
    lnReturn = gsapi_init_with_args(lnGsinstancehandle,lnPtr,params)
    
    
    
    SET STEP on
    
    
    
  *  WAIT WINDOW lnPtr
     
    

	


*  WAIT WINDOW lnreturn
	gsapi_exit(lnGsinstancehandle)
	gsapi_delete_instance(lnGsinstancehandle)

    LocalFree(lhMemory)



Endif





Wait Window lnReturn






Function VFP2BinArray(taData, tqBinArray, thMem)
*****************************************************
** Converts a VFP array of strings into an array of string pointers for
** for passing to API functions
**
** Parameter:
**  taData - The array of VFP strings, passed by reference
**  tqBinArray - (out)The array of pointers, in VarBinary format to pass
**         to the API function, passed by reference
**  thMem - (out)The memory buffer to hold the string values, passed by
**         reference. This memory must be freed manually using the
**         LocalFree API function.
**
** Returns: Numeric - the number of strings placed into the binary array
*****************************************************

Local lhBuffer, lhPos
Local lqBinArray, lnArrayCnt
Local lnDataLen
Declare Long LocalAlloc In WIN32API Long uFlags, Long uBytes
Declare Long LocalFree In WIN32API Long Hmem

lnArrayCnt = 0
lqBinArray = 0h

Try
** Get the total length for the character data
	lnDataLen = 0
	For lnLoop = 1 To Alen(taData)
** Add 1 byte to each string length for the NULL terminator
		lnDataLen = lnDataLen + Len(taData[lnLoop])+1
	Endfor

** Allocate memory buffer
	lhBuffer = LocalAlloc(0x0040,lnDataLen)

** Stuff character data into buffer
	lhPos = lhBuffer
	For lnLoop = 1 To Alen(taData)
** Stuff string into buffered memory
		Sys(2600, lhPos, Len(taData[lnLoop])+1, taData[lnLoop]+Chr(0))
** Add position to binary array
		lqBinArray = lqBinArray + BinToC(lhPos,"4rs")
** Increase our position pointer
		lhPos = lhPos + Len(taData[lnLoop])+1
** Increase Array count
		lnArrayCnt = lnArrayCnt + 1
	Endfor
Catch To loExc
	Throw
Finally
	If lnArrayCnt > 0
		tqBinArray = lqBinArray
		thMem = lhBuffer
	Else
		If lhBuffer <> 0
			LocalFree(lhBuffer)
		Endif
	Endif
Endtry

Return lnArrayCnt
Previous
Reply
Map
View

Click here to load this message in the networking platform