Question

SendFile API is not Working for Excel and PDF Formats

Hi,

We have a requirement, we get base 64 code of a Document from a service. based on the Filename we can identify the format of the File(Doc,xls,pdf).But when we use the Send file APi in a activity it works for Doc file but not for Excel and Pdf documents

Below is the code we used.

String rawres = (String) tools.getParameterPage().getParameterValue("DocumentContent");

String fileName = (String) tools.getParameterPage().getParameterValue("FileName");

byte[] byteArray=Base64Util.decodeToByteArray(rawres);

HashStringMap aMap = new HashStringMap();

aMap.put("ContentDisposition", "attachment;filename=\"" + fileName+ "\"");

aMap.put("ContentType", "application/force-download");

aMap.put("ContentType", "application/octet-stream");

aMap.put("ContentType", "application/download");

aMap.put( "contentType" ,"application/vnd.ms-excel");

String sErrorMessage = tools.sendFile( byteArray,fileName, false, aMap, true );

And also I tired by passing the Response page as a step page

String sErrorMessage = tools.sendFile(myStepPage, "FileSource", true, null, strFileName, false, null, true);

Appreciate you help.

***Edited by Moderator: Lochan to update platform capability tags***

Comments

Keep up to date on this post and subscribe to comments

Pega
September 3, 2019 - 2:42am