Kathire
Kathire

Reputation: 53

How to read file stream as PDF from Amazon S3 and display in browser

We use the following code to read a PDF file from Amazon S3.

 S3Object object = client.getObject(new GetObjectRequest(bucket, key));
 InputStream is = object.getObjectContent();
 Results.ok(is)

However the PDF is rendered as blank.

Could you please provide a code snippet on play with angular to display or render the stream as PDF in the browser.

Upvotes: 2

Views: 1573

Answers (1)

wongelz
wongelz

Reputation: 119

Have you tried setting the content-type?

return Results.ok(is).as("application/pdf");

Upvotes: 2

Related Questions