首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Microsoft信息保护SDK损坏的PDF

Microsoft信息保护SDK损坏的PDF
EN

Stack Overflow用户
提问于 2021-02-13 00:21:05
回答 1查看 52关注 0票数 0

我有一个用MIP SDK保护PDF的API。它目前在.NET框架4.6.1中运行良好。我正在尝试将相同的代码合并到.NET Core3.1API中,然而,在使用MIP保护PDF之后,我得到了损坏的PDF。跳过保护会生成可以打开的PDF。不确定是否需要在.NET核心中使用MIP?使用Microsoft.InformationProtection.File 1.8.94

代码语言:javascript
复制
try
{
    MemoryStream memoryStream = new MemoryStream(file);

    var handler = Task.Run(async () => await fileEngine.CreateFileHandlerAsync(memoryStream, fileName, true)).Result;

    _logger.Debug().Message("Created file handler").Write();

    Helpers helper = new Helpers();

    ProtectionSettings settings = new ProtectionSettings();

    handler.SetProtection(helper.CreateAdhocDescriptor(userEmail, canPrint, accessExpration), settings);

    _logger.Debug().Message($"Set protection. Expiration date: {accessExpration}").Write();

    MemoryStream protectedFile = new MemoryStream();

    var result = Task.Run(async () => await handler.CommitAsync(protectedFile)).Result;

    _logger.Debug().Message("Protected file").Write();

    return protectedFile;
}
catch (Exception ex)
{
    _logger.Error().Message("Failed to protect file").Exception(ex).Write();
    throw ex;
}
EN

回答 1

Stack Overflow用户

发布于 2021-03-10 07:11:05

我已经测试过了,但是不能重现这个问题。你还在遇到这个问题吗?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66175363

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档