How to customize format and quality in the Print Widget ?

1720
3
Jump to solution
04-20-2017 01:58 AM
FlorianCADOZ
Occasional Contributor

Hi everyone,

I need to customize the print widget by setting the export quality to 300 DPI by default and limiting the list of available formats to JPEG, PNG and PDF!

In my memory, it seemed to me that it was enough simply to modify an array in the config.json of the widget but it has perhaps changed ...

I took a look into the print service but nothing to there ... Moreover I took a look into the .js of the print widget and anything to customize directly in the code ...

If someone know how to do for filtering those format and setting a default value for the quality of export ...

Thanks a lot ! 😃

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Florian,

   In the Print.js _handlePrintInfo function I use this snippet to remove a couple of the formats:

        var formatItems = array.map(Format[0].choiceList, function(item) {
//Remove the EPS, SVG, and SVGZ formats
          if(item !== "EPS" && item !== "SVG" && item !== "SVGZ"){
            return {
              label: item,
              value: item
            };
          }
//end my change
          return {
            label: item,
            value: item
          };
        });

Then in the Print/templates/Print.html make this change (change the value property):

<input type="text" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="name:'dpi',required:true,value:300,style:'width:100px;'"
                                    />

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

Florian,

   In the Print.js _handlePrintInfo function I use this snippet to remove a couple of the formats:

        var formatItems = array.map(Format[0].choiceList, function(item) {
//Remove the EPS, SVG, and SVGZ formats
          if(item !== "EPS" && item !== "SVG" && item !== "SVGZ"){
            return {
              label: item,
              value: item
            };
          }
//end my change
          return {
            label: item,
            value: item
          };
        });

Then in the Print/templates/Print.html make this change (change the value property):

<input type="text" data-dojo-type="dijit/form/NumberTextBox" data-dojo-props="name:'dpi',required:true,value:300,style:'width:100px;'"
                                    />
FlorianCADOZ
Occasional Contributor

Wonderfull ! Works perfectly !

For the snippet, it's actually in the line 488 (for people who have the same problem)

Thank you Robert !

0 Kudos
GuillaumeDENIAUD
New Contributor II

Hello.

Unfortunatly, for me it had not change anything, EPS, SVG, and SVGZ formats are still there after copying that snippet.

version of wab 2.5

0 Kudos