cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert the CLM Contract word Doc into PDF doc

Former Member
0 Kudos


I have one question, How to convert the CLM Contract word Doc into PDF doc?

we config. one toolbar script, and insert some script logic as below, but still can not get the result and popup error

import com.sap.eso.api.doccommon.doc.contract.ContractDocumentIBeanIfc;
import com.sap.eso.api.doccommon.doc.contract.ContractDocumentIBeanImpl;
import com.sap.eso.api.doccommon.doc.contract.DocumentVersionIBeanIfc;
import com.sap.eso.api.doccommon.doc.contract.*;
import com.sap.odp.common.types.Attachment;
import java.io.FileInputStream;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import com.sap.odp.api.common.types.TypeFactory;
import java.lang.reflect.Method;

ApplicationException ae = new ApplicationException(session);

CollectionIfc coll = doc.getContractDocuments();

//最新附件排序号
int token = 0;
long timeCurr = 0;

if(null!=coll){
     
      for(int j = 0; j < coll.size(); j++){
          beanCurr = (ContractDocumentIBeanImpl) coll.get(j);
          if (beanCurr.getModifiedAt()!=null && beanCurr.getCreatedAt().getTime()>0){
              timeCurr = beanCurr.getModifiedAt().getTime();
          }else{
             timeCurr = beanCurr.getCreatedAt().getTime();
          }
          token = j;
          time = timeCurr;
       }
}
ContractDocumentIBeanImpl bean = (ContractDocumentIBeanImpl) coll.get(token);

AssociativeCollectionIfc colli = bean.getDocVersions();

for (int z = 0; z < colli.size(); z++) {
DocumentVersionIBeanImpl a = (DocumentVersionIBeanImpl) colli.get(z);
AttachmentIfc docc = a.getDoc();

//获取CLM的文件变量
File file = docc.getFileData(session);

//创建typefactory类型
AttachmentIfc newAttachment= TypeFactory.createAttachment();

InputStream inputStream = new FileInputStream(file);

ParentObjectReferenceIfc parentRef = TypeFactory.createParentObjectReference(doc);

newAttachment.setFileData("abc.pdf",inputStream, parentRef,session);

//将生成的pdf文档设置到合同文档中
//a.setDoc(docc);
a.setDoc(newAttachment);

}

So I want to know is it possible to convert Doc into PDF?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Is it possible to run 3rd party .exe programe to get PDF, and assign this pdf to CLM Contract Attachement box? Or call web service to convert?

Pls advise! Tks!