开发者

Is sending a PDF as encoded byte array in XML sensible

开发者 https://www.devze.com 2022-12-22 13:50 出处:网络
I am looking to return a PDF from a webservice call. (ATM, a custom proxy is required at the client-side)

I am looking to return a PDF from a webservice call. (ATM, a custom proxy is required at the client-side)

AFAICS, there are 2 ways of doing it

a) Return the link to a web-accessible location b) Encode the PDF and include it in the XML

In my circumstance, a) will require 2 trips from the client, the first to get the path and the second to get the file.

However, wrt b), this link (http:/开发者_运维技巧/www.coderanch.com/t/279020/Streams/java/wrting-bytearray-xml-file#1283263) suggests that it isn't a good idea to encode a PDF, though without explanation.

I'd be grateful if someone would offer recommendations of the above (and potentially, other alternatives).

Many thx

Simon


Would you be Base64 encoding it?

From Wikipedia "Very roughly, the final size of base64-encoded binary data is equal to 1.37 times the original data size + 814 bytes (for headers). "

so very quickly this will outweigh the disadvantage of 2 network trips.


Does it have to be a webservice call? Could you make it a simple get request to a page in your site that you return the PDF from? You could then enforce SSL on this request.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号