Select to view content in your preferred language

Print Plus Widget Version 1.1.6 July 12, 2015

59342
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
BrandonKeinath1
Deactivated User

This works great Larry!  While I was playing around with your print widget I also noticed the default layer widget.  Is this something available by default or could you share the code with me?  Much simpler for users than hitting the "reset" button.


Thanks,


Brandon

LarryStout
Deactivated User

Brandon,

I have a headless widget I call Acme.  It does lots of "behind the scenes" things, and one of them is resetting the layers to the default WebMap.  All the ResetLayers Widget does is publish a topic that the Acme Widget has subscribed to.

One of my next projects is to fully document the Acme Widget and make config examples for each widget that depends on it, just for requests like this.

Here's a link where you can download my entire app and some documentation on the Acme Widget configuration.  It's a few weeks old, and I'm in the process of updating the post, but as far as the ResetLayers Widget, it should be reasonably up to date.  Just get the two files under "Web AppBuilder Application".

Larrys Custom WAB Widgets and More

CCWeedcontrol
Frequent Contributor

Sorry to sound like a moron but how do you install this widget to WAB 1.1?

RobertScheitlin__GISP
MVP Emeritus

Luke,

   If you right click on the "PrintPlus-1.1.2-2015-4-11.zip" link and choose "Save Link As..." and then unzip the contents and copy the PrintPlus folder over to your \client\stemapp\widgets folder then when you create a new app the Print Plus widget will be available in the widget list.

If you are experienced in editing json files then you can add it to an existing app by following these steps:

  1. Copy the PrintPlus folder to the \server\apps\###\widgets folder
  2. Copy the config.json file from the PrintPlus folder.
  3. Add a new folder under \server\apps\###\configs called PrintPlus and paste the config.json there.
  4. 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"

      }

Note: the index and the number at the end of the id both need to be a unique number that is not already used in the other widgets.

LarryStout
Deactivated User

Robert has given you better instructions than I would have.  If you have any questions about the specific configuration, just let me know.  The Print Plus Widget is not yet configurable in WAB, so the best way to configure it now in either case is with a text editor.

RudieWatzig
Regular Contributor

This is an excellent widget.  I would like to add a logo to the layout, etc.  Is this possible?  I didn't see anything in the configuration documents.  Also, on your online example there is a north arrow, while the one I installed doesn't have a north arrow. 

LarryStout
Deactivated User

Rudie,

Thanks for the kind words.  I believe I must have added the north arrow to the templates on my ArcGIS Server.  I think that would also be the best way to add a logo to the layout.

Larry

RudieWatzig
Regular Contributor

How does the application interact with templates on ArcGIS Server? Also, where in ARcServer do you put these templates?

LarryStout
Deactivated User

Rudie,

Make sure you are pointing the WAB app to your server and not AGOL.  In my widget and also in the Esri Print widget, the serring is the first property in the config.json:

  "serviceURL": "//<your server>/PrintingTools/GPServer/Export Web Map Task",

On my server, the templates are at E:\WebMapTemplates.  The drive letter may be different on your server.

I suggest you back up the default templates before you start modifying them. -:)

BrianWays1
Deactivated User

How do you connect the templates onto the server? Its not similar to publishing a service is it?

I understand this portion "serviceURL": "//<your server>/PrintingTools/GPServer/Export Web Map Task",

How do the templates link to the service or widget? I didn't see it in the config.json

Is there parameters for the templates?

Sorry about the confusion

Thanks,

Brian

LarryStout
Deactivated User

Brian,

In the PrintPlus config file, the "serviceURL" property points to the Export Web Map Task on your ArcGIS Server.

The Export Web Map Task knows where the templates are.

The widget gets the templates from the Export Web Map Task.

It's complicated, but makes sense once you figure it out.

Larry

BrandonKeinath1
Deactivated User

Hi Brian,

I've struggled with this all myself so don't feel bad.  I don't believe the default Export Web Map Task knows anything about layout templates so you will need to publish your own geoprocessing service.  That will allow you to specify the template folder location as a variable in your script.

import arcpy
import os
import uuid

# The template location in the registered folder (as UNC path)
templatePath = '//MyComputerName/MyDataStore/USA'

This tutorial was really helped me when I was publishing print templates.  ArcGIS Help 10.1

Best,

Brandon

LarryStout
Deactivated User

Now I'm confused.  My default Export Web Map Task knows about the layout templates and the formats supported:

Task: Export Web Map Task

BrandonKeinath1
Deactivated User

Where do you have the templates saved?

LarryStout
Deactivated User

E:\WebMapTemplates.  Your drive letter may vary.  The default templates should already be there.  You can search for "Letter ANSI A Landscape.mxd".

BrandonKeinath1
Deactivated User

Hi Larry,

I find that mxd here \\recpgis01\E$\Program Files\ArcGIS\Server\Templates\ExportWebMapTemplates.  And I can understand that it will work by default if you name the files the same as they are within this folder but it won't see any other files unless you edit the script parameters to have the additional mxd names.  And I don't know how to do that without publishing my own geoprocessing service.

Brandon

LarryStout
Deactivated User

I'm a little fuzzy on this because I did it a long, long time ago.  I have layout templates in C:\Program Files\ArcGIS\Server\Templates\ExportWebMapTemplates.  That is the default.  I copied a new template into this folder and restarted the Printing Tools service, and now it shows up in the Rest Services directory.  It is called "No TB Letter ANSI A Landscape" and you can see it here: Task: Export Web Map Task

StanMcShinsky
Frequent Contributor

Larry,

This is a great widget. I have found that in dev 1.1 when I try to customize the visible scale ranges, it breaks the print widget. For example when I remove  some of the small scales the config file writes in some map options. When I use the print tool it always zooms me out to the smallest scale I have available and runs the print and then zooms me back in. I then need to change back the map options back to "mapOptions": {}, to get it to work again. Hope this makes sense.

-Stan

LarryStout
Deactivated User

Stan,

I am sort of able to follow what you are saying, but a link I can look at would be helpful.

Larry

CCWeedcontrol
Frequent Contributor

Larry awesome widget!

I noticed that when your widget is added to the Web Appbuilder the printing work great, but i have download the app and placed to my iis to do a test run and i noticed that the when i try to print i get the "Error, try again". I haven't changed the serviceURL in the config.json. So my question is why does it work with the app builder but not once you download the app to deploy? I do not have ArcGIS Sever.

LarryStout
Deactivated User

Luke,

Thanks for the kind words.  If you can post a link to your app on the server, I'll take a look at it.

Larry

CCWeedcontrol
Frequent Contributor

I currently don't have in on a server. the app is just on my PC iis.

LarryStout
Deactivated User

Can you post any console errors you are getting when you run it from IIS?

StanMcShinsky
Frequent Contributor

Larry,

Here is a demo site. All I did was add the widget change the config and removed some of the available zoom levels.

ArcGIS Web Application

Also you will notice in the print out there are labels in the legend called override 1 and 2.

-Stan

LarryStout
Deactivated User

Stan,

Now I understand the problem.  This widget is over a year old.  Initially, I tested it with Geographic Coordinates as well as Web Mercator, but not lately.  We use State Plane.  It looks like I need to do some more testing with Geographic.

I've noticed the override 1 and override 2 as well, but it hasn't been very high on my to do list.  I'll look into that also.

It may be a few days, but I'll get these problems fixed and get back to you.

Larry

CCWeedcontrol
Frequent Contributor
  1. Error: Unable to complete operation. {code: 400, message: "Unable to complete operation.", details: Array[1], log: undefined, httpCode: 400…}

    1. x@init.js:192
      (anonymous function)@init.js:191
      c@init.js:76
      d@init.js:76
      b.Deferred.resolve.callback@init.js:77
      c@init.js:76
      d@init.js:76
      b.Deferred.resolve.callback@init.js:77
      c@init.js:76
      d@init.js:76
      b.Deferred.resolve.callback@init.js:77
      c@init.js:76
      d@init.js:76
      b.Deferred.resolve.callback@init.js:77
      (anonymous function)@init.js:195
      k@init.js:199
      m@init.js:199
      f.resolve@init.js:201
      a@init.js:200
      k@init.js:200
      m@init.js:199
      f.resolve@init.js:201
      a@init.js:200
      k@init.js:200
      m@init.js:199
      f.resolve@init.js:201
      a@init.js:200
      k@init.js:200
      m@init.js:199
      f.resolve@init.js:201
      q@init.js:160
      f@init.js:164

PrintPlus.js:1348 Error: Unable to complete operation. {code: 400, message: "Unable to complete operation.", details: Array[1], log: undefined, httpCode: 400…}_ssl: undefinedcode: 400details: Array[1]httpCode: 400log: undefinedmessage: "Unable to complete operation."stack: (...)get stack: function () { [native code] }set stack: function () { [native code] }__proto__: d

LarryStout
Deactivated User

Luke,

I'm seeing an error that I've seen before, but I'm not sure what is causing it.  I'll work on it.

Are you using geographic coordinates in your WebMap?

Larry

LarryStout
Deactivated User

Stan,

I did find a couple of bugs in the Print Plus Widget when using a geographic spatial reference.  I've fixed them and posted Version 1.1.3.  Let me know if this fixes the bug you found (or if it doesn't).

Larry

CCWeedcontrol
Frequent Contributor

I am using Projected Coordinates.

Thanks for the follow up.

LarryStout
Deactivated User

I posted a new version of the Print Plus Widget (1.1.3) yesterday.  I'm not sure if I fixed anything that will help you because I'm still trying to get a handle on your problem, but you might try the new version.

Also, make sure the serviceURL in the config file is pointed to Esri's server:

"http://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%2..."

Also, you should be able to copy the serviceURL into your browser and see the Export Web Map Task in the Rest Services Directory.

Larry

StanMcShinsky
Frequent Contributor

If I leave the zoom levels alone then when I go to print then it zooms in to a scale for the print job and then all I get is a gray map and nothing is responsive. If I adjust the available zoom levels or even rest them then it zooms out to the smallest visible scale and sends the print job. Same as before. 

Also as a side note. If the print plus widget is added to the header controller then the checkbox for show layout gets bumped to the next line.

-Stan

CCWeedcontrol
Frequent Contributor

Interesting, it works fine today, i didn't change anything I just verified that i had ServiceURL...

LarryStout
Deactivated User

Stan,

I've been able to reproduce the problem with my WebMap after I removed the two smallest scales.  Now I can fix it.  Sorry for the false alarms.

On a different topic, I noticed a couple of console errors on your test app.  The nls files for the Mixin Classes in the PrintPlus Widget seem to be missing.

Larry

StanMcShinsky
Frequent Contributor

Larry,

Thanks. I took a look at the errors and noticed that they were referencing files that should have been there. I did some investigating and found that for some reason capital letters mattered in the url. The fix is in the PrintPlus/Widget.js file lines 34 and 35 need to have a capital W for _WidgetOpacityMixin and _WidgetMetadataMixin.

-Stan

StanMcShinsky
Frequent Contributor

Also I am not able to get the instructional text to show up at the bottom of the red layout box. Am I missing something?

LarryStout
Deactivated User

Stan,

Good catch.  I hate sloppy programming.  I've fixed them all in my code, but I'm curious about what OS & browser you are seeing this in.  I've never seen the problem.

Larry

LarryStout
Deactivated User

The instruction text is in the PrintPlus/nls/strings.js file.  Can you confirm that is working for you?

StanMcShinsky
Frequent Contributor

No problem. I am not really sure how this happens. I have this test site on a Go Daddy hosting account of mine and all I know is that is is on a Linux OS. I was using Chrome to see this. If you know of a way to fix this then that would be very helpful

-Stan

StanMcShinsky
Frequent Contributor

If you are asking if the site has access to the strings.js file, then yes.

LarryStout
Deactivated User

Stan,

Try this version.  If it addresses your issues, then I'll post the update.

PrintPlus.zip

I really do appreciate your help in testing this.  No way I could test all of the spatial reference and configuration options.

Larry

StanMcShinsky
Frequent Contributor

Great! the instructional text now shows up. Now for the life of me I can not seem to get it to print. When I hit the print button it starts to act normal and then after the zoom to extent the map goes gray and freezes the map. It then requires a refresh and no print job. I even tried to set it up on a fresh version of WAB 1.1, I was getting this same gray screen with the PrintPlus 1.3 and 1.4 Do you see anything that I am missing? I updated that test site so you can see what I am seeing.

-Stan

LarryStout
Deactivated User

Stan,

I think it should work for you now.  I also cleaned up the checkbox problem when putting the widget in the widget pool, and made a few other cosmetic changes.  Here is the entire widget for you to test.

PrintPlusWIdget.zip

Larry

StanMcShinsky
Frequent Contributor

This is looking great. The zooming out for the print is fixed and the instructional text.

Thanks,

-Stan

StanMcShinsky
Frequent Contributor

Larry Stout​,

I did notice that a few more things.

1. This widget does not print any graphics that are drawn on the map with the draw tool.

2. If a layer is not turned on when a print job is submitted then you get a gray map until a layer is turned on and then it sent it to the print queue. In this case a user can not just print just the basemap.

-Stan

StanMcShinsky
Frequent Contributor

3. Closing the print widget does not remove the red layout box from the screen. You need to click the X in the top right of the red layout. Then if you want to print again, you need to check the box in the widget to show layout.

StanMcShinsky
Frequent Contributor

Larry Stout​,

I am not sure if you are working on a settings file to make the builder experience better but I worked this up for you to add into this widget. It is at least a start. It just tells the user to configure the widget in the config.json file and not in the builder. That way it gets rid of the spinning gif.

setting.zip

-Stan

LarryStout
Deactivated User

Stan,

The settings file is on my to do list, but pretty far down.  Your fix is wonderful.  I'll use it on all my widgets that don't have settings files until I get to them.

Thanks,

Larry

LarryStout
Deactivated User

Stan McShinsky wrote:

Larry,

I did notice that a few more things.

1. This widget does not print any graphics that are drawn on the map with the draw tool.

2. If a layer is not turned on when a print job is submitted then you get a gray map until a layer is turned on and then it sent it to the print queue. In this case a user can not just print just the basemap.

-Stan

1. I have fooled around with this and here is what I have run into.  I removed all graphics layers from the printDef, and that took care of the overrides in the legend.  I tried leaving the graphics layer from the Draw Widget in the printDef, but I wasn't able to change the label from "override".  The legend for the Draw Widget graphics wasn't very useful, so I tried leaving this layer off the legend but still include it in the map.  Still no luck.  I'll revisit this from time to time.  Sometimes the stars have to align for me to figure out the tricky stuff.

2. I fixed this.  The problem was asynchronous in nature.  I was listening for the map's 'update-end' event.  There is no map update if only a cached basemap is turned on.  Tricky, but It should work now.

glennhazelton
Deactivated User

I don't seem to be able to download your zip file.

RobertScheitlin__GISP
MVP Emeritus

Glenn,

   Right click the link and choose 'save target as'.

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