Print Plus Widget Version 1.1.6 July 12, 2015

53587
184
04-06-2015 01:14 PM
Labels (1)

Print Plus Widget Version 1.1.6 July 12, 2015

2/18/2017 - updated download links

This widget is an enhancement of the Esri Print Widget, which was originally written by David Spriggs.

Live Preview Site

Bug Fixes and Enhancements in Version 1.1.6

  1. Fixed a bug (Esri's) that caused the legend in the print file to be incomplete.

Bug Fixes and Enhancements in Version 1.1.5

  1. Added a check for LODs in the main config.json so they can be restored after printing.
  2. Added a setting folder that tells the user the config file must be edited in a text editor.
  3. Adjusted the margins and labels on the widget to keep the checkboxes from wrapping.
  4. Added a red line on the scale slider to show the largest basemap scale.
  5. Fixed a bug in that caused feature layers to not print.
  6. Updated the widget layout.
  7. Added an error icon to print results when there was an error.
  8. Fixed the legend on the print layout to eliminate entries for graphics layers.

Bug Fixes in Version 1.1.4

  1. Fixed a bug that caused a zoom to the wrong scale when printing when the main config.json included map LODs..
  2. Changed all instances of _widgetOpacityMixin* to _WidgetOpacityMixin*.
  3. Changed all instances of _widgetMetadataMixin* to _WidgetMetadataMixin*.

Bug Fixes in Version 1.1.3

  1. Fixed the legend on the print layout to eliminate the "overide" entries.
  2. Tested with geographic coordinate system and fixed associated bugs.
  3. Modified the Mixin Class to destroy itself when the host widget is destroyed.
  4. Made the layout close button bigger and fixed a bug showing the layout at largest scale.

Bug Fixes in Version 1.1.2

  1. Fixed the _WidgetMetadataMixin so it would work with FireFox and IE as well as Chrome.
  2. Fixed the _WidgetOpacityMixin so it would work with FireFox and IE as well as Chrome.
  3. Updated the Live Preview Site.

Enhancements and Changes in Version 1.1.1

  1. Fixed a bug in the widget referencing _WidgetOpacityMixin in the wrong location.
  2. Made the Close button on the Widget Opacity Slider larger (smart phones needed this).
  3. Added the _WidgetMetadataMixin to the widget.  Allows you to Alt-Click the widget header and see the version information.

Features:

  1. The map layout is shown on the screen, so you don't have to guess what will be written to the print file.
  2. There is a scale dropdown and a scale slider.  Either can be used to adjust the scale of the output.
  3. The map can be panned relative to the layout by panning inside the layout.
  4. If you choose to make companion layout templates with no title block, these can be invoked by unchecking the Title Block checkbox.  You have to put these companion templates on your server.  There is a set of companion templates that match the default templates that you can download below.
  5. The Advanced dropdown is context sensitive and does not show options that don't make sense (e.g. Author, Copyright, and legend if you are not using a title block.)
  6. You can configure aliases for the layout names.
  7. When using "Just the Map" layout (alias for MAP_ONLY), there are new options on the Advanced dropdown:
    1. Preserve map scale or map extent
    2. Size of the paper to use (in inches or centimeters)
    3. A visual showing what will be printed compared to the map extent in the browser window
  8. A Widget Opacity Control in the widget header.  This controls the opacity of the Widget when the mouse is over the map.  The opacity is always 1.0 when the mouse is over the Widget.  This allows you to see the map "through" the widget and can be very handy on a small mobile device (e.g. smart phone).

Downloads:

PrintPlus-1.1.6-2015-7-12.zip

CompanionLayoutsWithNoTitleBlocks.zip

PrintPlus-1.1.6-2015-7-12 (download - widget by Larry Stout) 

https://community.esri.com/docs/DOC-9629-companionlayoutswithnotitleblocks-download-widget-by-larry-... 

Larrys Custom WAB Widgets and More

Labels (1)
Comments

Hi.

" in Portal i did NOT have the gp printer tool setup so it was using the default."  -

Default would be using was is online.  The GP Printer is by default installed on your ArcGIS Server.  Just point to it.  I do believe it is already running as well, but want to double check that.

Did you follow the steps I mentioned? You have to create the GP in ArcMap and push to ArcGIS Server with your custom templates.

If you followed the steps, you should be able to verify the print job by submitting the JSON directly to ArcGIS Server.

By that point, point the Widget JSON config away from the Default to the NEW GP you made running on your ArcGIS Server.

Projection will not make a difference

Larry can hopefully add or clarify.

yes i published the template folder

it is visible with the outofthebox print widget

Great widget!

I am wondering if you are planning to extend you widget to print customer text elements(i.e., note, comments)? Thank you and kind regards,

Jin

why would you not just create the Elements in the Map Template and populate the Text entered by the user... the code finds the text element via the template, populates with the users text... done.  We do this for Title Blocks.

Mike,

Thanks for the direction. Since I have not done any customization using web appbuilder, could you tell me what are the files and functions within this widget that need to be revised in order to find the text element from the template?

Thank you kindly,

Jin

I added a text element  called customTextOnTemplate on the map template, added a text field note on PrintPlus.hmtl to collect user typed note. I modified the PrintPlus.js file as follows.

template.layoutOptions = {

                    authorText: form.author,

                    copyrightText: form.copyright,

                    legendLayers: (this.layoutForm.legend.length > 0 && this.layoutForm.legend[0]) ? null : [],

                    titleText: form.title,

                    customTextElements: [{customTextOnTemplate: form.note}]

                };

                this.printparams.template = template;

While testing in web appbuilder, although template object shows customTextElements captured the user input, the value is not printed to the map template.  What am I missing?

Any help is appreciated.

Jin

Hello!

Have you tested on the Export Task (execute task - POST)?

Web Map JSON will be made of 5 top level objects:

{

"mapOptions":{ },

  "operationalLayers": [ ],

  "baseMap": [ ],

  "exportOptions": { },

  "layoutOptions": { }

}

layoutOptions is where you need to add customTextElements and point to the textelement name in the mxd template.

"layoutOptions": {

        "titleText": "BCDataMapTest",

        "authorText": "Printby: MikeRobb",

        "copyrightText": "©2012"

},

        "customTextElements": [

            {

                "Title": "Thisisthetitle\nNextLineHere"

You should be able to take that JSON and put directly into the custom Export Task Service you made to verify all of that is working first.  Once you have that working... you can get closer to the widget to find out why the request is breaking.

output.PNG

I tested my export task service with the following json, it printed out the value specified for title and author field in the layoutOptions, but the does not have the custom text field customTextOnTemplate updated for the Note on the print out.

{

        "operationalLayers": [],

        "baseMap": {

            "baseMapLayers": [

                {

                    "id": "defaultBasemap",

                    "opacity": 1,

                    "visibility": true,

                    "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"

                }

            ],

            "title": "Topographic"

        },

        "exportOptions": {

            "dpi": 300,

            "outputSize": [

                1280,

                1024

            ]

        },

        "layoutOptions":{

            "titleText": "Title test",

             "authorText": "Print by: XYZ",

             "customTextElements":

          [

            {"customTextOnTemplate" : "Town ABC"}

          ]

                }

    }

export service.PNG

I don't know if I did not write the customTextElements part correctly in the json or I need to update export map service? Any help is appreciated!

http://arcgis.neorsd.org/arcgis/rest/services/AGO_Tools/PrintTemplateMap/GPServer/Export%20Web%20Map...

Kind regards,

Jin

to confirm, the TextElement Name in the mxd is customTextOnTemplate ?

yes, that's correct.

Regards,

jin

and the Layout Template i used is "Letter ANSI A Landscape", this is the map template that has the customTextElement customTextOnTemplate.

Hopefully some one can help me out. I have downloaded and installed this print widget, I also published my own export map task from my server and have configured the json file to use that service.  My issue is that the map will not print out to the correct scale. I tried setting the template mxd with no coordinate system, then again with web mercator , then with MD state plane feet.  No matter what I do it is always off.  I would guess about 150% larger than the requested scale.  Using the sample site things print to scale, so it must be with my settings or service.  Any advice on how to set those up.  All of my maps use ESRI basemaps, Idealy I would like the output units to be in feet.

Thanks.

It is possible that you are trying to print at a scale that is between the base map cached scales.  In this case, it will jump to an available cached scale.​

I am running into a couple of issues using my own export map task and wanting to see if anyone else has had these problems as well. Any help or advice is greatly appreciated... first time poster here!

I created a folder for my custom templates (...ArcGIS/Server/Templates/ExportWebMapTemplates_custom) and copied over some existing templates as they are and also made my own template. Now that I am using my own Task URL, when I test the print templates they all have the basemap RGB values in the legend. This includes A3 Portrait, etc. ones that I didn't mess with and only copied over. I am using my own Image service set as the basemap so it doesn't even show in the app 'legend' widget. Anyone come across this or know what is causing this?

The other issue is as soon as I switch over my Task URL, the scale slider has no values/ticks and the scale textbox is no longer "1:500", just goes from 0 - 100 (see below). If I leave it to be 0, the print scale goes to half of what my map extent is at.

Scaleissue.JPG

I appreciate any advice - this thread has already been a huge help to me so thanks to everyone!

An update on these issues if anyone is interested - I found a way to get rid of the RGB values in the legend on the print template in the PrintPlus.js. I only had to tweak this a little because this structure was already in the code:

if (layer.declaredClass === 'esri.layers.ArcGISImageServiceLayer') {

          // Eliminate graphics layers from legend

          indexesToRemove.unshift(idx);

However, I still have the issues that the screenshot above shows - the scale showing differently, there being no ticks on the scale slider, and also the red box missing. If it makes a difference, I am using a State Plane projection...

Thanks

I am also having trouble with using my own export map task GP similar to what Courtney Barbee mentioned.  I also do not get the ticks, scale, or even the show layout.   It looks like it is pulling the templates, I do not see the red layout either.

Any thoughts?

the reason why I loaded this widget is to retain the foot print or graphic of a buffer I created in situational awareness widget.  when I have my buffer and I am ready to print the print widget clears my buffer.  How can I print the results that I want not just a default map extent?

David,

I'm having the exact same behavior with my custom templates and using our own export web map GP service. I couldn't describe the behavior any better.

However, similar to Rob's (?) observation from earlier in the thread I get the warning about trying to print a map: "You have requested a print with a scale larger than the maximum scale of the map.  If you proceed, some of the layers will not be printed."

Then the map display grays out. I know the GP service works fine with the included print widget so I have no reason to expect something is up there. I do wonder how much more we would need to manually edit in the print plus' config.json, however, to get the parameters correct? Not sure why we'd need to if the out of box one doesn't need any special configuration (but instead gets this info from the GP service itself...or so it seems).

A big thanks to Larry Stout​ for this as the additional functionality will be very helpful for our users (if I can get it configured right).

Nice looking widget!

I have noticed a problem on every custom print service I have encountered (or created), and the problem is the same here: when using a custom Print (Geoprocessing) Service, any legend items that are in a group layer do not appear in the print-out's legend.

However, if using ESRI's default print service (http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%2...​​) these group layer legend items do show up in the print-out's legend.

Anyone have any idea on why this is or how to get the group layer legend items to show up?

I will make a Geonet Discussion about this too.

I'm trying to import Print+ into 1.3 but am not seeing it recognized once I attempt to create an app.

I've edited the manifest.json to 1.3. What other .js modifications am I missing to get this tool to work with an updated version?

Update: Figured out my issue. So just confirming that Larry's Print+ widget works with 1.3.

I'm following up to see if anyone had success with integrating a custom GP Print Task, incl. customized scaling. We've encountered the same problems, including the 'scale larger than...' issue but haven't had any luck thus far.

Thanks.

I was able to use the Utilities' Printing Tools on our server instead of creating a custom export task out of desktop. The templates it's pulling from are in Program Files->ArcGIS->Server->Templates->ExportWebMapTemplates. This worked similarly to the arcgisonline service for me when no other print services published from desktop would work at all. Same problems as listed above.

But the problem I'm having is in adjusting the layout frame to reflect changes in my print templates - I'm sure the dimensions are the same as what's in the print layout template, but it prints a different extent than what is shown in the layout, which makes me wonder if the scale is correct. The template data frames are all in WGS84 web mercator aux sphere - would that make a difference? Thanks, cob

Charles,

Thanks for the tip on modifying the raw templates serving the Utilities Print Service. I'll take a look and see if I can replicate the extent issue that you're experiencing and let you know the results.

Seth

Thanks Seth - so if you make a custom template and put it in that Utilities folder, should be able to modify the config parameters based on the dimensions in the print template - like say we want the legend to be in a single column on the right side of a landscape layout - adjust the data frame size and the anchor point. It does modify the frame as expected, but that's not the output from the print result - seems to be cropping it by about 15-20%. If you use a custom template based on the configuration of the stock templates, the frame is pretty close to the output...but that won't work for us. But, I think there's enough merit for users to be able to see an accurate extent of what they are about to print - especially since it takes so long to generate the print image... that this is worth spending some time to try and figure it out. cob

I'm interested in using this widget. Can I use this widget in WAB v1.3?

The widget does function in 1.3.

I've been having issues with the zoom scales, similar (I think) to some of the users above who have modified the specific scales in the default tool.  I'm using cached services, so trying to go beyond 1128 won't work anyhow (using the web mercator default scales).  Their issues seemed to be fixed in V1.1.3, but I'm already at the current 1.1.6 Print Plus version (WAB 1.3 and server 10.3.1) and still experiencing it the following:

Unless my map is already zoomed to the max scale, the print plus widget will zoom in one more level as it takes the 'snapshot' of the map, and then back out again when it's complete.  The PDF generated in either case is not exactly what was in the red box, which was my original goal in using this tool. 

Is there an issue with using it either with the web mercator scales (since they use decimals, does that cause the zoom?) or with the custom templates in the print service?  The maps come into the templates just fine, and they are pretty basic, but with a different extent than what was displayed in the tool. 

Thanks in advance,

Mikkel

Map scales as listed in the config_PrintPlus.json:

"mapScales": [

    591657527.591555,

    295828763.795777,

    147914381.897889,

    73957190.948944,

    36978595.474472,

    18489297.737236,

    9244648.868618,

    4622324.434309,

    2311162.217155,

    1155581.108577,

    577790.554289,

    288895.277144,

    144447.638572,

    72223.819286,

    36111.909643,

    18055.954822,

    9027.977411,

    4513.988705,

    2256.994353,

    1128.497176

  ]

First off, this widget is awesome.  I feel like this widget really empowers the end user to make their own map, which will cause them to contact me less!  In configuring this widget, I have found (thanks to this forum) using the default templates and modifying them is the way to go.

I was wondering if I can have some assistance with a bug I'm experiencing?  Basically, unchecking/checking the legend on/off appears to have no effect.  Here is a link to my app (WIP).  The only changes I've made to the config file is to make it point to my server and the various title/author/copyright parts.

Thanks

Robert,

I download the plusprint widget, and followed the steps which you provide. The last step is to add following code to the the config.Json file. Could you explain more detail where I should put in that file?

Thanks

  • Open the config.json file in the \server\apps\###\ and add to the widgetPool > panel > widgets array

    {

        "name": "PrintPlus",

        "label": "Print Plus",

        "version": "1.1.2",

        "uri": "widgets/PrintPlus/Widget",

        "config": "configs/PrintPlus/config_Print Plus.json",

        "index": 5,

        "id": "widgets/PrintPlus/Widget_19"

      }

Why doesn't the legend contain the service layers in the output pdf?  I just tried the Live Site and none of the page formats include a legend -- well, I assume there's a legend but no services are being added to it.

I ask because I suspect it's due to the same issue we are having: map services with group layer content in the source mxd's will not be added to the legend created from the print widgets (this one or esri's).

Zhujing,

  Not sure how I can explain that more.

Open the config.json file in the \server\apps\[app#]\ folder and add to the widgetPool > panel > widgets array

You find the widgetPool Object which has a panel child and a widgets child which is an array of objects. Just add the code to that widgets array.

James,

  you will see that issue in this widget or the OTB print widget because it is an ArcGIS Server issue.

Robert,

I did not see the widgetpool object in the config.json file under \server\apps\[app#]\widegts\PrintPlus\config.json.

Zhujing

Zhujing,

  That is because it is in the main config.json file. \server\apps\[app#]\config.json

Robert,

Do you know how could I show the scale bar according to my map scale in this PrintPlus widget? I used the State Plan, I even changed "outWkid" and  "mapScales" in the the config file to matches the scales my map has. But it dose not work.

"mapScales": [

  180000, 90000, 45000, 22500, 11275, 5600,

    2800, 1400, 700, 250

  ]

"outWkid": 2260,

Zhujing,

Nope I don't use this widget.

I am experiencing the same issue as Mikkel and others previously with maps zooming in beyond what is shown in the layouts using my custom templates and standard web mercator (wkid 3857). Double checked all of my template size definitions, checked my wkid, and kept printing samples to no avail.  I've tried setting the scales to just above the standard esri basemap LODs in case it was zooming to the next available because of decimals as Mikkel suggested but this didn't work either.  Has anybody come up with an answer to this issue?

Nice work Larry! The widget has been adopted to our server and it works great for our users.

One thing though I will need your help that, I would like to uncheck the legend in the title block as default. This is because we often do not need the legend to show on the map. I've tried looking into the javascript and found nothing.

Thanks in advance Larry.

Kipo,

  Look in the widgets templates folder and open the PrintPlus.html file in some text editor and then find this code block:

<div id="includeLegend" data-dojo-type="dijit/form/Form" data-dojo-attach-point="layoutFormDijit"><!-- lcs Print Enhancements - added id -->

            <table cellspacing="5">

              <tr>

                <td>

                  ${nls.lncludeLegend}:

                </td>

                <td>

                  <input type="checkbox" data-dojo-type="dijit/form/CheckBox" data-dojo-props="name:'legend',value:true,checked:true"/>

                </td>

              </tr>

            </table>

          </div>

And change this line:

<input type="checkbox" data-dojo-type="dijit/form/CheckBox" data-dojo-props="name:'legend',value:true,checked:false"/>

It works just like a charm.

Thank you very much Rob for your prompt reply!

Charles,

I am also getting the same problem with custom print layouts where print result is getting cropped by 10%-20%. Were you able to find any solution to that ?

Hi Mikkel,

Did you find the solution to your problem ?

Unfortunately, I have not gotten any solution to the problem so far.

At this point, not having time myself to go in and attempt to debug the widget, I’ve suggested to my client that they go back to using the out of the box print tool. That doesn’t give the nice outline like Print Plus does (sometimes), and they’re not overly excited about the ESRI tool, but without time to spend on it, that may be the case.

I’m still hoping that someone on the forum does have a suggestion that gets it back to normal, as that would be ideal.

Good luck,

Mikkel

Hi guys, great widget.  I'd love to see the ability to add multiple custom text fields to the widget that are linked to named text elements in the layout mxds.

Cheers,

Marc

I had to adjust the print frame dimensions manually in the config file, measuring the map scale against the frame size (a bit of trial and error). The frame looks weird in the map view, but it does seem to hold the extent content from the frame in the print output. You're not the tennis player, are you? 🙂

Charles - Could you expand a bit on exactly what you changed and/or include screenshots?  I, like many folks, am having the scale issue still.  I set the layout parameters (margins, data frame size) in the config, but I'm not sure what you mean about measuring the map scale against the frame size.  Thanks.

I am using the Print Plus widget in a WAB app, and I get the raster components of an orthoimagery layer displaying in the legend of a custom print layout, despite the layer being hidden from legend in the webmap (the imagery is not the basemap layer). How can I remove those raster components from my print layout legend? Thank you.PrintPlus_legend_issue.png

All I mean is that you adjust the frame size based on the map scale and the distance between where the margin is in the app map view and the printout result. Don't worry about the actual size of the map frame (the page size stays the same), just adjust the numbers to make the frame match the print result. You may know this already but when the frame is changed it only affects the right margin and you set the left with the x offset, same with the the top (frame) and the y offset (bottom). So for example the config params for my letter portrait size are:  [{ "x": 8.5, "y": 11 }, { "x": 6.3, "y": 6.6 }, { "x": 1.2, "y": 3.05 }, { "x": 0.5, "y": 0.5 }] which I arrived at through the method above - say if the scale is 12,000 and the right margin is 2000 feet outside where it actually prints, reduce the x frame size by one inch. Seems to work and hold with different screen sizes/shapes. This is coming from our custom print template but it does have standard margins based on the ESRI template. Thanks, cob

I changed the relative scale factor from 0.08333333 to 1 in the config file, and my print output extent matched the area within the frame of the PrintPlus widget. Any downside to this?


Charles - thanks for suggestion but unfortunately that doesn't work for me.  Many times the widget actually performs correctly the first time, and only after changing templates or scales it starts to go haywire.  So tweaking the layout size would cause issues off the bat on the first print with initial template, plus the frustration of the template on screen not looking like the actual page layout, which is part of the point of the widget in the first place!

Matt - The relative scale factor only controls the calculation of the scale printed on the map, not anything to do with the map contents.

Version history
Last update:
‎04-06-2015 01:14 PM
Updated by:
Contributors