问题
The new version of Ghostscript (9.07) has a threading support (can be thread-safe), but it says that the code must be compiled with a special flag to enable this.
How do I do this? Or where can I get already built thread-safe version?
I tried to download the source, opened in VS, but it failed to build. So maybe somebody has already done this and could share the DLL.
回答1:
Are you interested in the thread safe version of Ghostscript, or multiple rendering threads?
Multiple rendering threads are only of use if you are producing high resolution output, since the code must first interpret the PostScript program (or PDF file) and create a display list for the rendering threads to operate on. Unless you are rendering to a reasonably high resolution, this will actually be slower than using page mode (whole page rendered in memory)
You can create multiple rendering threads in the pre-built version of Ghostscript using the -dNumRenderingThreads switch.
If you want a thread-safe version of Ghostscript then you will need to be able to compile Ghostscript yourself. What version of Visual Studio are you using ? I am using Visual Studio 2005 and 2008 and the supplied solution works for me (after appropriate conversion).
回答2:
I was looking for solution for this problem as well and eventually I solved it in Linux. Maybe it will help someone who comes here looking for solution. Open terminal in sources directory and type this command:
./configure --enable-threadsafe
After that you can do make
or make so
for lib.
Here is link to docs for building ghostscript from sources: https://www.ghostscript.com/doc/9.23/Make.htm#Makefile_overview.
回答3:
Take a look at Ghostscript.NET managed Ghostscript wrapper which allows you to run multiple instances of Ghostscript library at a same time if you have a need to process multiple pdf's at a same time.
来源:https://stackoverflow.com/questions/15079448/where-to-get-a-thread-safe-ghostscript-compilation