cancel
Showing results for 
Search instead for 
Did you mean: 

Generate a new version of contract document as PDF

Former Member
0 Kudos

Hi Experts,

We are trying to generate automatically a new version of a contract document, but this new version must be in PDF format. The script needs to identify the last version of this contract document and convert it in a PDF file, adding this new file (PDF) as new version.

We found a JAVA method to generate a PDF file using a DOCX file, but don’t know what to do to make this process work completely in CLM.

Appreciate any help on this.

Thanks,

Adilson

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi  Adilson,

You can follow the link below to get the file attachment from CLM:

http://scn.sap.com/message/13834923#13834923

Once you have the file attachement as java.io.File, use the java method that you found to convert it into pdf format.

Now create an attachment using TypeFactory

TypeFactory.createAttachment();

This creates an empty attachment. Set data to this attachment using the following method:

setFileData(java.lang.String aDisplayName, java.io.InputStream aBytes, ParentObjectReferenceIfc parentRef, IapiSessionContextIfc session)

The second parameter in the above method is obtained by opening an inputstream on the pdf file generated.

Since you want to add the pdf file as a new version, add it using this method:

setDoc(AttachmentIfc value)   // method on DocumentVersionIBeanIfc

Hope this helps.

-

Bindu

Former Member
0 Kudos

Hi Bindu,

we are trying the same procedure right now.

Do you - or some other readers - have information about the standard method in SAP Sourcing to convert word files to PDF?

We don't want to deploy new jar files and want to use existing libraries.

Regards,

Özlem