Tests: Add tests for documents

This commit is contained in:
2024-02-13 12:38:37 +01:00
parent 912206f52d
commit 805f782c83
10 changed files with 136 additions and 13 deletions

View File

@ -0,0 +1,20 @@
using Elwig.Documents;
using NReco.PdfRenderer;
namespace Tests.DocumentTests {
public static class Utils {
private static readonly string FileName = Path.Combine(Path.GetTempPath(), "test_document.pdf");
public static async Task<string> GeneratePdfText(Document doc) {
await doc.Generate();
try {
doc.SaveTo(FileName);
var conv = new PdfToTextConverter { CustomArgs = "-raw " };
return conv.GenerateText(FileName);
} finally {
File.Delete(FileName);
}
}
}
}