PDF File issues with ASPOSE

This is to follow up with you on the issue we are facing while using "http://api.aspose.com/v1.1/words/ fileName?format=pdf" to convert the doc file in pdf.

Issue Description-
After getting the response from service we are saving the response body as Blob in Attachment object on Salesforce Platform. When we are opening the saved attachment, a PDF window opens up without contents and its shows loading message for infinite time.

Can you please provide a sample where we can read the pdf content in the form of Blob from the service call.

Thanks
Shital

Hi Shital,


Thanks for your inquiry. Could you please attach your input Word document and output PDF file showing the undesired behavior here for testing? We will investigate the issue on our end and provide you more information. Also, are you getting this problem with one particular document or every document you try to convert to PDF format cause the same issue?

Best regards,

Thanks Awais,

I have attached the Docx file which resides on the Aspose cloud server and the converted Pdf file which is received from calling the api http://api.aspose.com/v1.1/words/SignInSheetDataSource_Sample-Merged.docx?format=Pdf&appSID=45935a38-ef19-47d8-a5b9-d564c95c6d76&signature=RKftTgIoSvDWZY4DNU9DO8j11FE.

When we copy paste the above url in the browser it displays the correct pdf and can be save/downloaded from browser and works fine.

We are facing problem when calling this api from the code at Salesforce cloud plateform and extracting the blob from the response and save to the Attachment object. Then when I want to see the PDF from the Attachment object, it does not loads the content.

Following is the code snippet in Salesforce plateform :

To Download PDF file :

String fileName = ‘SignInSheetDataSource_Sample-Merged.docx’;

String strURI = Aspose.BaseProductUri + ‘/words/’ + fileName + ‘?format=Pdf’;

String signedURI = AsposeUtils.Sign(strURI);

system.debug(‘strURI===> ‘+strURI);

Blob fileContent= AsposeUtils.ProcessCommand(signedURI, ‘GET’, ‘json’)

//Create the Attachment object :

Attachment att = new Attachment();

att.Body = mergedFileBlob;

att.ParentId = doc.Id;

att.ContentType = ‘pdf’;

att.Name = fileName;

insert att;

//Definition of ProcessCommand method

public static Blob ProcessCommand(String strURI, String strHttpCommand, String ContentType) {

try {

HttpRequest request = new HttpRequest();

Integer len = 0;

request.setEndpoint(strURI);

request.setMethod(strHttpCommand);

if (ContentType.toLowerCase() == ‘xml’){

request.setHeader(‘Content-Type’, ‘application/xml’);

}else if (ContentType.toLowerCase() == ‘json’){

request.setHeader(‘Content-Type’, ‘application/json’);

}else{

request.setHeader(‘Content-Type’, ‘MultiPart/Form-Data’);

}

request.setHeader(‘Content-Length’, String.valueOf(len));

request.setHeader(‘Accept’, ‘application/json’);

request.setTimeout(99999);

if(TEST.isRunningTest() ){

return Blob.valueOf(‘This is for Test’);

} else{

Http http = new Http();

HttpResponse res = http.send(request);

system.debug(’### Download file res :’+res.getBody());

return res.getBodyAsBlob();

}

} catch (Exception ex) {

system.debug(‘HTTP ERROR’ + ex.getMessage());

throw new DataSourceException('ASPOSE Service Exception : '+ex);

return null;

}

}

Hi Shital,


Thanks for your inquiry. I am afraid, we’re unable to reproduce this issue on our end using latest version of Aspose.Words for Cloud. Please try again and see if the issue is resolved on your end as well.

Best regards,