Search code examples
powershellwkhtmltopdf

Powershell wkhtmltopdf.exe : libpng warning: iCCP: known incorrect sRGB profile


Using wkhtmltopdf in Powershell, the PDF file is printing as expected, although it is throwing a warning as follows:

& "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

I'd like to either deal with this warning or since the pdf is working satisfactorily, I'd like to suppress the warning. I need some direction please.


Solution

  • I can see from the error that the command is referring to get_individual_aircraft.ps1 at line 138.

    Could you please put

    $ErrorActionPreference = 'SilentlyContinue';

    in that script and see if it works. I believe that EXE is getting called with the help of that script.