Skip to content

Instantly share code, notes, and snippets.

@aspose-words-gists
Created July 10, 2024 09:30
Aspose.Words for .NET. Working with PDF/A or PDF/UA using C#.
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document(MyDir + "Table of contents.docx");
var tocHyperLinks = doc.Range.Fields
.Where(f => f.Type == FieldType.FieldHyperlink)
.Cast<FieldHyperlink>()
.Where(f => f.SubAddress.StartsWith("#_Toc"));
foreach (FieldHyperlink link in tocHyperLinks)
link.ScreenTip = link.DisplayResult;
PdfSaveOptions saveOptions = new PdfSaveOptions()
{
Compliance = PdfCompliance.PdfUa1,
DisplayDocTitle = true,
ExportDocumentStructure = true,
};
saveOptions.OutlineOptions.HeadingsOutlineLevels = 3;
saveOptions.OutlineOptions.CreateMissingOutlineLevels = true;
doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.UpdateScreenTip.pdf", saveOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment