cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Watermark rev of wt.part on the published drawing

Dmi3U
15-Moonstone

Watermark rev of wt.part on the published drawing

I am hoping somebody already figured it out, and it is not a costly customization...

34 REPLIES 34
cadjett
1-Visitor
(To:Dmi3U)

Wow, I wasnt aware of storeDrawingRepresentation & doDrawingRepresentation.

I will certainly look into those 2 methods & how to intercept the doDrawingRepresentation.

I will look at the code you attached & reread your comments on which does what & when & go from there. I am sure you detailed it well, but If I miss the full path, I will ask for detail in the area I am missing.

But thats is some good research you have done & thats why we come to ptcuser.org.

I really appreciate the help.

Thanks
L Jett

cadjett
1-Visitor
(To:Dmi3U)

Thanks to Rochan, I finally, finally got watermarking working for default representation (or any rep). I took your CustomCadConvert.java & just adjusted it a little.


You suggested editing & working in the doDrawingConversion, but I the temp folder there only held the drw, etc.


I decided to let Creo View Publish a pdf, so I worked in the storeDrawingRepresentation method.
I found the folder where the published pdf resided & copied it to a temp name (in same temp folder).
Then read the original pdf through the iText reader. Stamp & write to the temp pdf.
Then copy the temp pdf to be the same as original name & over write the original pdf. All in pub temp folder.

iText would not read & write at the same time, to the same pdf, as far as I could find. So I had to make a copy.


I attached the code, but it has extra code to read the DRW related child info (creation date, state, rev) for stamp text.
The client didn't want the DRW info, incase they differ. They wanted the date of the epmdoc as the change notice & new rev were created.


But if some one wants the DRW info for stamp, they can just remove this method (& its while loop):


navRefQR = EPMStructureHelper.service.navigateReferencesToIteration(epmDRW, null, false, configSpec);


It also has code to read the info for the 1st iteration of the current Rev & if you don't want that method (& its while loop), remove:


QueryResult qr = VersionControlHelper.service.allIterationsOf(epmDoc.getMaster());


You might have to adjust the epmDoc/epmDRW names.


This code was a major pain, but I learned a lot & it didn't help that they threw me too many interfering tasks.


The code should be split into multiple separate methods &/or classes, but after getting it to work, I was tired of it..LOL


So please view & let me know of any errors/issues, but it works. But of course, you don't know about errors, till its in production mode & some user throws an unplanned taskat it & it fails.


Hope all enjoy.


Larry Jett
datajett@aol.com

cadjett
1-Visitor
(To:Dmi3U)

I attached new source, that has a better date format.

createdDate = WTStandardDateFormat.format(epmDRW.getCreateTimestamp(), 22, Locale.getDefault());

DATE [java util.date]: 2014-02-25 02:13:46.0
DATE (dueDate3): 2014-02-25 02:13:46 CST
DATE (dueDate4): 25 Feb 14 02:13
DATE (dueDate22): 02/25/2014
DATE (dueDate19): 2/25/14 2:13 AM
DATE (dueDate20): 2/25/14
DATE (dueDate21): 2:13 AM
DATE (dueDate25): 2014-02-25 02:13:46
DATE (dueDate26): 2014-02-25

I like 02/25/14 best, but its not an option. 20 is close, but it drops the 0 of 02.

Which would others here, like most. I chose 22.

I also forgot to mention that the site.xconf insert for this CustomCadConvert usage & compile command are below & 1st few lines in source.


// ant -f bin/tools.xml class -Dclass.includes=ext/publishing/CustomCadConvert.java


/*


site.xconf entry:


targetFile="codebase/wvs.properties"
value="ext.publishing.CustomCadConvert,useworkerdownload\=$(wt.home)$(wvs.dir.sep)auth.properties"/>

*/

Larry Jett

cadjett
1-Visitor
(To:Dmi3U)

I hate to keep doing this, but I updated the code again (attached):

I changed the DATE label to Created On.
I changed the Created On Date format from MM/dd/yyyy (I think yyyy) to yyyy-MM-dd HH:mm z
I changed LC STATE label to State.

All these changes to be the same as what is on the objects windchill detail page, for label & date format.

State: Design
Created On: 2014-02-05 13:26 CST

Larry Jett

mdigman-2
12-Amethyst
(To:cadjett)

Just a quick note if someone is trying to use this today.  If you are using the publish additional files feature (i.e. let Creo drawings publish as a PLT, and also publish a PDF), those additional files are stored in a compressed (zip format) file with the extension PVOA.  You will need to modify the cadConvert to look for a PVOA file, check to see if a PDF is in the PVOA file, extract the PDF, watermark it, and put it back into the PVOA file.

Announcements


Top Tags