Skip to Content
author's profile photo Former Member
Former Member

How to convert the CLM Contract word Doc into PDF doc


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?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2014 at 04:03 PM

    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!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.