Linq转XML(Base64编码) [英] Linq to XML (Base64 Encoded)
问题描述
我必须将PDF转换为Base64编码,然后将其写入XML文件中的元素.
我有Base64编码的字符串(很长/很长),但是我正在使用的规范说以下内容:
I have got to convert a PDF to a Base64 Encoded and write it to a element in a XML file.
I have got the Base64 Encoded string (very long/big) but the spec im working from says the following:
已选择此项,以确保可以显示和验证XML文件而没有任何潜在的可能性
由于处理原始JPEG文件的原始二进制组成而导致的问题.文件数据应显示
在兼容XML的浏览器(例如Internet Explorer)中正确显示.数据必须以固定的76个字符行显示,每行之间用换行符分隔.
第一个问题是关于JPEG的问题,如果我使用pdf是否有效?
其次,不确定如何实现:数据必须以固定的76个字符的行表示,每行之间用换行符分隔.
如何使用Linq to XML实现这一点
This has been chosen, to ensure the XML file may be displayed and validated without any potential
problems caused by the handling of the raw binary composition of the original JPEG file. The file data should display
correctly in an XML compliant browser, such as Internet Explorer. The data must be presented in fixed 76 character rows, each row separated with a line break.
First question is about the bit about the JPEG is that valid if i using pdf?
Secondly not sure how to achive this: The data must be presented in fixed 76 character rows, each row separated with a line break.
How can i achive this with Linq to XML
推荐答案
Convert.ToBase64String(pdfBytes, Base64FormattingOptions.InsertLineBreaks);
这篇关于Linq转XML(Base64编码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!