Header text missing when save word as pdf

some header text is missing while save word as pdf. header text available in word document .but not available some header text in pdf document.

Please find below code

string outputfile = @"D:\\Temp\\output2.pdf";
Aspose.Words.Document objW = new Aspose.Words.Document("D:\\Temp\\input2.docx");
Aspose.Words.Saving.PdfSaveOptions opt1 = new Aspose.Words.Saving.PdfSaveOptions();
opt1.DownsampleOptions.DownsampleImages = false;
opt1.SaveFormat = Aspose.Words.SaveFormat.Pdf;
objW.Save(outputfile, opt1);

issue in pdf.docx (87.6 KB)

output2.pdf (42.7 KB)

input2.docx (19.4 KB)

@thiru1711 The behavior is expected. You will get the same result if convert document to PDF using MS Word:
ms.pdf (122.0 KB)

In the header there is TITLE field, but title built-in property is empty in your document, please see Document.BuiltInDocumentProperties.Title. So after updating TITLE field it shows an empty string. You can lock or unlink the TITLE field to keep the text shown before updating the field:

Document doc = new Document(@"C:\Temp\in.docx");
doc.Range.Fields.Where(f => f.Type == FieldType.FieldTitle).ToList()
    .ForEach(f => f.Unlink());
doc.Save(@"C:\Temp\out.pdf");

out.pdf (42.8 KB)

Thanks for reply.
Document title property is empty. but how added header title field.
Please find attachment for reference.

Please tell me how to add this kind of text in header.

document tile.docx (171.3 KB)

@thiru1711 You can set Document.BuiltInDocumentProperties.Title and then use TITLE field.

Hi Alexey,

searched the title property, could not be able to find that,
could you provide the screen shot of the document title value exists within the document side?

@thiru1711 You should press Alt+F9 to see field codes in the document. Here is how it looks like:

And here you can see title value is empty in your document: