cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

image missing in uploaded pdf

image missing in uploaded pdf

siva s
Explorer | Level 3
Go to solution

Hi,

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

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

@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.)

View solution in original post

3 Replies 3

DB-Des
Dropbox Engineer
Go to solution

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
Explorer | Level 3
Go to solution

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
Dropbox Staff
Go to solution

@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.)

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    siva s Explorer | Level 3
  • User avatar
    DB-Des Dropbox Engineer
What do Dropbox user levels mean?