I would like to know how can we embed an image that's got as a response from an external service. It works fine in a VF page but when
renderAs="PDF" is given, the image is broken since the page renders before the response is got from the external server.
This is what I've tried and its working. I send a http request to the external server and i get a response which I store as an attachment using
response.getBodyAsBlob() and set the ContentType to 'png' and save it.
Now that it's working I've another doubt. Since the call to external server might get delayed response, if I send the call out in constructor or 'action parameter in
<apex:page>', the page will take time to load and render as PDF.
Since the delay is unavoidable, is there a way to set a kind of timer in apex to limit the time the request can wait for response?