diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
new file mode 100644
index 000000000..af14558c9
--- /dev/null
+++ b/src/Directory.Build.targets
@@ -0,0 +1,6 @@
+
+
+ true
+ true
+
+
diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs
index c259f8338..345a84ac7 100644
--- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs
+++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/AltoXmlTextExporter.cs
@@ -4,6 +4,7 @@
using Content;
using DocumentLayoutAnalysis;
using System;
+ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Xml;
@@ -94,6 +95,9 @@ private AltoXmlTextExporter(IWordExtractor wordExtractor, IPageSegmenter pageSeg
///
/// The document to extract page layouts from.
/// Draw PdfPaths present in the page.
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from AltoDocument may be trimmed if not referenced directly")]
+#endif
public string Get(PdfDocument document, bool includePaths = false)
{
var altoDocument = CreateAltoDocument("unknown");
@@ -105,6 +109,9 @@ public string Get(PdfDocument document, bool includePaths = false)
/// Get the Alto (XML) string of the page layout. Excludes s.
///
/// The page to export the XML layout for.
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from PageXmlDocument may be trimmed if not referenced directly")]
+#endif
public string Get(Page page) => Get(page, false);
///
@@ -112,6 +119,9 @@ public string Get(PdfDocument document, bool includePaths = false)
///
/// The page to export the XML layout for.
/// Whether the output should include the PdfPaths present in the page.
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from AltoDocument may be trimmed if not referenced directly")]
+#endif
public string Get(Page page, bool includePaths)
{
var document = CreateAltoDocument("unknown");
@@ -355,6 +365,9 @@ private AltoDocument.AltoDescription GetAltoDescription(string fileName)
};
}
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from AltoDocument may be trimmed if not referenced directly")]
+#endif
private string Serialize(AltoDocument altoDocument)
{
var serializer = new XmlSerializer(typeof(AltoDocument));
@@ -377,6 +390,9 @@ private string Serialize(AltoDocument altoDocument)
///
/// Deserialize an from a given Alto format XML document.
///
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from AltoDocument may be trimmed if not referenced directly")]
+#endif
public static AltoDocument Deserialize(string xmlPath)
{
var serializer = new XmlSerializer(typeof(AltoDocument));
diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs
index 47337bba3..cbcd4a142 100644
--- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs
+++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs
@@ -10,6 +10,7 @@
using ReadingOrderDetector;
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
@@ -105,6 +106,9 @@ public string Get(PdfDocument document, bool includePaths = false)
/// Get the PAGE-XML (XML) string of the pages layout. Excludes PdfPaths.
///
///
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from PageXmlDocument may be trimmed if not referenced directly")]
+#endif
public string Get(Page page)
{
return Get(page, false);
@@ -115,6 +119,9 @@ public string Get(Page page)
///
///
/// Draw PdfPaths present in the page.
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from PageXmlDocument may be trimmed if not referenced directly")]
+#endif
public string Get(Page page, bool includePaths)
{
PageXmlData data = new PageXmlData();
@@ -373,6 +380,9 @@ private PageXmlDocument.PageXmlGlyph ToPageXmlGlyph(Letter letter, PageXmlData d
};
}
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from PageXmlDocument may be trimmed if not referenced directly")]
+#endif
private string Serialize(PageXmlDocument pageXmlDocument)
{
XmlSerializer serializer = new XmlSerializer(typeof(PageXmlDocument));
@@ -395,6 +405,9 @@ private string Serialize(PageXmlDocument pageXmlDocument)
///
/// Deserialize an from a given PAGE format XML document.
///
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("Members from PageXmlDocument may be trimmed if not referenced directly")]
+#endif
public static PageXmlDocument Deserialize(string xmlPath)
{
XmlSerializer serializer = new XmlSerializer(typeof(PageXmlDocument));
diff --git a/src/UglyToad.PdfPig.sln b/src/UglyToad.PdfPig.sln
index 444459e42..1ad22d80e 100644
--- a/src/UglyToad.PdfPig.sln
+++ b/src/UglyToad.PdfPig.sln
@@ -10,6 +10,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C55738D2-3165-4D03-9CE2-10A2E2EEC465}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
+ Directory.Build.targets = Directory.Build.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UglyToad.PdfPig.Fonts", "UglyToad.PdfPig.Fonts\UglyToad.PdfPig.Fonts.csproj", "{BBC8F94C-6E94-43FF-AB2E-47FF3C2B999F}"