top of page

Custom PDF Export Button in MicroStrategy

Updated: Nov 26, 2019

There are many things we, as developers, can do to create a great user experience. One of those small things is to create custom export buttons in documents. There are 3 things we need to make this happen

  1. The export function(s) we want to use

  2. A listener

  3. A button to trigger the function


These are all relatively easy to add in an html container within MicroStrategy. To begin add an html container to your document and make sure the Html Container is set to "HTML Text" in the properties.



add the snippet of code below;


<script>

function Export() {

mstrApp.docModel.controller.printPDF();

}

document.getElementById("button").addEventListener("click",Export);

</script>

<input id="button" value="Export" type="button"></p>

</form>



This is great! Now I can create custom buttons for exporting directly from within the dashboard to trigger the export function.





Bonus: we can format/style the button however is needed to meet the requirements from within the HTML container. I typically like to set the button to transparent (with no text) overlay it on a custom image of my choice to give the user an even better over all experience!


Update: See this post to format this button the easy way.


Have fun!

 

Thanks for checking out this blog post. If you found this post helpful please consider donating. Any contribution is appreciated! Just click the PayPal icon at the bottom of this page.






2,244 views4 comments

Recent Posts

See All

4 Comments


Sachin Sonawane
Sachin Sonawane
Jul 08, 2021

Want to export dossier to pdf.

Like

brandi.s.carr
brandi.s.carr
Jun 29, 2020

Hi Omar, any update on making this work in a dossier?

Like

Omar Vidaure
Omar Vidaure
May 28, 2019

That's a good idea. I will follow up with another posted related to dossiers

Like

Rohit Khudabadi
Rohit Khudabadi
May 28, 2019

Hi Omar, Thanks for sharing this information it worked fine for Document. Can you please let us know how to make it work in Dossier?

Like
bottom of page