Issue

Per default the PDF file name is the same as the name of the Inventor drawing (IDW or DWG) plus the extension '.pdf'. So, if you create a PDF from drawing Drawing1.idw the PDF name is Drawing1.idw.pdf.



How to add the Drawing's Part Number to the PDF's Filename

Where the filename is generated

  • Navigate to C:\ProgramData\coolOrange\powerJobs\Jobs
  • Open the file YourCompanyName.CreatePDF.ps1 with a text editor (If you don't have such a file check out the getting started)
  • Search for a line that looks like this:
    $localPDFfileLocation = "$workingDirectory\$($file._Name).pdf"
  • Everything in between the two " builds the filepath
  • Everything prefixed with a is a variable that holds further information 
  • Everything else in there is just plain text. For example the ".pdf"
  • The PDF filename is created in the part $($file._Name).pdf


How the File's Properties are accessed

  • With $file you have access to the drawing file, which is processed in the job, and its properties . 
  • With $($file._Name) you get the drawing's filename with extension ("Drawing1.idw") to which the extension ‘.pdf’ is added
  • With $($file._PartNumber) you get the Part Number of the drawing


How to add the Part Number to the PDF's Filename

You can add the part number with a prefixed underscore ‘_’ to the variable $localPDFfileLocation  like this:


$localPDFfileLocation = "$workingDirectory\$($file._Name)_$($file._PartNumber).pdf"


If the Part Number is ‘SCI-00012’ the result of the PDF name would be: Drawing1.idw_SCI-00012.pdf



Further Reads

  • Of course, you can have access to more properties of a file. Find more information about accessing the file object here.
  • And if you are interested to learn more sophisticated PowerShell mechanism read How to create PDFs with custom filenames.


See Also