I have been trying to use Web.Link to create PDFs of drawings from CREO 2.0 Parametric. I can successfully get it to create the PDF with all of the standard settings but i need to change the output color to monochrome and have it only PDF the first sheet. The users guide is not very helpful with this, it lists the available options and option values but I can not figure out how to apply them to the pdf instructions. I can not seem to assign the OptionValue as per the UG -
OptionValue—Specifies the value of the option in terms of the pfcArgValue object. Set this option using
the property pfcExport.PDFOption.SetOptionValue.
I can set the OptionType by assigning the desired value -
var color = pfcCreate ("pfcPDFOptionType").PDFOPT_COLOR_DEPTH; | ||||
var colorSet = (pfcCreate ("pfcPDFColorDepth").PDF_CD_MONO); | ||||
var pdfColor = pfcCreate ("pfcPDFOption").Create(); | ||||
pdfColor.OptionType = color; |
But if I do the same with the OptionValue it fails, or if i use SetOptionValue it fails.
Also how do you set the collection of PDF options? -
Use the property pfcPDFExportInstructions.Options to set the collection of PDF export options.
Any help is much appreciated.
Thanks,
-Alex
Solved! Go to Solution.
For anyone interested in an answer I have figured this out.
You must create an Options collection
//create options | |||
var myOptions = pfcCreate ("pfcPDFOptions") |
Then create a new option and create the appropriate variables for type and value
var pdfColor = pfcCreate ("pfcPDFOption").Create(); | |||
pdfColor.OptionType = (pfcCreate ("pfcPDFOptionType").PDFOPT_COLOR_DEPTH); | |||
var colorSet = pfcCreate ("pfcPDFColorDepth").PDF_CD_MONO; |
Then create an Argument Object with the proper type of agrument (Boolean, Interger ...) and the OptionValue as the input.
var pdfArg = pfcCreate ("MpfcArgument").CreateIntArgValue(colorSet); |
Set the OptionValue
pdfColor.OptionValue=(pdfArg); |
And append the option collection
myOptions.Append(pdfColor); |
When you create the instructions set initialize the Options value and set the options collection
var pdfInstructions = pfcCreate ("pfcPDFExportInstructions"); | |
var inst = pdfInstructions.Create(); | |
inst.Options = myOptions; |
You can append any number of options to the option collection.
I hope this helps someone, the UG is not very clear on this.
Thanks,
Alex
For anyone interested in an answer I have figured this out.
You must create an Options collection
//create options | |||
var myOptions = pfcCreate ("pfcPDFOptions") |
Then create a new option and create the appropriate variables for type and value
var pdfColor = pfcCreate ("pfcPDFOption").Create(); | |||
pdfColor.OptionType = (pfcCreate ("pfcPDFOptionType").PDFOPT_COLOR_DEPTH); | |||
var colorSet = pfcCreate ("pfcPDFColorDepth").PDF_CD_MONO; |
Then create an Argument Object with the proper type of agrument (Boolean, Interger ...) and the OptionValue as the input.
var pdfArg = pfcCreate ("MpfcArgument").CreateIntArgValue(colorSet); |
Set the OptionValue
pdfColor.OptionValue=(pdfArg); |
And append the option collection
myOptions.Append(pdfColor); |
When you create the instructions set initialize the Options value and set the options collection
var pdfInstructions = pfcCreate ("pfcPDFExportInstructions"); | |
var inst = pdfInstructions.Create(); | |
inst.Options = myOptions; |
You can append any number of options to the option collection.
I hope this helps someone, the UG is not very clear on this.
Thanks,
Alex