Skip to main content
1-Visitor
April 20, 2010
Question

Adding PDF As Secondary Content

  • April 20, 2010
  • 10 replies
  • 2056 views

I'm using the below workflow code to publish a drawing which gets associated as a product view representation. The representation is a pdf that's wrapped within the product view format. How can I get (or convert) the pvc file to a pdf so that I can programmatic added it as secondary content.

Thanks

String objRef = wt.fc.ObjectReference.newObjectReference(primaryBusinessObject).toString();
String lifecyclestate = ((wt.lifecycle.LifeCycleManaged) primaryBusinessObject).getState().toString();
String name =((wt.enterprise.RevisionControlled) primaryBusinessObject).getName() + "-" + lifecyclestate;
com.ptc.wvs.common.ui.Publisher pub = new com.ptc.wvs.common.ui.Publisher();
boolean sucess = pub.doPublish(false, true, objRef, (wt.vc.config.ConfigSpec)null, (wt.vc.config.ConfigSpec)null, true, name, name, com.ptc.wvs.common.ui.Publisher.EPM, null, 0);

if (sucess) {
String link = pub.getViewableLink();
System.out.println("---- Link --- " + link);


String repObjRef = pub.getViewableObjRef();
System.out.println(" ---- Ref Obj --- " + repObjRef );

}



10 replies

cperren1-VisitorAuthor
1-Visitor
April 20, 2010

It appears that the Windchill representations are wrapped into the product view format. Basically to open a PDF representation, I have to use product view which prevent us from programmatically adding it to the drawing as secondary PDF content and opening it using other tools such Adobe Acrobat. Any help would be great! - Thanks


3-Newcomer
April 21, 2010
Fishbowl Solutions has a product that will attach a PDF as secondary content, for additional information take a look at the following web page:

1-Visitor
April 21, 2010
Chris,

We have a solution for this that we can show you anytime. We will also be showing this at PTCUser in booth 501.

Regards,


Timothy J. Weatherford

TWeatherford, Inc.

3148 Beach Blvd

Cicero, IN 46034

www.tweatherford.com



866 936-2756 x 301

317 710 9747 mbl

419 821-5765 fax

Read our latest newsletter by clicking here

"If you continue to ignore PLM, you will learn about it from your biggest competitor"
1-Visitor
April 21, 2010
Hi

One can follow the following steps making used of OOTB Windchill
capabilities for meeting the requirement

1. configure CAD Worker (ProE WF 3 M110 onwards) for generating the
viewable as PDF.

2. Listen for Publish Successful event for DRW objects

3. Retrieve the PDF viewable and attach as the secondary content.



If you want to take this approach and need some specific clarifications,
please let me know.



Thank you and have a great time.

Best Regards

Swamy Senthil

973 216 0456(M)

866 908 6561(F)

Principal Solutions Architect

Swasen Inc

www.swasen.com
cperren1-VisitorAuthor
1-Visitor
April 21, 2010
Swamy,



Thanks for the help. I'm interested in your suggestions although the
challenge is retrieving the PDF which appears to wrapped inside the product
view file format. I have a object reference to the representation. How do
I retrieve a PDF file from this representation?



Thanks





String objRef =
wt.fc.ObjectReference.newObjectReference(primaryBusinessObject).toString();

String lifecyclestate = ((wt.lifecycle.LifeCycleManaged)
primaryBusinessObject).getState().toString();
String name =((wt.enterprise.RevisionControlled)
primaryBusinessObject).getName() + "-" + lifecyclestate;
com.ptc.wvs.common.ui.Publisher pub = new
com.ptc.wvs.common.ui.Publisher();
boolean sucess = pub.doPublish(false, true, objRef,
(wt.vc.config.ConfigSpec)null, (wt.vc.config.ConfigSpec)null, true, name,
name, com.ptc.wvs.common.ui.Publisher.EPM, null, 0);

if (sucess) {
String link = pub.getViewableLink();
System.out.println("---- Link --- " + link);


String repObjRef = pub.getViewableObjRef();
System.out.println(" ---- Ref Obj --- " + repObjRef );

}











Chris Perren

Round Rock Software

Office (512) 850-6929

Mobile (512) 415-6951


1-Visitor
April 21, 2010
Hi Chris

Please find the following snippet of the code



//Get Representation

Representation myRepresentation =
RepresentationHelper.service.getDefaultRepresentation((Representable)wto);

Representation myRep =
(Representation)ContentHelper.service.getContents(myRep);

Vector vector = ContentHelper.getContentList(myRep);

ApplicationData plotApplicationData = null;

for(int i = 0; i < vector.size(); i++) {

ContentItem contentitem = (ContentItem)vector.elementAt(i);

if(ci instanceof ApplicationData) {

plotApplicationData = (ApplicationData)

if (plotApplicationData != null) break;

}

}

Return plotApplicationData;



If you configure cad worker to generate pdf as viewable, then the
plotApplicationData is a pdf file. If you don't have default representation,
then you may need to query for representations.

I am sharing the corresponding APIs out of professional courtesy so that you
need not spend time in locating APIs. The good thing about Windchill :- one
can get the info in many different ways and this the way I realized. You may
need to tweak the APIs as well as include appropriate imports, try & catch
blocks, instance of null checks where ever appropriate. I would recommend
that we can have further discussions offline.



Thank you and have a great time.

Best Regards

Swamy Senthil

973 216 0456(M)

866 908 6561(F)

Swasen Inc

www.swasen.com
1-Visitor
April 21, 2010
Beat me to it. thanks for sharing the details.


1-Visitor
April 22, 2010

Chris,

If your goal to be able to save the PDF from Windchill we are doing this by using Save Representation from the Actions menuon the listed Representation in the General/Representations detail page.

1-Visitor
April 23, 2010
Why would you place the PDF as secondary content. I would place it in the Markup and use the OOTB document converted to dump it into the markup object. As a result, you can still use ACLs to stop download of source content and get the PDF from WVS. Plus, you can add annotations and markups. Just wish the annotations and markups behaved like MS Word markup functionality.
1-Visitor
April 23, 2010
I agree with Patrick.

However if you still need to convert Representation to Secondary content I
have contributed the solution to Ez Collab team (