Home » Php » php – How to change pdf tab title in browser

php – How to change pdf tab title in browser

Posted by: admin July 12, 2020 Leave a comment


My pdf file is open in browser tab. In the title of pdf tab instead of name it shows the url how can i changed it .I am using codeigniter framework and using Mpdf library for pdf.

How to&Answers:

Your PDF document should have Title metadata set. Afterwards, browser will use it for rendering tab title.



In Acrobat Pro, open the PDF and select File -> Properties -> Description and then edit the meta data title (and others if required) as you see fit.

We only saw the title being displayed like this in Firefox.


Put it in a div inside a page and change the page title like this:

  <title>YOUR TAB TITLE</title>

and then:

<object data="test.pdf" type="application/pdf" 
width="300" height="200">
    alt : <a href="test.pdf">test.pdf</a>

You can also set the object width and height to match the page.