Want to embed a PDF stored in Dropbox on your WordPress site? Dropbox share links do not always work directly in a PDF Embedder shortcode or block. They point to a preview page, not the raw file. A small adjustment to the URL is all that is needed.
This guide covers how to convert a Dropbox share link into a direct download URL that PDF Embedder can load.
Before you get started, make sure your WordPress site is running under HTTPS. Dropbox’s CORS policy requires a secure connection. Embedding from Dropbox will not work on HTTP sites.
Converting the Dropbox Link
In the Dropbox file browser, right-click your PDF and select Copy Dropbox link. The link will look like this:
https://www.dropbox.com/s/09ctqeg1hd9soi2/Example-PDF-Document.pdf?dl=0
Code language: JavaScript (javascript)
Two changes are required before this URL will work with PDF Embedder:
- Replace
www.dropbox.comwithdl.dropboxusercontent.com - Change
dl=0todl=1
The adjusted URL:
https://dl.dropboxusercontent.com/s/09ctqeg1hd9soi2/Example-PDF-Document.pdf?dl=1
Code language: JavaScript (javascript)
Use this URL in your shortcode:
[pdf-embedder url="https://dl.dropboxusercontent.com/s/09ctqeg1hd9soi2/Example-PDF-Document.pdf?dl=1"]
Code language: JSON / JSON with Comments (json)
Links from a Dropbox Public Folder
If the file is in a Dropbox Public folder, the link may already use the dl.dropboxusercontent.com domain. In that case, change dl=0 to dl=1 only. The domain change is not needed.