21 lines
609 B
C#
21 lines
609 B
C#
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);
|
|
}
|
|
}
|
|
}
|
|
}
|