Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display favicon for PDF files

Tags:

html

favicon

I am working on a Drupal site with some PDF files where I am opening a PDF file in a new window. The files are getting opened in the browser with the Acrobat Reader plugin but the favicon is not getting displayed. What should be done to show the favicon?

like image 697
Jinesh Avatar asked Feb 03 '11 12:02

Jinesh


People also ask

Can a pdf have a favicon?

The problem of course is that pdf is not html and therefor there is no way to specify a favicon specifically for a single PDF file.

How do I display embedded tags in pdf?

The first method to embed pdf in html is by making use of the object tag in html. The object defines the object that is to be embedded in the page, which in this case is the pdf file to be displayed on the web page, of course.

How do I embed a favicon?

To add a favicon to your website, either save your favicon image to the root directory of your webserver, or create a folder in the root directory called images, and save your favicon image in this folder. A common name for a favicon image is "favicon.ico".


2 Answers

If you put a favicon.ico to the root of your site, then your PDFs opened on that site will actually have that favicon. You can generate transparent ICOs from PNGs with online favicon genereators.

For example, if your favicon is reachable in:

http://example.com/favicon.ico

Then your PDF will show this favicon in the Acrobat plugin tab:

http://example.com/something/something.pdf
like image 101
s1m0n1stv4n Avatar answered Oct 12 '22 14:10

s1m0n1stv4n


If you show the PDF file in an iframe, the browser should show the site-wide favicon, but you're out of luck in an external applications. Acrobat Reader doesn't use Favicons.

UPDATE This is now possible by placing favicon.ico in the root directory of your website as per @s1m0n1stv4n answer below

like image 37
Pekka Avatar answered Oct 12 '22 14:10

Pekka