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.
But it does not work with ghost4j. I get an Invalid memory access exception:
Exception in thread "main" 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.$Proxy0.gsapi_exit(Unknown Source)
at org.ghost4j.Ghostscript.exit(Ghostscript.java:555)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:359)
at org.ghost4j.converter.PDFConverter.run(PDFConverter.java:238)
at org.ghost4j.converter.AbstractRemoteConverter.convert(AbstractRemoteConverter.java:85)
Test code:
public static void main(String[] args) throws Exception {
try {
String input = "C:\\postscript\\pjl.ps";
PSDocument document = new PSDocument();
document.load(new ByteArrayInputStream(Files.readAllBytes(Paths.get(input))));
PDFConverter converter = new PDFConverter();
converter.convert(document, new ByteArrayOutputStream());
} catch (Exception e) {
throw new Exception("Could not convert postscript to pdf", e);
}
}
Without the PJL commands it works fine.
I attached the problematic file: pjl.txt (rename extension to .ps as github does not support .ps attachments).
I also attached the file that works: no-pjl.txt
I have a ps file that contains PJL commands.
If I convert it to pdf with the command line (Ghostcript 9.20 on Windows10 64 bits) it works correctly:
gswin64c -dNOPAUSE -dBATCH -dSAFER -dProcessColorModel=/DeviceRGB -dPDFSETTINGS=/default -dCompatibilityLevel=1.4 -dPDFX=false -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=792 -sDEVICE=pdfwrite -sOutputFile=pjl.pdf -q -f pjl.ps
But it does not work with ghost4j. I get an Invalid memory access exception:
Exception in thread "main" 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.$Proxy0.gsapi_exit(Unknown Source)
at org.ghost4j.Ghostscript.exit(Ghostscript.java:555)
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:359)
at org.ghost4j.converter.PDFConverter.run(PDFConverter.java:238)
at org.ghost4j.converter.AbstractRemoteConverter.convert(AbstractRemoteConverter.java:85)
Test code:
Without the PJL commands it works fine.
I attached the problematic file: pjl.txt (rename extension to .ps as github does not support .ps attachments).
I also attached the file that works: no-pjl.txt
no-pjl.txt
pjl.txt
The text was updated successfully, but these errors were encountered: