12/12/2023 0 Comments Purebasic dll![]() If RegOpenKeyEx_ (#HKEY_LOCAL_MACHINE, latestKey$, 0, #KEY_READ, ) = #ERROR_SUCCESS And hKey1 latestKey$ contains the subkey name of the relevant registry entry. LatestKey$ = "Software\GPL Ghostscript\" + latestKey$ NameBuffer = AllocateMemory ( (maxSubKeyLen+ 1 ) latestKey If RegOpenKeyEx_ (#HKEY_LOCAL_MACHINE, "Software\GPL Ghostscript", 0, #KEY_READ, ) = #ERROR_SUCCESS And hKey1 Attempt to open the relevant registry parent key. Procedure.s GhostScriptHelper_GetGhostScriptInstallation ( ) Protected result$, hKey1, numSubkeys, maxSubKeyLen, nameBuffer, i, t1, t1$, key$, latestKey, latestKey$ Failure does not necessarily mean that the library is not present - just that we cannot locate it. If successful, returns the full path (including the library name ) of the latest version of the library found on the machine, This assumes that the GhostScript installer was used. The following function attempts to locate the GhostScript library on the user 's computer. Thanks to progi1984 for his GhostScript library from which I stole the ps2pdf routine and converted to Unicode etc. Qui retourne un message d'erreur -100 provenant semble-t-il du passage du tableau des arguments. Result = CallFunction(0,"gsapi_init_with_args",intGSInstanceHandle,gsargc, Str(result) + "Ligne 123" Result = CallFunction ( 0, "gsapi_delete_instance",intGSInstanceHandle ) EndIf Result = CallFunction ( 0, "gsapi_exit",intGSInstanceHandle ) 11 Return value of 0 means "No Error"ĭebug "Input file: "+PeekS (gsargv ( 9 ) )ĭebug "Output param: "+PeekS (gsargv ( 5 ) ) If Result= 0 Result = CallFunction ( 0, "gsapi_init_with_args",intGSInstanceHandle,gsargc, ( ) ) 10 Initializing the api & passing the array of arguments Result= CallFunction ( 0, "gsapi_set_arg_encoding",intGSInstanceHandle, 1 ) 08 Revision fits, so start a new instance of ghostscript Result=CallFunction ( 0, (TGS_Revision ) ) if you use another version, change the revision check ( or just remove it ) 07 Checking the revision of the ghostscript DLL (gs32dll.dll ) OpenGSDLL=OpenLibrary ( 0,Path.s+ "\gsdll32.dll" ) If OpenGSDLL SetEnvironmentVariable ( "GS_DLL",Path.s+ "\gs\gsdll32.dll" )ĭebug GetEnvironmentVariable ( "GS_DLL" ) SetEnvironmentVariable ( "GS_LIB",Path.s )ĭebug GetEnvironmentVariable ( "GS_LIB" ) without this step, the ghostscript paths are sought in the registry, messing with a regular 05 Passing the locations of the fonts, the libs and the gsdll32.dll as environment variable 04 Array that will hold the pointers to the parameters for the ghostscript call Global Dim gsargv ( 10 ) 02 Defining the structure and variable the function gsapi_revision requires ![]() 01 Program directory, defined for convenience Rename the original gs installation directory, so it doesn 't interfere. Copy all files from :\gs\fonts, :\gs\gs.706\ lib and the dll gsdll32.dll (:\gs\gs.706\bin ) Download and install GS 7.06 to the standard paths Z:\PDFGS ( for the main program, the gs DLL and the test input file Create a fitting directory structure and define the variables according to it using the graphical rendering abilities of gs to create PDF output on the display passing PS input from StdIn directly to the gs api without a seperate input ps file minimum requirement of ghostscript files (i.e. no access of registry required, so easy installation and even more easy deinstallation no messing with existing gs installations ![]() all needed files, own program as ghostscript, should be packaged into one installer without the need of a seperate ghostscript installation, meaning: Goal was to evaluate if it is possible ( and suitable ) to create PDF files from PS input Accessing the ghostscript (gs ) api from PureBasic, 21.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |