Free Support Forum -

PDF Document Title

How can the PDF document title appear at the top of the browser's title bar? Normally, the title is placed between the title tags of a HTML document. A portion of the XML document which is bound to the PDF file is shown here:

<?xml version=""1.0"" encoding=""utf-8"" ?>



Adding titile into PDF is supported by Aspose.Pdf but adding title into the browser’s title bar is not supported. You should write your own code outside Aspose.Pdf to display the title in browser’s title bar.

Hi Tommy,

When I wrote code outside of Aspose.Pdf, the browser title is overwritten with the filename instead of the document title whenever a PDF document is created. Using the example below, instead of getting "My Document Report" on the browser title line, a filename like "http://mywebsite/report.aspx" appears.

<html >

<head runat="server">

<title>My Document Report</title>



<form id="form1" runat="server">






Thank you.


Aspose.Pdf uses the following code to output Pdf to browser:


if(saveType == SaveType.OpenInAcrobat)
response.AddHeader(“content-disposition”,“attachment; filename=” + fileName);
response.AddHeader(“content-disposition”,“inline; filename=” + fileName);
response.ContentType = “application/pdf”;



I think this code overwrite the title. As a workaround, you can save the Pdf into stream and write the stream into browser by your self.