Trying to run Aspose Eps to convert a PS to PDF in AWS lambda
where the files are running on a read-only directory named /var/task
and the only writable folder is /tmp
This is the exception:
Input file:/tmp/input.eps
17:32:58
Output file:/tmp/9dcc8423-3eb6-4592-965b-9954b2f833c4.pdf
17:32:58
java.lang.RuntimeException: java.io.FileNotFoundException: /var/task (Is a directory) at com.aspose.eps.internal.ll.Il.lI(Unknown Source) at com.aspose.eps.internal.ll.Il.lif(Unknown Source) at com.aspose.eps.internal.ll.Il.l0I(Unknown Source) at com.aspose.eps.AbstractPsConverter.lif(Unknown Source) at com.aspose.eps.Ps2PdfConverter.lif(Unknown Source) at com.aspose.eps.Ps2PdfConverter.conv
java.lang.RuntimeException: java.io.FileNotFoundException: /var/task (Is a directory)
at com.aspose.eps.internal.ll.Il.lI(Unknown Source)
at com.aspose.eps.internal.ll.Il.lif(Unknown Source)
at com.aspose.eps.internal.ll.Il.l0I(Unknown Source)
at com.aspose.eps.AbstractPsConverter.lif(Unknown Source)
at com.aspose.eps.Ps2PdfConverter.lif(Unknown Source)
at com.aspose.eps.Ps2PdfConverter.convertToPdf(Unknown Source)
at com.csdisco.postscriptprocess.ConvertToPdfHandler.convert(ConvertToPdfHandler.java:44)
at com.csdisco.postscriptprocess.Handler.handleRequest(Handler.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at lambdainternal.EventHandlerLoader$PojoMethodRequestHandler.handleRequest(EventHandlerLoader.java:259)
at lambdainternal.EventHandlerLoader$PojoHandlerAsStreamHandler.handleRequest(EventHandlerLoader.java:178)
at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:888)
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:293)
at lambdainternal.AWSLambda.<clinit>(AWSLambda.java:64)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:114)
Caused by: java.io.FileNotFoundException: /var/task (Is a directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:130)
at com.aspose.eps.internal.l421.II.lif(Unknown Source)
at com.aspose.eps.internal.l0l.I11.l0iF(Unknown Source)
The code is from your sample:
System.out.println("Input file:"+ fileName);
System.out.println("Output file:"+ tempFileName);
FileInputStream psStream = new FileInputStream(fileName);
FileOutputStream pdfStream = new FileOutputStream( tempFileName);
// If you want to convert Postscript file despite of minor errors set this flag
Boolean suppressErrors = true;
Ps2PdfConverterOptions options = new Ps2PdfConverterOptions(psStream, pdfStream, suppressErrors);
// Set page size
options.setPageSize(new Dimension(595, 842));
// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
//options.setFontsFolders(new String[] { "{FONT_FOLDER}" });
try
{
Ps2PdfConverter converter = new Ps2PdfConverter();
converter.convertToPdf(options);
}
finally
{
psStream.close();
pdfStream.close();
}
//Review errors
if (suppressErrors)
{
for (PsConverterException ex : options.getExceptions()) {
System.out.println(ex.getMessage());
}
}
Also using your input sample file in the resources folder of GitHub Repository: