Please contact your support team if you have a question or need assistance for any Rackspace products, services, or articles.
This question is not answered.
We're using Cloud Files to store PDF documents. Our client wants them to be displayed in their browser instead of having to download them. We tried embedding them like so:
<object data="url" type="application/pdf" height="400" width="100%"> alt : <a href="url">Name</a> </object>
This works perfectly when the file is hosted from our server but after it's been uploaded to Cloud Files we get a "Failed to load PDF document" error on Chrome (our most commonly used browser). Does anyone have a way to get this to work? We're using the PHP API to generate a temporary URL so the user can view just their documents.
It sounds like there might be a few factors preventing this from working as you expected. Either the Content-Disposition header is not getting set on the object in Cloud Files, or the temporary URL signature may not be correct.
However, to display PDF's in the browser (without the need to embed them in HTML) you can set the Content-Disposition and Content-Type headers to tell the browser that it is indeed a PDF file and that it should open it in the browser if possible. To do this, you can either manipulate these headers when you upload the file to Cloud Files, or using the API or an SDK afterwards. Additionally, you can use the mycloud.rackspace.com Control Panel to change these headers on objects as well (Go to Storage->Cloud Files select the Container the object is in and then navigate to the object itself. Click the gear icon next to the object and select 'Edit headers' under the Management heading)
For this behavior the values you want to set are:
Once these are set, you should be able to open the temporary URL link in Chrome and have the PDF load.
For reference, here is the RFC that describes the Content-Disposition header http://www.ietf.org/rfc/rfc1806.txt
If the issue is due to an invalid temporary URL signature being generated, you should be able to identify this via the Developer Console as the requested resource will return a 401 Unauthorized. Should this be the case, I would recommend double checking your configuration to ensure you have the correct X-Account-Meta-Temp-Url-Key set and that the path is set correctly, etc. See: https://developer.rackspace.com/docs/cloud-files/v1/use-cases/public-access-to-your-cloud-files-account/ for more details about temporary URL generation.
The Rackspace Community (“Community”) is provided “AS IS” without warranty of any kind. The information on the Community sites is created by members of the Community and is intended for reference and general discussions only. Although some of the content may contain information provided by Rackspace employees, it does not represent an assessment of a particular customer environment or an assessment of any specific compliance with laws or regulations or constitute advice. We recommend that you engage additional expertise in order to further evaluate applicable requirements for your specific environment. For customer specific support issues please contact your Rackspace Support Team.READ MORE
RACKSPACE MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, AS TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THE RACKSPACE OPEN CLOUD COMMUNITY SITE. RACKSPACE RESERVES THE RIGHT TO DISCONTINUE OR MAKE CHANGES TO ITS SERVICES OFFERINGS AND SPECIFICATIONS AT ANY TIME WITHOUT NOTICE. USERS MUST TAKE FULL RESPONSIBILITY FOR APPLICATION OF ANY SERVICES AND/OR PROCESSES MENTIONED IN ANY COMMUNITY DISCUSSIONS. EXCEPT AS SET FORTH IN RACKSPACE GENERAL TERMS AND CONDITIONS, CLOUD TERMS OF SERVICE AND/OR OTHER AGREEMENT YOU SIGN WITH RACKSPACE, RACKSPACE ASSUMES NO LIABILITY WHATSOEVER, AND DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO ITS SERVICES INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
ALTHOUGH PART OF THE COMMUNITY GENERATED CONTENT MAY EXPLAIN HOW RACKSPACE SERVICES MAY WORK WITH THIRD PARTY PRODUCTS, THE INFORMATION CONTAINED IN THE COMMUNITY DISCUSSIONS IS NOT DESIGNED TO WORK WITH ALL SCENARIOS. ANY USE OR CHANGES TO THIRD PARTY PRODUCTS AND/OR CONFIGURATIONS SHOULD BE MADE AT THE DISCRETION OF YOUR ADMINISTRATORS AND SUBJECT TO THE APPLICABLE TERMS AND CONDITIONS OF SUCH THIRD PARTY. EVEN THOUGH RACKSPACE EMPLOYEES MAY PARTICIPATE IN THE COMMUNITY DISCUSSIONS, RACKSPACE DOES NOT PROVIDE TECHNICAL SUPPORT FOR THIRD PARTY PRODUCTS, OTHER THAN SPECIFIED IN YOUR HOSTING SERVICES AGREEMENT YOU HAVE SIGNED WITH RACKSPACE AND RACKSPACE ACCEPTS NO RESPONSIBILITY FOR THIRD-PARTY PRODUCTS.READ LESS