me2*_*our 2 python pdf ipython python-2.7 python-3.x
使用python,我想 convert a pdf file into base64Binary
我的逻辑(不是python)是将文件的内容读入一个字节数组,然后使用类似的东西Convert.ToBase64String() method得到Base64 string:
byte[] pdfBytes = File.ReadAllBytes(pdfPath);
string pdfBase64 = Convert.ToBase64String(pdfBytes);
Run Code Online (Sandbox Code Playgroud)
请告诉我convert a pdf file into base64Binary在python中正确的方法是什么
eve*_*oio 12
这很简单
import base64
with open("book.pdf", "rb") as pdf_file:
encoded_string = base64.b64encode(pdf_file.read())
Run Code Online (Sandbox Code Playgroud)
source:使用base64编码图像文件