Report this

What is the reason for this report?

I can't embed my public PDF file from Digital Ocean spaces

Posted on October 5, 2022

I can’t embed my public PDF file that I upload with correct content type set (as PDF) from Digital Ocean spaces.

Simple example

<iframe src="https://appssimpleink.sfo3.cdn.digitaloceanspaces.com/signhouse-pdf-original/Land+Lease+Agreement+by+UseSignHouse.com.pdf" />

is broken



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @hilmanrdn,

It seems a similar question was asked some way back :

https://www.digitalocean.com/community/questions/how-to-view-pdf-s-stored-in-spaces-without-them-being-downloaded

Great question! What defines that action is the “Content-type” header sent from the server to the client. You can define the value of this header using s3-compatible tooling. There is a good explanation of this here:

https://stackoverflow.com/questions/39832289/pdfs-in-amazon-s3-dont-open-in-chrome-for-view

This references some sample commands for changing that header using s3cmd:

https://stackoverflow.com/questions/27343432/s3cmd-to-set-correct-content-type-for-image-jpeg

You can learn how to set up s3cmd for usage with DigitalOcean here:

https://www.digitalocean.com/docs/spaces/resources/s3cmd/

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Dark mode is coming soon.