Chr*_*wes 13
您可以将PDF文件转换为Base64二进制文件并将其包装到带有类型的容器元素中xs:base64Binary.例如,您可以使用此架构定义将PDF文件放在xml消息中.
<xs:complexType name="documentType">
<xs:sequence>
<xs:element minOccurs="0" name="mimetype" type="xs:string" />
<xs:element minOccurs="0" name="filename" type="xs:string" />
<xs:element name="content" type="xs:base64Binary" />
</xs:sequence>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)
org.apache.commons.codec.binary.Base64如果您已经commons-codec在项目中使用,则可以使用此方法.它支持使用分块数据和字符串.例如:
// You can read in the PDF file with FileReader and get the bytes
// Please obey that this solution must be improved for large pdf files
Base64.encodeBase64(binaryData, true)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7387 次 |
| 最近记录: |