public async Task ShouldReturnAttachments_ForInputFileAsFilePath() { var result = await _pdFtk.ExtractAttachments(TestFiles.TestFileWithAttachmentsPath); result.Success.Should().BeTrue(); result.Result.Should().HaveCount(1); result.Result.First().Key.Should().Be("utf8test.txt"); result.Result.First().Key.Should().NotBeEmpty(); }
/// <summary> /// Extracts attachments from a PDF file. /// </summary> /// <param name="pdftk">The IPDFtk object.</param> /// <param name="pdfFile">A stream of the PDF file input.</param> /// <returns>A result with the attachments.</returns> public static async Task <IPDFtkResult <IReadOnlyCollection <KeyValuePair <string, byte[]> > > > ExtractAttachments(this IPDFtk pdftk, Stream pdfFile) { using var inputFile = await TempPDFtkFile.FromAsync(pdfFile); return(await pdftk.ExtractAttachments(inputFile.TempFileName)); }