Select to view content in your preferred language

Printing with Custom Text Elements

6788
15
Jump to solution
07-05-2012 06:16 AM
JustinGreco
Frequent Contributor
Are custom text elements not supported in the JavaScript API yet when using the 10.1 print service?  I do not see it as a property for layoutOptions for the PrintTemplate class.
0 Kudos
15 Replies
MichaelVolz
Esteemed Contributor
Are there any ESRI samples that show how to use Custom Text Elements to print out information of a selected record on the custom print template?
0 Kudos
Enguerranddes_Vaux
Regular Contributor
in templates parameter you can do it :

{
        label: "PDF A4",
  format: "PDF",
  layout: "myLayout",
  layoutOptions: {
           legendLayers:[legendLayer],
   customTextElements : [
    {myTest: "My text !"}
       ]
   },
   exportOptions: {
        dpi: 96
     }
  }
0 Kudos
MichaelVolz
Esteemed Contributor
Enguerrand:

In order to get your code to work, would I need to have dynamic text in my PDF A4 map template that had the name myTest so the web app would recognize the dynamic text I am passing from the Javascript app to the selected map template of the custom print service?
0 Kudos
Enguerranddes_Vaux
Regular Contributor
Yes. The Element Name will make the link. ( sorry for my english, i'm french)

[ATTACH=CONFIG]34331[/ATTACH]
0 Kudos
MichaelVolz
Esteemed Contributor
Enguerrand:

Your code above is slightly different from an ESRI sample that seems to have been created for v10.1.


The ESRI sample is shown below:
{
            name: "Letter ANSI A Portrait",
            label: "Portrait (Image)",
            format: "jpg",
            options:  {
              legendLayers: [],
              scaleBarUnit: "Miles",
              titleText: printTitle + ", Portrait JPG"
            }

Has the syntax for options changed between 10.1 and 10.2 where layoutOptions are now specified just as options?  It seems to me that both options and layoutOptions are referring to the same objects.
0 Kudos