How to embed PDFs in your articles in BBCode & Formatting Knowledge Base | World Anvil

How to embed PDFs in your articles

Available to all Guild subscription tiers. Upgrade here.

 

PDFs are common tools in the RPG space, so being able to embed them in your articles can be really useful! Here's how you can do it on World Anvil:

 

Basic instructions

  1. Get the direct link to the PDF (it should be a URL that ends in ".pdf"). Or, if it's your own file, upload in a file hosting service (see below for specific Google Drive and OneDrive instructions).
  2. Use the [pdf] with the PDF URL, like this: [pdf:https://media.wizards.com/2019/dnd/downloads/UA-ClassFeatures.pdf]
  3. The PDF will be viewable from the article using the default PDF viewer of your browser.
 

Google Drive set-up

Due to limitations with Google Drive, you need to follow these steps to embed PDFs hosted on that service:

 
  1. Upload the PDF to your Google Drive as usual and make sure it can be viewed
  2. Get the sharing link. You will notice that the end of the URL looks like /view?usp=sharing. Replace this entire last part with the following: /preview?usp=drivesdk.
  3. Embed the new URL as explained above.
 

OneDrive set-up

Similarly to Google Drive, OneDrive also requires additional steps to be embedded. After uploading it, follow these steps:

 
  1. Make sure the PDF is public via the share options. Create a link that is accessible by anyone.
  2. Open the PDF in the online OneDrive.
  3. From the upper toolbar select the extra options with the three dots.
  4. Select the Embed option. This opens a sidebar with the embed code.
  5. Locate and copy the URL within the embed code. Don't copy anything else. The URL should look like this: https://onedrive.live.com/embed?....
  6. Embed the PDF using this URL as explained above.
 

Advanced options

The PDF embed tag has a couple of options you can use to customize how the PDF embed looks. It follows this syntax:

 

[pdf:URL|height|toolbar]

 

Here's a breadown of each option:

 
  1. URL (mandatory): This is the URL to the PDF (see above for details).
  2. Height (optional): This is the height in pixels of the PDF embed. By default, it's 1000.
  3. Toolbar (optional): Typing no, n, or will remove the toolbar of the PDF viewer from the embed.