We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problems using Save method

Hi there,
we have an issue which might be hard to reproduce, but i hope, this can be anyhow be fixed somehow :slight_smile:
During the Save method (using a String to set the Filename) it seems, that a Folder is being created with the same name of the target File, which is then deleted again, befor the correct File is being saved.
In our Filesystem which is very special, this is a Problem, as the deletion of Folders is not allowed, but the creation. This leads to an error when aspose tries to save the real PDF file.
Cheers Rob

@tmdolphin

Thanks for contacting support.

Would you please share some more details regarding your environment and file system along with the API version, which you are using and application type. We will try to reproduce it in our environment and share our findings with you accordingly.

Hi and thanks for you prompt answer,
our System uses a custom Filesystem (Linux, based on fuseFS). I guess reproducing could be hard, if helpful, i could sent you the StackTrace of the Excpection we get. based on the Tracing functionality of our FileSystem i could describe the issue as above.
greetings!

@tmdolphin

Thanks for writing back.

We will really appreciate if you can share StackTrace of the exception, you are getting and also some details of the routine, you are performing for PDF generation, by sharing sample code snippet. This would really help us in investigating the scenario and address it accordingly.

Hi There and thanks for the answer,
here we go with some StackTrace. “(Is a directory)” was the message, that lead us to check our FileSystem Logs in more detail.

greetings Rob

SEVERE: Unexpected Error
com.aspose.pdf.internal.ms.System.IO.FileNotFoundException: File not found File: /var/swan/root/bhc/general/tools/mosto/mosto6/val/s
upport/out_temp2.pdf
File name: '/var/swan/root/bhc/general/tools/mosto/mosto6/val/support/out_temp2.pdf' ---> /var/swan/root/bhc/general/tools/mosto/mos
to6/val/support/out_temp2.pdf (Is a directory)
com.aspose.pdf.internal.p810.z3.<init>(Unknown Source)
com.aspose.pdf.internal.p810.z3.<init>(Unknown Source)
com.aspose.pdf.internal.p810.z3.<init>(Unknown Source)
com.aspose.pdf.internal.p652.z28.<init>(Unknown Source)
com.aspose.pdf.internal.p652.z28.<init>(Unknown Source)
com.aspose.pdf.internal.p652.z28.<init>(Unknown Source)
com.aspose.pdf.ADocument.save(Unknown Source)
com.aspose.pdf.Document.save(Unknown Source)
com.bayer.mosto.cli.MostoPDFProcessing.makeToc(MostoPDFProcessing.java:416)
com.bayer.mosto.cli.MostoPDFProcessing.addTocAndPageXofY(MostoPDFProcessing.java:450)
com.bayer.mosto.cli.MostoPDFProcessing.main(MostoPDFProcessing.java:123)
	at com.aspose.pdf.internal.p810.z3.<init>(Unknown Source)
	at com.aspose.pdf.internal.p810.z3.<init>(Unknown Source)
	at com.aspose.pdf.internal.p810.z3.<init>(Unknown Source)
	at com.aspose.pdf.internal.p652.z28.<init>(Unknown Source)
	at com.aspose.pdf.internal.p652.z28.<init>(Unknown Source)
	at com.aspose.pdf.internal.p652.z28.<init>(Unknown Source)
	at com.aspose.pdf.ADocument.save(Unknown Source)
	at com.aspose.pdf.Document.save(Unknown Source)
	at com.bayer.mosto.cli.MostoPDFProcessing.makeToc(MostoPDFProcessing.java:416)
	at com.bayer.mosto.cli.MostoPDFProcessing.addTocAndPageXofY(MostoPDFProcessing.java:450)
	at com.bayer.mosto.cli.MostoPDFProcessing.main(MostoPDFProcessing.java:123)
Caused by: java.io.FileNotFoundException: /var/swan/root/bhc/general/tools/mosto/mosto6/val/support/out_temp2.pdf (Is a directory)
	at java.io.RandomAccessFile.open(Native Method)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:241)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:122)
	... 11 more

@tmdolphin

Thanks for sharing the StackTrace of the exception.

However, as requested earlier, would you please share a sample code snippet which you are using to generate PDF in your application. We will try to replicate the issue, by using that code snippet in our environment and share our findings with you.

Hi There,
sorry for the late response!
basically we used the “common” way to save a PDF again. With the example method here we just put the “Fast Web View” Feature on an existing PDF File using Aspose!

here we go:

    public static void enableFastWebView(String anInFile, String anOutFile)
{
  System.out.println("- endMostoPDF : Java processing - create Fast Web View option");
	//open document
	Document pdfDocument = new Document(anInFile);
	// Enable fast web view option
	pdfDocument.optimize();
	// save document
	pdfDocument.save(anOutFile);
    }

cheers Rob

@tmdolphin

Thanks for sharing the sample code snippet.

Please share the values of parameters which are being used originally to save the file. It will help us to understand the path structure at your side and test the scenario accordingly.