Add Watermark for MAP_ONLY printing Option

3225
5
Jump to solution
03-04-2016 04:57 AM
MiriamBrockmann
Occasional Contributor

Hi There!

After quite a lot of Searching for an Answer to my Problem and not finding any good

resulotion for i decieded to ask here.

When usind the MAP_ONLY Layout with the Printtask i cannot add any CopyrightText

to the Output. But this is an essential need for securing the rights of the used Data.

I find an intresting Post here Adding image watermark to map via ArcGIS API for JavaScript? - Geographic Information Systems Stack ...​ and try to implement this in my code. It Works fine to make the Div and the graphic inside visible but the Graphic isn't displayed when the Output is exported.

The Div is defined inside the Map-Div, like in the Example.

<div id="map" data-dojo-type="dijit/layout/ContentPane" region="center">

     <div id="MapCopyright" class="CRPrint"></div>

....

Here's the css Definition:

.CRPrint {

    width: 100%;

    height: 100%;

    position:absolute;

    top: 0pt;

    left: 0pt;

    background-color:#ffffff;

    opacity: 0.5;

    filter: alpha(opacity=50);

    color:#ff0000;

    font-size: 100px;

    font-weight: bolder;

    z-index: 10000;

    display:none;

    background-image: url("../images/CR.png");

    background-repeat: repeat-x;

}

When i called the PrintTask the display changed to visible so the Graphic would be exported too.

After the Print is successfull, display is set to "none" again.

Any guesses whats going wrong here? I have a strange feeling that this is all about the export of the Map,

but i can't put a finger on it.

Regards, Miriam

0 Kudos
1 Solution

Accepted Solutions
MiriamBrockmann
Occasional Contributor

Find an easier Way without seting up new Layers or SOIs.

Trick is, to calculate the lower left corners Coordinates, generate a Point in an existing Graphicslayer and

then add a TextSymbol with the required Text.

After printing the whole Screen, the Point is removed from the Map and with it, vanishes the Text.

        var xminMapExt = map.extent.xmin+1;

        var yminMapExt = map.extent.ymin;

        var point = new Point([xminMapExt,yminMapExt],new SpatialReference({ wkid:wkidStart }));

        var text = new TextSymbol("©");

        //Ausgestaltung es Textes mit Farbe, Größe, Halo, Ausrichtung

        text.horizontalAlignment = "justify";

        text.verticalAlignment = "bottom";

        text.haloColor = new Color(["255","255","255"]);

        text.haloSize = 1.25;

        text.setColor(colorFontMeasure);

        text.setFont(fontMeasure);

       

        var textGraphic = new Graphic(point, text);

        graphicsLayerGeneral.add(textGraphic);

        graphicsLayerGeneral.redraw();

But thanks for your Tips.

View solution in original post

0 Kudos
5 Replies
nicogis
MVP Frequent Contributor

If you have AGS 10.3.1 or superior the solution is develop a soi. In sdk arcobjects you have a sample for watermark in export https://github.com/Esri/arcobjects-sdk-community-samples/tree/master/Net/Server/ServerApplyWatermark...

demo live (bottom-left 'Esri Inc') :

This solution, although more complicated, granting you security because the image is generated on the server. If you put your logic on client image files downloaded haven't watermark.

in  my blog about soi: http://nicogis.blogspot.it/2015/05/tutti-pazzi-per-il-soi.html

RobertScheitlin__GISP
MVP Emeritus

Miriam,

   PolyGeo's solution is only for making a div over the map on the client side this div is not used when the print task makes the map only output. My suggestion would be to use a MapImageLayer as all the layers inside a map would get exported. I will see if I can whip up a sample for you.

RobertScheitlin__GISP
MVP Emeritus

Miriam,

   Actually I found this bug where MapImageLayer is not printed either:

BUG-000090606 - A client-side image is not rendered correctly by t..

So it looks like the SOI that Domenico recommends is the best option at this point, unless you want to go through the trouble of creating a custom Export Web Map GP Service.

Tutorial: Publishing additional services for printing—Documentation (10.3 and 10.3.1) | ArcGIS for S...

I do this currently to provide custom layout that the user has to choose from. If you go this route you can uncheck the standard esri MAP_ONLY layout and use a custom layout that you make that has the logo/watermark you are wanting and the map as the only layout items. If you want to use all the standard layouts that esri presents and only have a custom MAP_ONLY layout then all you have to do is copy the default esri layouts to your custom layout templates folder. Here is the location of the standard print layouts for 10.3.1 "C:\Program Files (x86)\ArcGIS\Desktop10.3\Templates\ExportWebMapTemplates"

MiriamBrockmann
Occasional Contributor

Hello Robert!

thx for your Answers! Problem is, that we use our Own Layouts for all other Pintings expect

the MAP_ONLY. This one we take from Esris Printlayouts.

I guess i'll give it a try and make an own Layout for the Map_Only Print. This seems to be the easiest Way. If that wont work, I try the more complicated Solutions.

0 Kudos
MiriamBrockmann
Occasional Contributor

Find an easier Way without seting up new Layers or SOIs.

Trick is, to calculate the lower left corners Coordinates, generate a Point in an existing Graphicslayer and

then add a TextSymbol with the required Text.

After printing the whole Screen, the Point is removed from the Map and with it, vanishes the Text.

        var xminMapExt = map.extent.xmin+1;

        var yminMapExt = map.extent.ymin;

        var point = new Point([xminMapExt,yminMapExt],new SpatialReference({ wkid:wkidStart }));

        var text = new TextSymbol("©");

        //Ausgestaltung es Textes mit Farbe, Größe, Halo, Ausrichtung

        text.horizontalAlignment = "justify";

        text.verticalAlignment = "bottom";

        text.haloColor = new Color(["255","255","255"]);

        text.haloSize = 1.25;

        text.setColor(colorFontMeasure);

        text.setFont(fontMeasure);

       

        var textGraphic = new Graphic(point, text);

        graphicsLayerGeneral.add(textGraphic);

        graphicsLayerGeneral.redraw();

But thanks for your Tips.

0 Kudos