Using:
Error:
SetProcessDpiAwareness failed: "COM error 0x80070005 (Unknown error 0x0ffffffff80070005)"
Possibly related to:
Could you please verify that you're using 2.1.1 version? 2.1.1 version is based on Qt 5.5.1.
Using 2.1.1 of what? Like I said before I am using version 2.1.5.
Of PhantomJS. 2.1.5 is version of the npm package, not phantomjs.
Find the PhantomJS executable in your node_modules (or by running the where phantomjs command) and check its version: phantomjs -v
Yes, that reports 2.1.1
Any command will produce this error at the moment, this is one producing just the version number:
node -e "console.log(require('child_process').execFileSync(require('phantomjs-prebuilt').path, ['--version'], {encoding:'utf8'}));"
Which outputs:
SetProcessDpiAwareness failed: "COM error 0x80070005 (Unknown error 0x0ffffffff80070005)"
2.1.1
I'm also seeing this with 2.1.6
We are having this issue as well. It's really frustrating. Does anyone know a shortcut in fixing this (older version?), until the master version is working again?
Edit:
Ok I fixed this for me by using Version 1.5.0 of html-pdf, instead of 2.1.0. Version 1.5.0 uses phantomjs Version 1.9.19
also tried 2.1.2 but that fails
We're trying to run Prerender as a Windows service created by node-windows. This however fails because in the log it reports this error.
A couple of interesting things we found though:
node server.js it does work as expected and Phantomjs gets started.At the moment of typing we did find a temporary fix. Reverting back to a pre-compiled 2.0.0 did the trick and the server as a service ran as expected.
I don't think it's been mentioned so far but this error doesn't prevent me using phantom for Karma; the error is visible but doesn't error out the process. So for me it's an irritation rather than a blocker. Would still be good to get if resolved though.
It does work, but in some situations it does cause fatal errors by some libraries that use Phantomjs as a dependency. Their error handling will prevent Phantomjs from even starting. I think Phridge is one of those libraries as that's used by Prerender. Going into its code and debugging the startup phase it failed to start Phantomjs was my conclusion.
But again, this happened only when I ran my node code as a service. With a regular node server.js command that executed the very same code it did not cause the SetProcessDpiAwareness error.
Hi there, did anyone find a solution to be able to run this as a windows service? because the same thing as @harm-less its happening to me
thanks
@siulung4073 You also can't get it to work using the suggestions I already gave?
I made it work using _html-pdf_ 1.5 that uses _phantomjs_ 1.9.19
Thanks!
@harm-less Running into the same issue with Prerender. I tried to run this:
npm i [email protected]
However, that didn't seem to work, as there is apparently no version 2.0.0 available: https://www.npmjs.com/package/phantomjs-prebuilt
Here's the error I get:

How'd you install version 2 of PhantomJS?
@Nicholas-Westby I don't think used the prebuild package you're referring to. I remember using a prebuild .exe from the PhantomJS website as I was sick and tired of this bug. A quick look didn't result in anything, but perhaps a bit more effort will turn up a page with old releases.
However, I did found this topic:
http://stackoverflow.com/questions/30084690/how-to-install-phantomjs-v2-with-npm
I'd try that package. Hopefully that works so you still have PhantomJS as a dynamic npm dependency.
@harm-less Thanks for the quick reply!
I actually just got it working (I think) by installing PhantomJS version 1.9.19 and modifying phridge to require that instead of the prebuilt version:

Bit of a pain. Hopefully PhantomJS or Prerender or whoever should fix this issue adds a fix soon so this silly workaround isn't required.
Thanks again for the tip about installing a different version of PhantomJS.
Maybe I spoke too soon. While PhantomJS is starting now, it doesn't seem to actually be converting the Angular directives into HTML as I would expect.
Hi! Sorry for taking this so long. Could someone of you test this version to check if the problem fixed?
https://dl.dropboxusercontent.com/u/30021413/phantomjs/phantomjs-2.5.0-windows.7z
@Vitallium Didn't seem to work for me (same error), though I'm not sure I tested it correctly. I just dropped the contents of your ZIP file into the bin folder for PhantomJS under Prerender:

Here's the error message:
SetProcessDpiAwareness(2) failed: COM error 0xffffffff80070005 (Unknown error 0x0ffffffff80070005), using 2
Interestingly, I see that your phantomjs.exe is only 553KB, while the previous one was 18,152KB. Also, the old one didn't include any DLL's (it was just an EXE). Not sure if that's relevant, but thought I'd mention it just in case.
This is the next major version. It contains a huge amount of fixes plus a complete fresh WebKit. But it's strange that it didn't work for you. I guess it's a Qt bug after all.
Can you try to run Otter Browser on your server? This one - https://sourceforge.net/projects/otter-browser/files/otter-browser-weekly131/otter-browser-win64-weekly131-qtwebkitng.7z/download
I want to isolate that crash.
I'm not sure if the Qt bug was fixed, but it appears to have at least been reported (several years ago): https://bugreports.qt.io/browse/QTBUG-38993
Which version of Qt are you using?
Based on the file details, it seems you are using Qt 5.6. Perhaps 5.7 would help?
@Vitallium Just noticed your edit regarding Otter Browser. Not sure what to do once it's installed, but I'll give it a go.
@Vitallium I ran Otter Browser on the server and viewed the website. Seems to work fine. Is there something in particular you wanted me to do?
@Nicholas-Westby yep. Thanks! Now I'm pretty much sure that this is something in PhantomJS.
@Vitallium Cool. Let me know if you want me to test anything.
This doesn't seem to happen anymore on AppVeyor.
Just a head's up..
I'm getting this error in my logs too, it's actually not causing us any issues.
But the error is appearing in my logs. I'm using NPM phantom, that appears to use phatom-prebuilt. Checking version of phantomjs.exe it is 2.1.1.. This is running on Server 2012 R2.
Like I say it's not causing me any issues, as it appears NPM phantom doesn't bomb out, but just letting you know in case it helps.
I'm still getting this error in my logs. It's working find in my test and local environment, but when the phantomjs call occurs in my prod environment this error is thrown and the pdf does not generate (but the pdf generates fine on dev and locally). I have done an npm install on dev and prod and they're running the exact same code.
...and now it's happening on dev as well.
I get the following error everytime I run phantomjs:
SetProcessDpiAwareness failed: "COM error 0x80070005 (Unknown error 0x0ffffffff80070005)"
I am using phantomjs 2.1.1 on Windows 2012 x64. It does not affect anything, but confuses other devs/tech support guys who are looking into logs for problems.
Are there any ways to avoid or suppress this error?
Same problem on AppVeyor with Phantomjs 2.1.1
Anyone with a bit of free time could look into starting phantomjs with commandline switch -platform windows:dpiawareness=0 and report back ..
In my case, the issue ended up being where the application was launched. In our case, if I ran the tests via Jenkins, things worked fine but from cygwin/ssh it did not. Reason for this is that windows limits GUI access for processes launched when session parent is a service.
I changed my setup to start ssh as a user script when test slave autologins to desktop and got rid of the issue. ymmv
@rasjani referring to your request of trying that command (-platform windows:dpiawareness=0) starting the REPL I do not receive an error.
Starting the REPL without the command line switch I receive the SetProcessDpiAwareness.... error.
Still happening here, I was using [email protected] and got this error but only when the script was executed from a service. It worked well if I executed it myself from the command line (The problem was occurring on a WinServer 2012 R2, but I'm guessing it is not because of the OS but because of the execution of the script as a service).
Worked around by going back to [email protected] which uses phantomjs.exe version 1.9.8
On Windows 10 64 bit, no "SetProcessDpiAwareness failed" error when running
phantomjs -platform windows:dpiawareness=0
Error is present without the switch, -platform windows:dpiawareness=0
I have same issue using protractor + cucumber.js. Can someone help me please to pass params from protractor?
Thanks in advance.
same error using phantomjs-prebuilt 2.1.14 (npm) on win 10
ERROR [phantomjs.launcher]: SetProcessDpiAwareness failed: "COM error 0x80070005 (Unknown error 0x0ffffffff80070005)
PhantomJS 2.1.1 (Windows 8 0.0.0): Executed 0 of 0 ERROR (0.719 secs / 0 secs)
Worth to mention that main reason why this error message (but ymmv) comes is due to windows restriction of not being able to run GUI apps if the parent process is a service.
For example, in my case, if we launch everything from Jenkins and slave master connection is via ssh that has been started with cygrunsrv.
Hi! Any updates on this? Or is there a Windows Policy that can be disabled?
Although it is still able to render pages, the exe file returns to the program calling it right away with a status of 0.
Also, it is working fine in Windows 2008 but it is having this issue in Windows 2012.
I think this is related: https://github.com/marcbachmann/node-html-pdf/pull/295
Error does not appear on windows 10 x64 if I set compatibility mode to Win7 in executable properties (not an option on run, just a tick in properties)
I was having this issue when phantomjs was running on windows server 2012. I believe it's because that windows server 2012 doesn't allow to run interactive services on default. Changing the flag in registry to false i successfully managed to run it.
Same error found on Windows 10 with PhantomJs version 2.1.1.
I found that running the console as administrator did not cause the error:

Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!
Most helpful comment
On Windows 10 64 bit, no "SetProcessDpiAwareness failed" error when running
phantomjs -platform windows:dpiawareness=0
Error is present without the switch, -platform windows:dpiawareness=0