Issue
When creating a PDF file from an AutoCAD drawing and passing a non existing config DWG file to the -Options parameter of the Export-Document Cmdlet, the PDF is not created and there are no errors in the log file.
Cause
This issue can happen when the not existing configuration file causes internal errors in DWGTrueView.
The issue can also happen when there are typos in the "-To" parameter of the Export-Document Cmdlet or if the plot styles set up in the config file or in case of no config file the plot style set up in the drawing.
Solution
Make sure to pass an existing config file in the -Options parameter of the Export-Document Cmdlet. Additionally you can use Test-Path to check if the PDF file exists in the localPdfFileLocation:
# Make sure the PDF.dwg file exists in "C:\programData\coolOrange\powerJobs\Modules\Export"
$configFile = "$($env:POWERJOBS_MODULESDIR)Export\PDF.dwg"
$exportResult = Export-Document -Format 'PDF' -To $localPDFfileLocation -Options $configFile
if (-not (Test-Path $localPDFfileLocation)) {
throw("PDF Export failed")
}