modify or view json created by PrintTask

2616
2
Jump to solution
12-16-2015 04:55 PM
SebastianRoberts
Occasional Contributor III

Hi,

  Our Firewall blocks the POST request from PrintTask.execute if the JSON is over a certain character length.  This happens when a user adds too many graphics to a map.  Currently the print task just fails.  Instead, I'd like to be able to do one of the following:

  1. query the length of the Web_Map_as_JSON and not execute the task if it is too long (instead I'll warn the user).
  2. or, edit the json to strip out the offending graphics layer if it is too big.

I found a couple of posts that mention the _getPrintDefinition().  This returns an object, and I could use it to find how many graphics are in each graphics layer, but I would really prefer converting the entire object to the same Json used by the task.  Is that possible?  If I could convert it, then I could determine how many characters the Json is, and achieve 1. above.

Even better would be if I could somehow edit the Json before the print task sends it and achieve 2. above.  However, from what I've found, this doesn't seem possible.

Any suggestions?  Thanks, S. Roberts

1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Sebastian,

   See if this thread helps (I think it will).

Re: setRequestPreCallback on PrintTask

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Sebastian,

   See if this thread helps (I think it will).

Re: setRequestPreCallback on PrintTask

View solution in original post

SebastianRoberts
Occasional Contributor III

Excellent!  And his sample code in the follow up explanation does exactly what I had hoped to do!

0 Kudos