Dear Aspose.PSD developers,
I am having an issue with processing PSD files in my project. The files are created on the frontend using the ag-psd library, then uploaded to a backend service where they are loaded using Aspose.PSD for Java.
However, when I try to load the uploaded file using Aspose.PSD, it throws an exception with the following error message:
com.aspose.psd.internal.Exceptions.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: startPosition
This is the code I use on the frontend:
const files = event.target.files;
if (files.length > 0) {
const file = files[0];
const arrayBuffer = await file.arrayBuffer();
const psd = readPsd(arrayBuffer);
const imageData = writePsd(readPsd(arrayBuffer));
const blob = new Blob([imageData], { type: 'application/octet-stream' });
let formData = new FormData();
formData.append('psd_file', blob, file.name);
try {
const response = await fetch('http://localhost:24568/psd_template', {
method: 'POST',
body: formData
});
if (response.ok) {
console.log('Upload successful');
console.log(response);
} else {
console.error('Upload failed with HTTP status', response.status);
}
} catch (error) {
console.error('Upload failed with error', error);
}
}
And this is the code on the backend with aspose.psd:
PsdImage image = (PsdImage) Image.load(saveFile.getPath());
Could you please advise me on whether there’s a way to ignore this error, work around it, or otherwise fix the problem?
I’m not sure if the problem lies with ag-psd or aspose.psd. Do you have any thoughts on this issue? I will relay the responses from ag-psd here in real time.
output.zip (9.3 MB)
The psd file for this case
Looking forward to your guidance.
Best regards.