When exporting AutoCAD drawings the model and all the layout spaces are exported and that is not always needed.
If only specific spaces are supposed to be printed you have to specify this in your script file. To be precise in the -OnExport parameter of the Export-Document cmdlet. In the attached sample script you can see one possible way to do this.
The function GetAutoCADOnExport determines which spaces should be excluded in the exported file. This can be configured in the following variables that are passed to the function as parameters:
$ExcludeAcadLayouts = $true $ExcludeAcadModel = $false
The function is called and the result is saved in the $OnExport variable:
$onExport = GetAutoCADOnExport -ExcludeModel:$ExcludeAcadModel -ExcludeLayouts:$ExcludeAcadLayouts
Afterwards when exporting the file the $OnExport variable needs to be passed in the -OnExport parameter:
$exportResult = Export-Document -Format 'PDF' -To $localPDFfileLocation -Options $configFile -OnExport $onExport
More about the -OnExport parameter
More about Pdf export settings