Skip to main content
Known Participant
May 4, 2021
Question

Accessing local file contents from JSX

  • May 4, 2021
  • 0 replies
  • 143 views

Hi all,

From my panel (IDSN) I am generating a PDF file which I need to upload to a file service, however I am having issues reading the file from both JS and JSX.

The code below will excute just fine when being run from within InDesign but not from the panel – I get an this error "EvalScript error".

var theFile = File(path);
var fileString;
if (theFile.open('r')) {
	try {
		fileString = theFile.read();
	} catch (err) {
		console.log("Error\r" + err);
	} finally {
		theFile.close();
	}
} else {
	console.log("Error\rFile could not be opened.");
}
return fileString;

 

Does anybody know to acecss local files for submission?

    This topic has been closed for replies.