0

I found this link for Magick.NET

Is there way to refer ghostscript's DLLs without installing?

It mentions function: MagickNET.SetGhostscriptDirectory

Is there an equivalent for Python?

I tried setting path, but in python program, it fails to load gsdll64.dll when copied to other machine:

My code:

import os, time
import sys
import camelot.io as camelot
import traceback 

sys.path.insert(0, r'C:\gs\gs9.56.1\bin')
sys.path.insert(0, r'C:\gs\gs9.56.1\lib')

print('path',sys.path)

#check ghostscript lib - as done in ghostscript_backend.py
import ctypes
from ctypes.util import find_library
mylib = find_library("".join(("gsdll", str(ctypes.sizeof(ctypes.c_voidp) * 8), ".dll")))
    
print(mylib,os.getcwd())
if mylib is None:
    print('gsdll not loaded')

KenS
  • 30,202
  • 3
  • 34
  • 51
Deepak Garud
  • 977
  • 10
  • 18

1 Answers1

0

In site-packages\ghostscript\_gsprint.py

The code is written to get dll path from windows registry.

In function __win32_finddll, I added code to check and load dll from my folder:

    LooseVrsn = "9.56.1" #from dll->Properties->details->ProductVersion
    dll_path = os.path.join(os.getcwd(),'gsdll64.dll')
    dlls.append((LooseVrsn, dll_path))
Deepak Garud
  • 977
  • 10
  • 18