2017-01-08 32 views
0

在PowerShell中使用wkhtmltopdf,PDF文件打印預期,儘管它拋出一個警告如下:PowerShell的wkhtmltopdf.exe:libpng的警告:ICCP:知不正確sRGB模式

& "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --print-media-type -q --header-left [webpage] --header-font-size 7 --footer-left [isodate] $listing.Url $pdfDest

wkhtmltopdf.exe : libpng warning: iCCP: known incorrect sRGB profile 
At R:\powershell_scripts\aso\get_individual_aircraft.ps1:138 char:13 
+    & "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --pr ... 
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (libpng warning:...ct sRGB profile:String) [], RemoteException 
    + FullyQualifiedErrorId : NativeCommandError 

我想要處理這個警告,或者由於pdf的運行令人滿意,我想要禁止警告。我需要一些指導。

+0

我試過try/catch。它似乎不工作,因爲它不是Powershell命令。 – STWilson

回答

1

我可以從錯誤中看到該命令所指的get_individual_aircraft.ps1在管線138

能不能請你把

$ ErrorActionPreference = 'SilentlyContinue';

在該腳本中,看看它是否工作。我相信EXE正在該腳本的幫助下調用。

相關問題