Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.

Forum Discussion

siva s's avatar
siva s
Explorer | Level 4
2 years ago
Solved

image missing in uploaded pdf

Hi,

   I have uploaded pdf file using upload dropbox api..Pdf uploaded successfully.But Attached image not showing in uploaded pdf..

  • siva s Thanks for following up with the information. I see you're using /2/files/upload to upload files. The /2/files/upload endpoint is a "content-upload" style endpoint, meaning that it takes the raw data to upload in the request body.

     

    Dropbox does not modify the file data you supply when uploading to the Dropbox API like this, so make sure you're supplying the exact correct file data in your API call. Looking at your code, it looks like that would be in your 'newpdf' variable, coming from 'doc.output()', so make sure that variable contains the complete PDF data that you're expecting when you run that particular code.

     

    Otherwise, while Dropbox itself won't change the data you upload, different PDF viewers work differently, so this may be a matter of where/how you're viewing the contents of the PDF file. For example, if you view a file on www.dropbox.com and view the same file in an app locally but they display differently, that would be more a matter of how the PDF viewer works. If that's the case, and you're having trouble with the PDF viewer on www.dropbox.com in particular for the same exact file that works elsewhere, I suggest opening a thread in "View, download, and export" instead. (This "API Support & Feedback" section of the forum is only for the Dropbox API itself.)

3 Replies

Replies have been turned off for this discussion
  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Hi!

     

    I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information.

     

    Please reply with:

    - the name and version number of the platform and SDK/library you are using, if any

    - the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)

    - the unexpected output

  • siva s's avatar
    siva s
    Explorer | Level 4
    2 years ago

    Hi DB-Des,

        Thanks for your reply..Its react js code..I am using jspdf for creating pdf..I have added some content and images into that pdf..After pdf creation i am updating the pdf to my dropbox..Pdf uploaded successfully to my dropbox account..Added texts are there but image not showing...I thought it's jspdf code issue.Then i downloaded that same pdf to my system..Downloaded pdf has images and added texts..But if i uploaded the same pdf to dropbox images not showing only empty screen showing..

    I have added  sample code below FYR:

    Version:

    "jspdf": "^2.5.1",
    "react": "^18.2.0",
     
    Code:
    let newpdf = doc.output();// Output of the pdf
    const requestOptions = {
              headers:{
                'Authorization':'Bearer '+Access_token,  
                  'Dropbox-API-Arg': JSON.stringify({
                    'path': "/test.pdf",
                    'mode': 'add',
                    'autorename': true,
                    'mute': false,
                    'strict_conflict': false
                  }),
                    'Content-Type': 'application/octet-stream',  
              }
          };    
         
            axios.post("https://content.dropboxapi.com/2/files/upload",newpdf,requestOptions)
            .then(
              (result) => {
                console.log(result)
              },
             
              (error) => {
                console.log(error)
              }
            )
         
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    siva s Thanks for following up with the information. I see you're using /2/files/upload to upload files. The /2/files/upload endpoint is a "content-upload" style endpoint, meaning that it takes the raw data to upload in the request body.

     

    Dropbox does not modify the file data you supply when uploading to the Dropbox API like this, so make sure you're supplying the exact correct file data in your API call. Looking at your code, it looks like that would be in your 'newpdf' variable, coming from 'doc.output()', so make sure that variable contains the complete PDF data that you're expecting when you run that particular code.

     

    Otherwise, while Dropbox itself won't change the data you upload, different PDF viewers work differently, so this may be a matter of where/how you're viewing the contents of the PDF file. For example, if you view a file on www.dropbox.com and view the same file in an app locally but they display differently, that would be more a matter of how the PDF viewer works. If that's the case, and you're having trouble with the PDF viewer on www.dropbox.com in particular for the same exact file that works elsewhere, I suggest opening a thread in "View, download, and export" instead. (This "API Support & Feedback" section of the forum is only for the Dropbox API itself.)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,039 PostsLatest Activity: 6 minutes ago
415 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!