Google-chrome – Use Chrome to open both .htm and .pdf files but assign different icons in Win10

google-chromeiconspdf

I would like to open both .pdf and .htm files with Chrome on my Win10 Laptop. This I could achieve. But now the icons for both file types are the usual chrome icon.

That becomes confusing. I'd like to have different icons for .pdf and .html but both to be opened by the same Chrome exe.

Is this possible?

I found one possible answer here: How to change the icon associated with a particular file format (and only that file format) on Windows 10?

I did use the "Defaults editor" program but it seems to list both .pdf and .htm together so I cannot set the individual icons.

enter image description here

I even tried making a shortcut to chrome, using that as the default program to open pdfs and setting its icon differently. But even that did not seem to work.

Any tips? How can I achieve this?

Best Answer

I have created a "Chrome PDF icon.reg" script, based on the info from change-default-icon-file-type and set-custom-icon-pdf-files-firefox.

Windows Registry Editor Version 5.00

;Make PDFs open in Google Chrome while using custom PDF icon 
;-----------------------------------------------------------
[HKEY_CLASSES_ROOT\.pdf]
@="ChromePDF"
"Content Type"="application/pdf"

[HKEY_CLASSES_ROOT\.pdf\OpenWithProgids]
"ChromePDF"=hex(0):

[HKEY_CLASSES_ROOT\ChromePDF]
@="PDF (opened with Chrome)"

[HKEY_CLASSES_ROOT\ChromePDF\DefaultIcon]
@="D:\\Pictures\\Icons\\pdf icons\\PDF.ico"
; @="@{Microsoft.MicrosoftEdge_44.18362.329.0_neutral__8wekyb3d8bbwe?ms-resource://Microsoft.MicrosoftEdge/Files/Assets/MicrosoftEdgePDF.png}"

[HKEY_CLASSES_ROOT\ChromePDF\shell\open]
@="Open"

[HKEY_CLASSES_ROOT\ChromePDF\shell\open\command]
@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" -- \"%1\""

[HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet\Google Chrome\Capabilities\FileAssociations]
".pdf"="ChromePDF"

[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\Google Chrome\Capabilities\FileAssociations]
".pdf"="ChromePDF"

It works with Opera in a similar way - see the "Opera PDF icon.reg" script below:

Windows Registry Editor Version 5.00

;Make PDFs open in Opera while using custom PDF icon 
;-----------------------------------------------------------
[HKEY_CLASSES_ROOT\.pdf]
@="OperaPDF"
"Content Type"="application/pdf"

[HKEY_CLASSES_ROOT\.pdf\OpenWithProgids]
"OperaPDF"=hex(0):

[HKEY_CLASSES_ROOT\OperaPDF]
@="PDF (otvorené cez Opera)"

[HKEY_CLASSES_ROOT\OperaPDF\DefaultIcon]
@="D:\\Obrazky\\Ikony\\pdf icons\\PDF.ico"
; @="@{Microsoft.MicrosoftEdge_44.18362.329.0_neutral__8wekyb3d8bbwe?ms-resource://Microsoft.MicrosoftEdge/Files/Assets/MicrosoftEdgePDF.png}"

[HKEY_CLASSES_ROOT\OperaPDF\shell\open]
@="Open"

[HKEY_CLASSES_ROOT\OperaPDF\shell\open\command]
@="\"C:\\Users\\UserName\\AppData\\Local\\Programs\\Opera\\launcher.exe\" -- \"%1\""

[HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet\OperaStable\Capabilities\FileAssociations]
".pdf"="OperaPDF"

[HKEY_CURRENT_USER\Software\Clients\StartMenuInternet\OperaStable\Capabilities\FileAssociations]
".pdf"="OperaPDF"

You need to save the above code in a text file with a ".reg" extension and double click it, to put it into the registry. Once it's done, you just right click any PDF file and in its properties change the "Open with" to Chrome or Opera. You may revert it to your previous choice anytime.

The path to the PDF icon needs to be corrected according to where you keep it. You may also try to use a '@="@{Microsoft.MicrosoftEdge_44.18362...' as a path to the PDF icon - it will be the same one as the Microsoft Edge is using for PDF files. I did not test yet, whether it works after Windows/Edge update (when the version changes) though. In case of Opera, you also need to correct the UserName in the path to Opera launcher.

Good luck! ;-)