Select to view content in your preferred language

Changing print-layout with ArcGIS Maps SDK for JavaScript;

913
3
Jump to solution
10-11-2023 06:34 AM
Labels (1)
KaiBehncke
Occasional Contributor

Dear users,

 

we got "the first step" print with ArcGIS Maps SDK 4.27 for JavaScript succesfully. But I wonder:

a) Is it possible to change the scalebar, that the units are only shown in kilometers (not in miles)?

b) Is it possible to put an own image (logo) into the printout?

c) Is it possible to set a text in the printout, that has some "breaks" (like html-<br> or \n)?

It might be that we have to create complete own and new templates. Could anybody give some hints, how this can be done?

This is the code so far:

const print = new Print({
  view: view,
  printServiceUrl:
     "https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",
	   allowedLayouts: ["a3-landscape", "a3-portrait","a4-landscape", "a4-portrait" ],
	     allowedFormats: ["jpg", "png8", "png32","pdf"],
templateOptions: {
  title: "Datenausdruck",
  author: "Part 1, Part 2, Part 3",
  copyright: "",
  legendEnabled: false

}
});


view.ui.add(print, {
  position: "top-right"
});

 

Tags (1)
0 Kudos
2 Solutions

Accepted Solutions
David_McRitchie
Esri Contributor

Hey Kai,

Unfortunately I do not beleive there is a way to adjust the print layouts unless you have your own print service hosted on ArcGIS Server or ArcGIS Enterprise. From this you could change the print utiltiy URL and refer to Layout templates hosted via this.

The documentation to do this can be found here.

Hope that helps,

David

Esri UK -Technical Support Analyst

View solution in original post

0 Kudos
KaiBehncke
Occasional Contributor

Thank you very much, that answer is helpfull for us. We contacted ESRI now to get (eventually) an Enterprise-Licence...

View solution in original post

0 Kudos
3 Replies
David_McRitchie
Esri Contributor

Hey Kai,

Unfortunately I do not beleive there is a way to adjust the print layouts unless you have your own print service hosted on ArcGIS Server or ArcGIS Enterprise. From this you could change the print utiltiy URL and refer to Layout templates hosted via this.

The documentation to do this can be found here.

Hope that helps,

David

Esri UK -Technical Support Analyst
0 Kudos
KaiBehncke
Occasional Contributor

Thank you very much, that answer is helpfull for us. We contacted ESRI now to get (eventually) an Enterprise-Licence...

0 Kudos
RichardDaniels
Frequent Contributor

In response to question c) Is it possible to set a text in the printout, that has some "breaks" (like html-<br> or \n)?

Yes, using the copyright property you can include any text, I use to add a disclamer as well as the copyright information.  For example:

templateOptions: {
title: "WSDOT Monuments and NGS Stations",
copyright: "DISCLAIMER: This map is for display purposes only and is not intended for any legal representation. WSDOT Monument Map Engine @ 2024";
northArrowEnabled: true,
legendEnabled: true
}