Skip to Content

Hi there!

Today i want to share with you my second “self-made” component.

Since SAP DS1.3 still does not have a built-in pdf export system, i implemented a component by myself.

The component is client side(totally javascript), so it could not work with some browsers (IE).

I used many MIT Licensed javascript libraries.

First of all, the jsInclude tags in “contribute.xml”


As you can see, i use a set js files from jspdf library – Link here : MrRio/jsPDF · GitHub

Then html2canvas that jspdf requires for working. html2canvas

And finally FileSaver.js that jspdf uses for saving pdf. eligrey/FileSaver.js · GitHub

Followin my component.js code:

this.init = function() {
  this.button   = document.createElement("button");
  this.button.type = "button";
  this.button.innerHTML = text;

In the init function, i create and append the button to the handler div.

this.afterUpdate = function() {
            that.$().click(function() {
            var svgElements = $('body').find('svg');
                 var svg = this;
                 var img = document.createElement("img");
                 img.className = "screenShotTempCanvas";
                      svg.className = "tempHide";
                      var parent = svg.parentNode;
                      img.onload = function(){

Since jspdf library cant process svg part of code i have to convert them in something else, i choose to convert all the svg tags of the application in base64 images. In the code above i look for all the svg tags in the document and then i replace them with img tag containg themselves as Base64 image.

var pdf = new jsPDF('p','pt','a4');
pdf.addHTML(document.body,function() {
  if(pdfMethod == 1){
  }else if(pdfMethod == 2){
  } $('body').find('.screenShotTempCanvas').remove();
that.button.innerHTML = text;

Then i use jspdf addHTML method to generate a pdf with all the visible content of the page(including the img tags created before) and, basing on pdfMethod variable, save the file or open it in new or same window. Then i remove all the img tags and show again the svgs.

Here some screenshot of the results:




and the github repo:

Antoninjo/DesignStudioPDFExportComponent · GitHub

That’s it.

I hope that it will be useful.



To report this post you need to login first.


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

  1. Mike Howles

    Antonio – Great post.  I’ve looked at a few various implementations to achieve the Holy Grail of exporting with pure JS, but unfortunately IE seems to always be the pesky black sheep, doesn’t it?  🙂

    For Chrome/Mozilla customers, I think this is a great option, though.  Thank you for sharing.

      1. Mike Howles

        Right, it seems like IE is always the lone problem child 🙂

        If you get it to work in IE, I’d be very interested, but masses of HTML5 coders have already tried, but I wish you the best of luck!  I’ve only seen brittle examples of it working in IE (not trying to deter you, though!)

    1. Former Member


      I’m trying to install it with the latest Design Studio version but get the following error:

      Failed to discover all connectors. RepositoryDiscoveryStrategy failed with an error Failed to process repository contents No repository found at jar:file:/C:/Users/abc/Desktop/!/.

      Do you have an idea what could be the problem?

      Thanks and best regards,


  2. Former Member

    Hi Antonio,

    many thanks for sharing this extension.

    It works fine. The export is even possible in IE.

    But sometimes I get the following error message:

    SCRIPT5022: Mismatched anonymous define() module: function() {

        return saveAs;


    combined_dynamic_includes_1407395057699101315887.js, Row 8737 Sign 9

    Do you have any idea how to solve this

    or what could be the reason?

    Thanks a lot in advance

    Kind regards


  3. Former Member

    Hello experts,

    I have a problem by creating a deployable feature with this pdf export function.

    Creating the features with the SAP examples was no problem, but it doesn’t work with that one.

    Error Message:

    Image 2015-01-30-3.jpg

    Has anybody already created a deployable feature with the pdf export functionality?

    Best regards,


  4. Cesar Buendia Rios

    Hi all, I have a problem with this component when execute my report in BI Platform or on Netweaver Portal the system send me a error message. (image)  and when printing on Internet Explorer (11) the result don’t show me the graph components.

    Any sugestion, thanks?.


  5. Former Member Post author

    Hi Guys!

    Actually i change work and i can’t work any more on this component(because i don’t work with DS at the time).

    I’ll glad to help whoever wants to work with the component or improve it.

    Karol you can try to use it and test it(if it works).

    Thanks to all.


  6. Michael Jennings

    Hi All,

        I get the same error reported by XXX


    Failed to discover all connectors. RepositoryDiscoveryStrategy failed with an error Failed to process repository contents No repository found at jar:file:/C:/Users/Desktop/


    Anyone solve this issue ?

    Best Regards,



    1. Tammy Powlas

      Hi – as Antonio said he is not working on this any more, you could try the PDF export available from this free trial:

      I just tried it and it works

  7. Former Member

    Hi All,

    Found a solution for exporting SVG charts on IE 11 using canvg.

    I replaced svgAsDataURI with following lines:

    var oCanvas = document.createElement(“canvas”);

    var svgData = new XMLSerializer().serializeToString(this);

    canvg(oCanvas, svgData);

    img.src = oCanvas.toDataURL(“image/png”);



    img.onload = function(){


    Hope this helps.

      1. Former Member

        Yes Karol those lines L52 – L64.

        It works for Chrome and Forefox along with IE.

        I am not sure about SDK component with SVG charts though.



Leave a Reply