So i am receiving the following error in Powershell
.\nconvert.exe : Error: Can't create file (\\vm912test\c$\JCL Testing\Converted Output\2013\06\MMM7777.pdf)
At M:\Powershell\test4.ps1:61 char:8
+ .\nconvert.exe -quiet -out pdf -c 3 -multi -n 1 $PageCount 1 -o "$OutputL ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( Error: Can't ...06\MMM7777.pdf):String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
If anyone has any experience working with nConvert that could help that would be great.
The line of code that i am using is:
.\nconvert.exe -quiet -out pdf -c 3 -multi -n 1 $PageCount 1 -o "$OutputLocation\$Year\$Month\$BusinessUnit$CheckNumber.pdf" "$TIFPath\$pattern####.tif"
1 Answer
You need to add quotation marks to the output filename, because it countains spaces. I usually do this to force an external command to be formated exactly as I want it to be:
$myCommand = "nconvert -q 100 -out tif -overwrite -o " + ('"' + $OutputFilePath + '"') + " " + ('"' + $InputFilePath + '"')
write-host $myCommand
invoke-expression $myCommand
Use write-host to check the formating and run the command verbatim using invoke-expression.