We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

Mhd's avatar
Mhd
Explorer | Level 4
8 years ago

Is there a difference between PDF preview (endpoint : files/get_preview) and PDF files by /download

Hello,

I am trying to display a doc file through /get_preview end point. 
My understanding is that it will generated a pdf preview (I guess that means a pdf file ? )

The pdf preview I am getting is generating an empty file. 
However, I test the same code generating the file  with the response from /download endpoint downloading a pdf file. the generated file is not empty. 

So, can I treat pdf_preview from /get_preview and pdf data from /download in the same way ? 
Or am I missing something here? 

Thank you 

1 Reply

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    The /2/files/download endpoint just returns the original file data. If the file is a PDF file, it will return the original PDF data.

     

    The /2/files/get_preview endpoint generates a preview of the requested file, and does not return the original data. Per the documentation, it will generate either a preview in PDF or HTML format, depending on the type of the original file. Note that this endpoint does not support retrieving previews of PDF files.

     

    If the file is already a PDF, you can just use the /2/files/download endpoint. If you do call the /2/files/get_preview endpoint for a .pdf file, it will fail with a 'unsupported_extension' error, which is likely the "empty" response you're referring to.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,033 PostsLatest Activity: 3 years ago
409 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!