using System.Text;
using UglyToad.PdfPig;

namespace KiMailOrderAgent.Attachments;

public class PdfTextExtractor
{
    public string Extract(byte[] content)
    {
        using var stream = new MemoryStream(content);
        using var document = PdfDocument.Open(stream);

        var sb = new StringBuilder();

        foreach (var page in document.GetPages())
        {
            sb.AppendLine(page.Text);
        }

        return sb.ToString();
    }
}