Dim MyDocument As Words.Document = New Words.Document(source, opt)
MyDocument.Save(target, opt2 >> PdfSaveOptions >>
.SaveFormat = Words.SaveFormat.Pdf
.Compliance = Words.Saving.PdfCompliance.PdfUa1
.DisplayDocTitle = False / True
will make the same pdf, I mean .DisplayDocTitle = False / True
will always use the source html file Title tag, will never show the real file name!
@australian.dev.nerds The title displayed in PDF is taken from BuiltinDocumentProperties.Title
:
Document doc = new Document();
doc.BuiltInDocumentProperties.Title = "This is a document title";
PdfSaveOptions opt = new PdfSaveOptions();
opt.DisplayDocTitle = true;
doc.Save(@"C:\Temp\out.pdf", opt);
"This is a document title"
will be shown as PDF document title.
1 Like
Hello
Sure, but when I load an html into the document, .BuiltInDocumentProperties.Title is already set from the html title tag
Now, .DisplayDocTitle = True / False won’t make a difference?
@australian.dev.nerds As I can see everithing works as expected. For example I used the following HTML for testing:
<html>
<head>
<title>This is document title</title>
<meta name="description" content="This is description">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
and the following code:
Document doc = new Document(@"C:\Temp\in.html");
PdfSaveOptions opt = new PdfSaveOptions();
opt.DisplayDocTitle = false;
doc.Save(@"C:\Temp\out1.pdf", opt);
opt.DisplayDocTitle = true;
doc.Save(@"C:\Temp\out2.pdf", opt);
in one of output document title is displayed and another is not displayed: