Custom printing in WebApp builder without JavaScript?

1305
7
Jump to solution
10-12-2018 08:17 AM
MikeBrown5
New Contributor II

I'm working for a county, tasked with updating the parcel viewer website with newer functionality. I have a strong background in Python and SQL, but I have very little experience working with JavaScript and Esri software, so I'm working with WebApp builder. I've been able to recreate the majority of the old website's functionality but I have a few things I'm still trying to figure out.

If I click on a parcel, I get a popup panel with all the information I want. The basic print widget works and displays all my layers in the outgoing PDF, but doesn't have any of the popup information. The desired output is a PDF with a map view of the parcel as well as the relevant parcel information. I've found a lot of resources on creating custom print widgets and services, but being new to Esri and JavaScript, it's been hard to figure out where to start putting it all together.

Can anyone explain to me in more simplified terms how I might go about doing this? I was able to create a custom hyperlink within the popup that has the parcel ID in it. Would it be easier to make a server process with arcpy to interpret my url parameters and output a PDF rather than trying to make a custom widget? How possible would that be?

1 Solution

Accepted Solutions
TanuHoque
Esri Regular Contributor

this might help you as well (this is all on the server side using arcpy and python)

Printing Popups from Web Application 

View solution in original post

7 Replies
RobertScheitlin__GISP
MVP Emeritus

Aaron,

   There is no simple way to explain this complicated process but here is a thread where I provide links and some code snippets:

https://community.esri.com/thread/184939-printing-popup-contents 

TanuHoque
Esri Regular Contributor

this might help you as well (this is all on the server side using arcpy and python)

Printing Popups from Web Application 

MikeBrown5
New Contributor II

Thanks, this is almost exactly what I've been looking for. I'm getting pretty close to making this work. I got the service published based on your instructions but it's coming up with an error message. I can see several server requests in the browser console before it finally returns this error...

0 Kudos
TanuHoque
Esri Regular Contributor

Did you publish your service as an 'async' service? We recommend 'sync' for any print service. That'd help get rid of extra requests.

regarding the failure, it seems like it is failing on the server while executing the task. Pls check your arcpy code, try to debug it and you can also log error message in your arcpy code that will appears in Server Manager log or in the response (only you set your service log level to something more appropriate).

hope this help.

0 Kudos
MikeBrown5
New Contributor II

Thanks for the info. I will re-publish as a sync. I'll get some better error logging built into the script and find out where exactly the problem is.

0 Kudos
TanuHoque
Esri Regular Contributor

FYI: just uploaded another script in case you are interested of showing photos from attachments of a map/feature service sublayer.

http://www.arcgis.com/home/item.html?id=38a88b5cccb8488480b004e6d318770d 

0 Kudos
MikeBrown5
New Contributor II

For anyone that might come across this thread, here's how I figured out how to get pop-up contents to my custom printing output.

  • The print widget sends the current map view to the Web_Map_as_JSON variable in the geoprocessing service. The popup contents are not included in the JSON, but the coordinates for the selected polygon can be identified and pulled from the JSON.
  • In the script, I accessed the table associated with the parcel feature service and found the parcel that matches coordinates with the selected parcel.
  • The process comparing the selected coordinates against 100,000 different polygons one-by-one was taking a really long time, so I made a text-based index that could quickly identify the selected parcel.

I probably don't need to go into detail about the rest of the process since there are plenty of tutorials on custom printing, including the ones listed above.

0 Kudos