You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
I'm using the high level API with the latest version of ghost4j (built from Latest commit 52cd8f2 on 5 May 2016) to convert pdfs to postscript
The documentation says the high level API is thread safe.
But this does not seems the case.
Here is my code:
/**
* Convert a pdf file to postscript.
* Note: Ghostscript must be installed on the system.
* @param pdfInputStream The pdf input stream.
* @param psOutputStream The postcript output stream.
* @throws Exception
*/
public static void convertPdfToPostscript(InputStream pdfInputStream, OutputStream psOutputStream) throws Exception {
try {
PDFDocument document = new PDFDocument();
document.load(pdfInputStream);
PSConverter converter = new PSConverter();
converter.setMaxProcessCount(0);
converter.setDevice(PSConverter.OPTION_DEVICE_PS2WRITE);
converter.convert(document, psOutputStream);
} catch (Exception e) {
throw new Exception("Could not convert pdf to postscript", e);
}
}
But I still get an 'Invalid memory access' error when calling it from 2 threads at the same time:
java.lang.Error: Invalid memory access
at com.sun.jna.Native.invokeInt(Native Method)
at com.sun.jna.Function.invoke(Function.java:383)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.sun.proxy.$Proxy202.gsapi_init_with_args(Unknown Source)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:350)
at org.ghost4j.converter.PSConverter.run(PSConverter.java:142)
at org.ghost4j.converter.AbstractRemoteConverter.convert(AbstractRemoteConverter.java:85)
at com.real.aof.helper.PdfHelper.convertPdfToPostscript(PdfHelper.java:2573)
The text was updated successfully, but these errors were encountered:
I'm using the high level API with the latest version of ghost4j (built from Latest commit 52cd8f2 on 5 May 2016) to convert pdfs to postscript
The documentation says the high level API is thread safe.
But this does not seems the case.
Here is my code:
But I still get an 'Invalid memory access' error when calling it from 2 threads at the same time:
java.lang.Error: Invalid memory access
at com.sun.jna.Native.invokeInt(Native Method)
at com.sun.jna.Function.invoke(Function.java:383)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.sun.proxy.$Proxy202.gsapi_init_with_args(Unknown Source)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:350)
at org.ghost4j.converter.PSConverter.run(PSConverter.java:142)
at org.ghost4j.converter.AbstractRemoteConverter.convert(AbstractRemoteConverter.java:85)
at com.real.aof.helper.PdfHelper.convertPdfToPostscript(PdfHelper.java:2573)
The text was updated successfully, but these errors were encountered: