Select to view content in your preferred language

FV 3 advanced print widget output quality

3543
14
Jump to solution
11-13-2012 01:12 PM
RhettZufelt
MVP Notable Contributor
Hi all,

using the ExportWebMaptask function of the new print widget.  Much nicer than the old one, but wondering if there is some way to make the image quality better?

I see the task has options to set the dpi and image size:
"exportOptions": {  "dpi" : 300,  "outputSize" :  [   500,   500  ] }


But, is there a way to modify the JSON string being sent to the task to overcome the default 96 dpi setting?

Thanks again,

R_
Tags (2)
0 Kudos
14 Replies
RhettZufelt
MVP Notable Contributor
Thanks Dasa,

That did it.

Maybe one of these days I'll figure out how to get the array values from the configxml.

R_
0 Kudos
RhettZufelt
MVP Notable Contributor
Ok, in case someone elses wants to have the dpi option as a dropdown with the dpi values set in the configXML, her is how I did it:

Added <resolution> tag to the PrintWidget.xml:

<resolution>96,150,266,300</resolution>



In ExportWebMapForm.mxml,


added these vars:

   private var resol:String;
   [Bindable]
   private var exportDPI:IList;




made this change in the init() function:

   private function init():void
   {
    if (configXML)
    {
     printTask.url = configXML.taskurl;
     printTask.getServiceInfo();
     printButton.label = configXML.labels.submitlabel[0] || hostBaseWidget.getDefaultString("printSubmitLabel");
 //My add 
     resol = configXML.resolution;
     var resolArr:Array = resol.split(",");
     exportDPI = new ArrayCollection(resolArr);
 // End My Add        }
   }


Then added this mx FormItem:

  <s:DropDownList id="formatsDDL"
      width="100"
      dataProvider="{printTask.getServiceInfoLastResult.formats}"
      requireSelection="true"/>
 </mx:FormItem>
 <!--My add--> 
 <mx:FormItem id="printDPI"
     label="Select DPI"
     width="100%"
     includeInLayout="true"
     visible="true">
  <s:DropDownList id="dpiDD" width="100"
      selectedIndex="0"
      requireSelection="true"
      dataProvider="{exportDPI}">
  </s:DropDownList>
 </mx:FormItem>
 <!--End My add--> 
 
 <s:HGroup id="scaleFI"


Also have to add this to the printParameters:

        <esri:PrintParameters id="printParameters"
                              format="{formatsDDL.selectedItem}"
                              layoutTemplate="{layoutTemplatesDDL.selectedItem}"
                              map="{hostBaseWidget.map}"
                              preserveScale="{scaleCheckbox.selected}">
   <esri:exportOptions>
    <esri:ExportOptions dpi="{dpiDD.selectedItem}"/>
   </esri:exportOptions>
            <esri:layoutOptions>
                <esri:LayoutOptions id="layoutOptions"/>
            </esri:layoutOptions>
        </esri:PrintParameters>


This is for FV3.0. It appears in 3.1 you have to add this import as well (since I couldn't figure out how to get values from the config directly to an IList):

            import mx.collections.ArrayCollection;


Enjoy,

R_
0 Kudos
PatrickMullen1
Occasional Contributor
Great work R_!

The drop down list option is very helpful.

For those who implemented the drop down list solution, don't forget to change the height of the widget in PrintWidget.mxml.

private function basewidget_initializeHandler():void
            {
                if (isPartOfPanel) // if widget is part of "left", "right" or "bottom" panel
                {
                    this.percentWidth = this.percentHeight = 100;
                    wTemplate.percentWidth = wTemplate.percentHeight = 100;
                }
                else
                {
                    wTemplate.width = 355;
                    wTemplate.height = 290; //Any number above 290 will give enough room.
                    wTemplate.minHeight = 168;
                }
            }
0 Kudos
RhettZufelt
MVP Notable Contributor
I removed the title block and added the dpi so didn't have to change the size.

If so, remember that it is a widget, as such, the height/width can be handled in the widget tag. No need to edit source:

        <widget label="Print" left="600" top="80" height="290" width="355"                
                icon="assets/images/i_print.png"
                config="widgets/Print/PrintWidget.xml"
                url="widgets/Print/PrintWidget.swf"/>


R_
0 Kudos
JasonStanton__GISP
Regular Contributor
Thanks to everyone who helped resolve this thread!...your time is greatly appreciated!!
0 Kudos