小编Con*_*dde的帖子

在 .net maui 中使用 itext7 时如何解决 Unknown PdfException

返回时返回错误:Unknown PdfException。- - > System.NotSupportedException:itext7.bouncy-castle-adapter 或itext7。bouncy-castle-fips-adap...在线

Var writer = new PdfWriter(stream);
Run Code Online (Sandbox Code Playgroud)

我的代码是尝试使用 itext7 扩展名创建一个 pdf 文件。In.net maui 的移动应用程序。

public static MemoryStream CreatePdf()
    {
        try
        {
            using (var stream = new MemoryStream())
            {
                var writer = new PdfWriter(stream);
                var pdf = new PdfDocument(writer);
                var document = new Document(pdf);
                var paragraph = new Paragraph("hello");
                document.Add(paragraph);
                document.Close();
                stream.Position = 0;
                return stream;
            }
        }
        catch(Exception ex)
        {
            Console.WriteLine(ex.Message);
            return null;
        }
    }
Run Code Online (Sandbox Code Playgroud)

c# itext7 maui visual-studio-2022

14
推荐指数
2
解决办法
2万
查看次数

标签 统计

c# ×1

itext7 ×1

maui ×1

visual-studio-2022 ×1