Hi,
I Aspose version v4.0 We are trying to generate merge document
Input : word doc
output: PDF
Endpoint: https://api.aspose.cloud
Version : https://api.aspose.cloud/v4.0
Access token: https://api.aspose.cloud/connect/token
When tried to generate merge document extra table tag like <> <<>are generated which is not happening in version1.1
Attaching both pdfs for reference.
v1.1 0055225 Generic Interaction Merge Template-1 (1)(1)-Merged.PDF (946.8 KB)
V4_0055225 Generic Interaction Merge Template-1 (1)(1)-Merged.PDF (947.0 KB)
You can refer sample code below:
public String executeTemplateMerge(String FileName, String dataFile) {
String DocName, httpRequestMethod;
try {
if(asposeVersion1_1){
strURI = Aspose.BaseProductUri + ‘/words/’ + FileName + ‘/executeTemplate?cleanup=ContainingFields,EmptyParagraphs,UnusedFields,UnusedRegions,RemoveTitleRow,RemoveTitleRowInInnerTables’;
signedURI = AsposeUtils.Sign(strURI);
httpRequestMethod = ‘POST’;
}else{
FileName = FileName.replace(’ ', ‘%20’);
signedURI = Aspose.BaseProductUri + ‘/words/’ + FileName + ‘/MailMerge?withRegions=True&cleanup=UnusedFields&useWholeParagraphAsRegion=False&destFileName=merge_’+FileName;
accessToken = GetJWT();
httpRequestMethod = ‘PUT’;
}
String strJSON = AsposeUtils.ProcessCommand(signedURI, httpRequestMethod, dataFile, ‘json’, accessToken);
//String downloadURL = null;
Map<String, Object> params = (Map<String, Object>) JSON.deserializeUntyped(strJSON);
if(params.containsKey(‘Document’)){
Map<String, Object> doc = (Map<String, Object>) params.get(‘Document’);
DocName = (String) doc.get(‘FileName’);
}
return DocName;
}
catch (Exception ex) {
system.debug('ASPOSE Merge Service Exception : '+ex);
throw new DataSourceException('ASPOSE Merge Service Exception : '+ex);
}
}
////////////////////////
public with sharing class AsposeUtils {
public static String ProcessCommand(String strURI, String strHttpCommand, String strContent, String ContentType, String accessToken) {
try {
HttpRequest request = new HttpRequest();
Integer len = 0;
if (strContent != null && strContent != ‘’) {
request.setBody(strContent);
len = strContent.length();
}
commonApiExecution(strURI,strHttpCommand,contentType,request,accessToken,len);
if(TEST.isRunningTest() ){
return AhmConstants.ASPOSE_MOCK_RESPONSE_MERGE_CALL;
} else{
Http http = new Http();
HttpResponse res = http.send(request);
return res.getBody();
}
} catch (Exception ex) {
throw new DataSourceException('ASPOSE Service Exception : '+ex);
return null;
}
}
}
Thanks in advance.