diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
new file mode 100644
index 00000000..af14558c
--- /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 bfe623cb..62a86d69 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 AltoDocument 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/HOcrTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/HOcrTextExporter.cs
index edb19ad8..3441ac8c 100644
--- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/HOcrTextExporter.cs
+++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/HOcrTextExporter.cs
@@ -4,6 +4,7 @@
using Core;
using DocumentLayoutAnalysis;
using System;
+ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using UglyToad.PdfPig.DocumentLayoutAnalysis.PageSegmenter;
using UglyToad.PdfPig.Graphics;
@@ -118,6 +119,9 @@ public string Get(PdfDocument document, bool includePaths = false, bool useHocrj
/// Get the hOCR (HTML) string of the page layout. Excludes PdfPaths.
///
/// The page.
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides.")]
+#endif
public string Get(Page page)
{
return Get(page, false);
diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/ITextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/ITextExporter.cs
index 497bf072..3c6c1da8 100644
--- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/ITextExporter.cs
+++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/ITextExporter.cs
@@ -1,6 +1,7 @@
namespace UglyToad.PdfPig.DocumentLayoutAnalysis.Export
{
using Content;
+ using System.Diagnostics.CodeAnalysis;
///
/// Exports the page's text into the desired format.
@@ -12,6 +13,9 @@ public interface ITextExporter
///
/// The page to convert to the format.
/// The containing the page contents represented in a compatible format.
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides.")]
+#endif
string Get(Page page);
}
}
diff --git a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/PageXmlTextExporter.cs
index 324bfa0c..7297143a 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.DocumentLayoutAnalysis/Export/SvgTextExporter.cs b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/SvgTextExporter.cs
index 03811df1..1c5ac654 100644
--- a/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/SvgTextExporter.cs
+++ b/src/UglyToad.PdfPig.DocumentLayoutAnalysis/Export/SvgTextExporter.cs
@@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Xml;
@@ -65,6 +66,9 @@ private SvgTextExporter(InvalidCharStrategy invalidCharacterStrategy, Func
/// Get the page contents as an SVG.
///
+#if NET6_0_OR_GREATER
+ [RequiresUnreferencedCode("'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides.")]
+#endif
public string Get(Page page)
{
var builder = new StringBuilder($"