Free Support Forum - aspose.com

How to set or show Window’s title bar in output PDF using .NET

I can’t seem to change the title of the pdf. I’ve tried adding the following code
public byte[] ConvertStreamToPdf(MemoryStream stream)
{
var doc = new Document(stream);

        MemoryStream ms = new MemoryStream();
        doc.BuiltInDocumentProperties.Title = "Aspose.Words";
        doc.Save(ms, SaveFormat.Pdf);

        return ms.ToArray();

Does anyone have any ideas where I might be going wrong?

@Domlr

Please use PdfSaveOptions.DisplayDocTitle property to get the desired output. Following code example shows how to display title of the document as title bar.

Document doc = new Document(MyDir + "Rendering.docx");
doc.BuiltInDocumentProperties.Title = "Windows bar pdf title";

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions { DisplayDocTitle = true };

doc.Save(ArtifactsDir + "PdfSaveOptions.WindowsBarPdfTitle.pdf", pdfSaveOptions);