4

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?

2 Answers 2

3

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! ;-)

1
  • Since HKEY_CLASSES_ROOT is just an alias to a merged view of HKEY_CURRENT_USER/SOFTWARE/Classes and HKEY_LOCAL_MACHINE/SOFTWARE/Classes, and since HKEY_CURRENT_USER takes precedence, then these should be corrected to use HKEY_CURRENT_USER/SOFTWARE/Classes, not HKEY_CLASSES_ROOT. This will also allow you to deploy these registry settings to a GPO rather than modifying only the current user. Commented Aug 3, 2020 at 20:58
1

You can change the default icons associated with file handlers by modifying the Windows registry directly but it's probably easier to use the program FileTypesMan by Nirsoft.

Find the .PDF entry and edit the default icon. You can browse for executable files (like Adobe Reader) and choose an icon within it. What I did instead was first associate PDF files with Microsoft Edge so I could copy and paste the DefaultIcon value that entails.

You can try copying this if the value is universal and remains static to skip that step.

@{Microsoft.MicrosoftEdge_44.17763.1.0_neutral__8wekyb3d8bbwe?ms-resource://Microsoft.MicrosoftEdge/Files/Assets/MicrosoftEdgePDF.png}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .