Friday, February 8, 2013

PDF Generation for Teamcenter Workflow

The requirement is to generate a PDF containing the approval details and approver details after completion of each task in a workflow. 

Solution Approach:


1. Write an action handler and attach it to complete status of the task so that   after completion of that particular task, action handler DLL should be called.


2. Write ITK APIs to get the information of approval and approver.

    For E.g. 
                ifail = CR_ask_decision(job_tag,task_name,current_user_tag[ctr-1],&decision,comments,&last_mod_date);

3. Call C# DLL from the action handler and pass the attributes containing the information required to C# DLL.

    Click here to know:  How to call C# DLL from C++ DLL

4. In C# DLL, using COM APIs open your existing word document containing pre-defined form fields.


5. Using COM APIs insert values into word document and export it as PDF using, 


my_document.ExportAsFixedFormat(fnames, WdExportFormat.wdExportFormatPDF, false, WdExportOptimizeFor.wdExportOptimizeForOnScreen, WdExportRange.wdExportAllDocument, 1, 1, WdExportItem.wdExportDocumentContent, true, true, WdExportCreateBookmarks.wdExportCreateHeadingBookmarks, true, true, false, ref oMissing);


6. Attach the generated PDF as named reference to the dataset of current item revision.

No comments:

Post a Comment