We have written a custom workflow step. It has the following code. The idea is to set a Document variable to the value of a file from the filesystem.
Path filePath = Paths.get(path);
com.adobe.aemfd.docmanager.Document doc = new com.adobe.aemfd.docmanager.Document(Files.readAllBytes(filePath));
wfd.getMetaDataMap().put(documentVariableName, doc);
This succeeds however, we we attempt to use the Document variable, we get the error "Document is in a disposed state!".
How do I properly set a Document variable with the contents of a file on the filesystem?
Thanks,
Solved! Go to Solution.
Views
Replies
Total Likes
@Mayank_Tiwari I logged a support case and it was reported that this is a known bug. My case number is 000538536 - check with Manish Pandey if interested.
Can you try the following code. This has been used in this sample code as well.
import java.io.File;
import com.adobe.aemfd.docmanager.Document;
String inputFile = "<path to a pdf document stored at disk>"
File inFile = new File(inputFile);
Document inDoc = new Document(inFile);
This did not work. Same error . . . shall I open a bug?
This should work. not sure why it is not working for you.
As an alternative can you try with this:
byte[] bytes = <create byte[] from file> Document inDoc = new Document(bytes);
@Mayank_Tiwari I logged a support case and it was reported that this is a known bug. My case number is 000538536 - check with Manish Pandey if interested.
Views
Likes
Replies