I want to display the PDF I got from an HTTP request. Now I will tell you in steps how I came to the link I have.
First I get a PDF from an HTTP request in the following format as a string:
%PDF-1.4
%����
2 0 obj
<</Length 474/Filter/FlateDecode>>stream
x����n�0��y��l������Jz��^lZ
...
Then I encoded it (base64) with this code:
byte[] pdf = pdfCode.getBytes();
String link = Base64.encodeToString(pdf, Base64.DEFAULT);
And now I have something like this:
VBERi0xLjQKJe+/ve+/ve+/ve+/vQoyIDAgb2JqCjw8L0xlbmd0aCA0NzQvRmlsdGVyL0ZsYXRl
RGVjb2RlPj5zdHJlYW0KeO+/ve+/ve+/ve+/vW7vv70wEO+/ve+/vXnvv73vv71s77+977+977+9
77+977+977+9Snrvv73vv71ebFrvv73vv73vv
...
What next, how to get a link from this that I can show?