I have to convert a lot of Microsoft Word documents to PDF for my work. It is very important to me to render the formatting as accurately as possible. I successfully installed Office 2010 on Xubuntu 14.04, but there is an issue where I can’t open a document. I can only open a new blank document. So, I have given up there. I then proceeded to search for the most accurate rendering tool for Word to PDF. I looked into online tools such as Zamzar as well as other options. (Unfortunately LibreOffice changes the formatting too much.)

After a few tests, the best rendering I could find was this:

Then you append the URL of the Word document:

Final product:

From here I would print to PDF.

As you can see from my link, I would use the Dropbox ‘Public’ folder to be able to get a URL for my document. To get the URL in the Public folder you right click on the file and select ‘Copy public link.’

I would like to streamline this process as much as possible because I have to do it a lot. I am trying to find the best way to do so. I would like to create a script that runs the following:
chromium-browser https://view.officeapps.live.com/op/view.aspx?src=Variable-Representing-Current-Content-Of-Clipboard

The current content of the clipboard when I click on the script will be the Dropbox link to the Word document file.

(I am unable to make a bookmark to the https://view.officeapps.live.com/op/view.aspx?src= section of the URL and then just go to the address bar and paste the Dropbox link after because the officeapps URL automatically forwards to another.)

If anyone has any other ideas, I am certainly open to them and appreciative.

Much thanks in advance.


Nautilus script solution

It wouldn't be too difficult to grab the clipboard contents and work with them, but I can do you one better. The following Nautilus script will open any supported document via Microsoft Office Online. It does so by first copying the document to your public Dropbox folder (if it wasn't there before) and subsequently passing the public URL to the web service:


# Name:         Open in Microsoft Office Online
# Author:       (c) 2015 Glutanimate <https://github.com/Glutanimate/>
# Dependencies: dropbox, a web browser (e.g. firefox, chromium...)
# Installation: https://askubuntu.com/q/574252/81372
# License:      GNU GPLv3 (http://www.gnu.de/documents/gpl-3.0.en.html)
# Usage:        open_in_microsoft_office_online <file>

# Settings

CopyToDb="yes"  # whether to copy file to public dropbox folder
                # in case it's not there already (no/yes)

# Variables

GuiTitle="Open in Microsoft Office Online"


# Functions

  ## generic notification function
  notify-send -i "$GuiIcon" "$GuiTitle" "$1"
  echo "$1"

# Checks

## check if file selected
if [[ ! -f "$File" ]]; then
  gui_notify "Error: No file selected."
  exit 1

## check if Dropbox running
if ! pgrep dropbox > /dev/null 2>&1; then
  gui_notify "Error: Dropbox isn't running."
  exit 1

## check if Dropbox folder set correctly
if [[ ! -d "$DbPath" ]]; then
  gui_notify "Error: Can't find dropbox folder. Please set DbPath in script."
  exit 1

# Main

## get public URL
DbPubUrl="$(dropbox puburl "$File")"

## optional: copy file to public dropbox folder if it isn't there
if [[ "$CopyToDb" = "yes" && "$DbPubUrl" = "Couldn't get public url: Unknown Error" ]]; then
  ## create public Dropbox folder if it doesn't exist
  [[ ! -d "$DbPath/Public" ]] && mkdir "$DbPath/Public"
  ## copy file to public folder, don't overwrite any existing file
  cp -n "$File" "$DbPath/Public/"
  ## wait for sync to complete
  while dropbox filestatus "$DbPath/Public/$Filename" | grep syncing; do
    [[ "SyncCounter" = "0" ]] && gui_notify "Syncing file..."
    sleep 5
    ## wait a maximum of 10 minutes for sync to complete
    if [[ "$SyncCounter" -gt "120" ]]; then
      gui_notify "Error: Sync timeout. Exiting."
      exit 1
  ## get public URL
  DbPubUrl="$(dropbox puburl "$DbPath/Public/$Filename")"

## check if public URL exists and open in Microsoft Office Online
if [[ "$DbPubUrl" != "Couldn't get public url: Unknown Error" ]]; then
  xdg-open "${MsOfficeUrl}${DbPubUrl}" > /dev/null 2>&1 &
  gui_notify "Opening document in Microsoft Office Online..."
  gui_notify "Error: Can't generate public Dropbox link from File."


There are two important settings that govern how the script operates:

  • DbPath sets the path to your Dropbox folder. This is ~/Dropbox by default. Please make sure to chage the setting if you've moved your DB folder.
  • CopyToDb controls whether or not to copy files to the Public folder if they're located somewhere else in the file system.

    This option is on by default (yes). If you disable it (no) the script will only handle files in your public Dropbox folder.

Installation instructions

As this is a Nautilus script, you can use the following generic instructions to install it on your system:

How can I install a Nautilus script?

Hope this is what you were looking for!

  • 1
    That is awesome! Thank you so much. This was way beyond what I was even hoping for. Works great. :) – jbrock Jan 17 '15 at 0:27
  • I wonder if it would be possible to run this script with Thunar? I suppose you would configure a Custom Action to then run the script. I am using the thunar-dropbox-plugin, so Dropbox options are available in the context menu in Thunar. If not, I am just glad it works for Nautilus. Thanks – jbrock Jan 17 '15 at 17:50
  • @jbrock Yeah, a custom action should work. The script doesn't use any Nautilus-specific calls or variables. As long as Thunar passes the file path to the script everything should be fine. – Glutanimate Jan 17 '15 at 18:29
  • 1
    I was glad to see that it works in Thunar. The script was placed in /usr/bin/. In Thunar I went to 'Edit' > 'Configure custom actions.' Then I added the following, Command: /usr/bin/NameOfScript %f File Pattern: *doc;*docx Then I selected 'Other Files' Thanks so much for the help. I am so pleased with this final result and being able to do this. – jbrock Jan 18 '15 at 1:05
  • 1
    I got it. I replaced xdg-open with google-chrome-stable – jbrock Jan 18 '15 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.