Editing a file
// Get the byte array from the parameter page
byte[] byteArray=(byte[])tools.getParameterPage().getParameterValue("PDFDocument");
String fileName = (String) tools.getParameterPage().getParameterValue("FileName");
// create custom HTTP headers
HashStringMap aMap = new HashStringMap();
// If the file type is Excel/PowerPoint/Word, then force user to download it. Otherwise, display the document inline
if(fileName.indexOf(".xls") != -1 || fileName.indexOf(".xlsx") != -1 || fileName.indexOf(".xlsm") != -1 || fileName.indexOf(".xlsb") != -1 || fileName.indexOf(".ppt") != -1 || fileName.indexOf(".pptx") != -1 || fileName.indexOf(".pptm") != -1 || fileName.indexOf(".doc") != -1 || fileName.indexOf(".docx") != -1 || fileName.indexOf(".docm") != -1|| fileName.indexOf(".msg") != -1|| fileName.indexOf(".ics") != -1)
{
aMap.put("ContentDisposition", "attachment;filename=\"" + fileName+ "\"");
}
else
{
aMap.put("ContentDisposition", "inline;filename=\"" + fileName+ "\"");
}
aMap.put("ContentType", "application/force-download");
aMap.put("ContentType", "application/octet-stream");
aMap.put("ContentType", "application/download");
// Send the PDF File back to the user.
String result=tools.sendFile(byteArray, fileName, false, null, true);
***Edited by Moderator: Lochan to update platform capability tags and tag as Developer Knowledge Share***