Select to view content in your preferred language

showPrintAreaEnabled PrintVM

129
2
2 weeks ago
BrittaneyHarkness
Occasional Contributor

Hello,

 

I developing a custom print widget using the Print View Model. My print service uses custom layouts and reports that I want reflected in the print area that is displayed in the map. Currently, the print area only displays the default 'letter-ansi-a-landscape' layout and I am not sure what property to update in the Print View Model to modify the print area. Any help would be appreciated. 

 

thanks,

Britt

0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor

Hi @BrittaneyHarkness, thanks for posting your question here. It's a very interesting time for a question such as this, so it would be helpful to get some background information from you. Please feel to respond in this thread, or you can direct message me to discuss, and then we can share the recommendations here afterwards to help others who might encounter a similar scenario.

1) Do you see your custom print templates being returned from this property?

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-PrintViewModel.html...

2) What is the purpose of the custom widget? Like is this part of an app, or how would it be used and in what sort of workflow?

3) Are you using build tools or frameworks?

4) If this is a new project, have you considered components? This is the future of widgets for the ArcGIS Maps SDK for JavaScript.

Component migration blog:
https://www.esri.com/arcgis-blog/products/js-api-arcgis/developers/javascript-maps-sdk-a-full-transi...

Print component doc:
https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-print/

0 Kudos
BrittaneyHarkness
Occasional Contributor

Hi Noah,

 

Thanks for reaching out. Here are the response to your questions and I have one additional question regarding something I just experienced: 

1) Do you see your custom print templates being returned from this property?

https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Print-PrintViewModel.html...

I don't see my custom templates returned from the default templates property. And just as some background I am using custom map layout templates and a report template in my print service. 

2) What is the purpose of the custom widget? Like is this part of an app, or how would it be used and in what sort of workflow?

The purpose of the custom widget is to allow a user to choose to print a map and/or a report that includes a map and details about a selected feature or features in the map. The custom print widget is used in an javascript application. 

 

I initially I was utilizing the print component, but I realized that there was no way to allow the user the select a feature in my application and then have that selection be applied as a filter to source layer for my report. I will send you a direct message with a link to an example report and a link to my test application. 

 

After chatting with another user in Esri community they recommended using the useEsriInterceptor function with the print method from the print view model to intercept the webmapjson before the print is executed to apply a definition query to the source layer. 

 

3) Are you using build tools or frameworks? I am using react

4) If this is a new project, have you considered components? This is the future of widgets for the ArcGIS Maps SDK for JavaScript. I started with the print component see my answer to question  2.

 

New question: Everything is setup and working fine with the exception of how some of the data is being sent to the print service. For some reason a feature layer that is created within my app using graphics as the feature layer source is being sent to the print service as imageData and then not being included in the map legend. I don't understand why this is happening and any help would be appreciated.