Tests: Add more DocumentsTests

This commit is contained in:
2024-03-30 09:51:48 +01:00
parent 1047bc6e8f
commit 66898714bb
5 changed files with 97 additions and 6 deletions

View File

@ -6,11 +6,11 @@ namespace Tests.DocumentTests {
private static readonly string FileName = Path.Combine(Path.GetTempPath(), "test_document.pdf");
public static async Task<string> GeneratePdfText(Document doc) {
public static async Task<string> GeneratePdfText(Document doc, bool preserveLayout = false) {
await doc.Generate();
try {
doc.SaveTo(FileName);
var conv = new PdfToTextConverter { CustomArgs = "-raw " };
var conv = new PdfToTextConverter { CustomArgs = preserveLayout ? "-layout " : "-raw " };
return conv.GenerateText(FileName);
} finally {
File.Delete(FileName);