Save changes in FileDocument

Hi Team, I am using overlay pdf java action and I am getting 1 blank page at the end unnecessary , to avoid this I have written 1 java action to remove last page , now one last thing i have to add to save changes in file document I have checked syntax i need to pass input stream as parameter  how to use this syntax here in my code as i am not using any input stream  Any help will be appreciated.
1 answers

I think something like this should work…

ByteArrayOutputStream outStream = new ByteArrayOutputStream();;
ByteArrayInputStream inStream = new ByteArrayInputStream( outStream.toByteArray());
Core.storeFileDocumentContent(getContext(), this.inputFile.getMendixObject(), inStream);

You can use the ByteArrayOutputStream to save your modified inputDoc. You then need to convert this into a ByteArrayInputStream that you can pass to Core.storeFileDocumentContent.

You’ll want to add this after your call to inputDoc.removePage and before you return true;

Double check I have used the correct variable names as I can’t see them very clearly in the screenshot, but I think they are right.

Hope this helps and good luck!​​​​​​