Skip to Content

A recent post on SCN asked about opening a local PDF in Android using Agentry (  As it turns out, after some additional testing the Android HTML browsers don’t have the ability to directly view PDF files like the iOS HTML control.

However, if you have an appropriate PDF viewer installer on your Android device (like Adobe Reader or Polaris Office) then those applications will register an intent filter with the OS so that when an attempt is made to view a PDF file the OS will automatically hand off the request to the installed application.  This works great as long as the application opening the file can determine and set the data type of the file being opened.

It was suggested that we could use the Agentry URL action step to cause the OS to invoke the intent using a file:///path/to/pdf/file.pdf command.  From the responses it appears this works for some users but in my case it doesn’t work (at least for my current device – Samsung Galaxy S4).  However, since that option didn’t work for me I had to look at another option.  My solution was to create a helper application to open the PDFs that is able to detect and set the appropriate MIME type so that the OS can prompt or open the appropriate application to view the PDF (Polaris Office in my case).

I created an android application that I so originally named External Document Launcher.  My application registers a custom scheme (extdoclaunch) that accepts a single parameter of the path to the file to open.  I use the OpenURL action step and create a rule to build the command.


My app receives the URL and based on the file extension builds the appropriate intent with the file and data type before invoking the file.  The Data property referened in the rule points to the External Data Property on the attached document.

Since the OS now knows the type of the file it appropriately opens or prompts the user on what application they want to use.  Since I have to know the appropriate MIME type to set I have a set list of application types that are currently supported (PDF, XLS, XLSX, DOC, DOCX, PPT, PPTX, MP3, TXT, PNG, GIF, JPG, JPEG).

To use the application simply install the .apk on your device and create the openURL action step similar to the above rule.  When you run the action selecting one of the supported documents you should be prompted or the document should automatically open.  If the file extension is not one of the supported types  a popup message will be displayed saying “Unsupported Document Type”.

To download the apk visit this link (no Google account is needed to download the file).

I’ll work on a follow-up post with more details of the andorid application internals if there is more interest.


To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Rikardt Louw

    Hi Bill , Thanks its awesome!

    You can use Content links as well. If you don’t want to use a App.





  2. Former Member

    Hi Bill,

    Thanks for the application and it works beautifully. I am able to view PDF, docs but when i see for jpg and png it says unsupported format. We need some other formats like tiff. Kindly advice on how we can extend your application for multiple file formats?

    1. Bill Froelich Post author

      Is the error saying “Unsupported Document Type” or unsupported format?  Just trying to understand where the error is coming from.

      In terms of graphics support the built in HTML control can be used to view JPG, PNG and GIF files without needing the helper application.  I do not know if TIFF is supported in the HTML control (or in the gallery viewer app).


  3. Former Member

    Hey Bill,

    We are trying to do this at a client I am working for, but cannot seem to figure out how to implement the rule correctly.  Do we have to implement the rule to the OpenURL action?  Does that question make sense?

    I would love to pick your brain to get this working.



    1. Bill Froelich Post author


      Please create a Discussion marked as a Question this way you can mark it correct when answered.  Not only will others benefit from your solution once it is found, but you will have more folks looking to provide a solution when your issue has the greater visibility of a Discussion.



Leave a Reply