Base64在C#中编码PDF? [英] Base64 Encode a PDF in C#?

查看:356
本文介绍了Base64在C#中编码PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以提供一些如何做到这一点吗?我可以为常规的文本或字节数组做这个,但不知道如何使用pdf。我先把pdf填入字节数组吗?

解决方案

使用 File.ReadAllBytes 加载PDF文件,然后使用 将字节数组正常编码Convert.ToBase64String(bytes)


Can someone provide some light on how to do this? I can do this for regular text or byte array, but not sure how to approach for a pdf. do i stuff the pdf into a byte array first?

解决方案

Use File.ReadAllBytes to load the PDF file, and then encode the byte array as normal using Convert.ToBase64String(bytes).

这篇关于Base64在C#中编码PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆