Select to view content in your preferred language

Problen with the Print Task

13777
44
07-03-2012 04:42 AM
by Anonymous User
Not applicable
Original User: Schnoerkel

Hey there,

i have a problem with the PrintTask. In my applikation i add some Points to the the map as TextSymbol with angle and offset. In the Map all is displayed right. But when i use the PrintTask only little Points are displayed at the Map.

[ATTACH=CONFIG]15706[/ATTACH][ATTACH=CONFIG]15707[/ATTACH]

my code is

add the point:
var xmuss = mapPoint.x - ((mapPoint.x - this.inputPoints[this.inputPoints.length-2].x)/2);
   var ymuss = mapPoint.y - ((mapPoint.y - this.inputPoints[this.inputPoints.length-2].y)/2);   
   var winkelmuss = (Math.atan2((this.inputPoints[this.inputPoints.length-2].y - mapPoint.y), (this.inputPoints[this.inputPoints.length-2].x - mapPoint.x))*180)/Math.PI;
   
   var pt = new esri.geometry.Point(xmuss, ymuss, this._map.spatialReference);
   var textSymbol = new esri.symbol.TextSymbol();
   textSymbol.setColor(new dojo.Color([0,0,0])).setFont(new esri.symbol.Font("12pt").setWeight(esri.symbol.Font.WEIGHT_BOLD));
   var gemessen = '123';     
 
   textSymbol.text = dojo.number.format(gemessen.toFixed(1), {pattern: this.numberPattern}) + zeichen;  
   
   textSymbol.angle = 90;
   
   this.textGraphic=new esri.Graphic();
   this.textGraphic.setSymbol(textSymbol);
   this.textGraphic.setGeometry(pt);
   this._map.graphics.add(this.textGraphic);
   this.measureGraphics.push(this.textGraphic);
 
   


print:

 
//in the init()
// get print templates from the export web map task
        var printInfo = esri.request({
          "url": app.printUrl,
          "content": { "f": "json" }
        });
        printInfo.then(handlePrintInfo, handleError);  






//Print Funktion
   function handlePrintInfo(resp) 
   {
        var layoutTemplate, templateNames, mapOnlyIndex, templates;

        layoutTemplate = dojo.filter(resp.parameters, function(param, idx) {
          return param.name === "Layout_Template";
        });
       
        if ( layoutTemplate.length == 0 ) {
          console.log("print service parameters name for templates must be \"Layout_Template\"");
          return;
        }
        templateNames = layoutTemplate[0].choiceList;

        // remove the MAP_ONLY template then add it to the end of the list of templates
        mapOnlyIndex = dojo.indexOf(templateNames, "MAP_ONLY");
        if ( mapOnlyIndex > -1 ) {
          var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];
          templateNames.push(mapOnly);
        }
       
        // create a print template for each choice
        templates = dojo.map(templateNames, function(ch) {
          var plate = new esri.tasks.PrintTemplate();
          plate.layout = plate.label = ch;   
          plate.format = "PDF";
          plate.layoutOptions = {
            "authorText": "Stadt Osnabrück Fachbereich Städtebau",
            "copyrightText": "Copyright Stadt Osnabrück",
            "legendLayers": [],
            "titleText": "Messen",
            "scalebarUnit": "Kilometers"
          };
          return plate;
        }); 
  
  
  // create the print dijit
        app.printer = new esri.dijit.Print({
          "map": app.map,
          "templates": templates,
          url: app.printUrl
        }, dojo.byId("print_button"));
   
        app.printer.startup();
      }
   
   function handleError(err) {
        console.log("Something broke: ", err);
      }







Hopeyou can Help me
44 Replies
by Anonymous User
Not applicable
Original User: wudgcd

I'm seeing the same issue with text labels.   I also display solid filled diamonds on the map and most of the time they come out hollow on the printout (occassionally I see one print solid).     Any timeline when this will get fixed?
0 Kudos
DK5
by
Deactivated User
I am having this issues as well - textsymbols are not printing - even when I put them on their own layer.  Is there any other workarounds?
0 Kudos
by Anonymous User
Not applicable
Original User: apollolm

Hi - I'm having the same issue.
I'm using JSApi v 3.3 trying to use the 10.1 print GP service in conjunction with text symbols.

I tried creating a separate graphicsLayer for the text symbol, which technically worked, but the resulting PDF image's text is super tiny.  It looks like it preserved the color (red) of the text, but the size is way too small.

Here's how I define my text symbol:

            var font = new esri.symbol.Font("16pt", esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_BOLD, "Arial");
            var textSymbol = new esri.symbol.TextSymbol(labelText, font, new dojo.Color("#ff0000"));
            textSymbol.setOffset(0, 0);
            textSymbol.setAlign(esri.symbol.TextSymbol.ALIGN_START);
            var text = new esri.Graphic(graphic.geometry, textSymbol);



Any thoughts?
0 Kudos
JohnGravois
Deactivated User
we were able to reproduce problems directly in REST.  it appears that print services do not currently honor the size of textSymbol supplied in webMap JSON.  here is the tracking information.

[NIM090748: Printing service fails to honour the font size of textSymbols.]
0 Kudos
by Anonymous User
Not applicable
Original User: amarsden

Hi

Is any of this related to this thread in the Silver Light topic.

Basically any attempt print if text items have been added to the graphics fail with

Layer "graphicsLayer1": Field 'newID' not part of schema for this feature collection.


Printing with other added stuff on is fine.

For info this is a snippet of my code where I set the properties of the added text

            if (drawtype == 'Text') {                
                var font = new esri.symbol.Font(dijit.byId("font.size").value, esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_NORMAL, "verdana");
                var symbol = new esri.symbol.TextSymbol(dijit.byId("usertext").value, font, fullcolour).setAngle(0).setOffset(0, 0).setAlign(esri.symbol.TextSymbol.ALIGN_MIDDLE).setDecoration(esri.symbol.TextSymbol.DECORATION_NONE).setRotated(false).setKerning(true);
            }





Cheers

ACM

PS How do we track logged bugs like NIM090748 - when-ever they appear with links, the links never work.
0 Kudos
JohnGravois
Deactivated User
unfortunately, software defects are not "publicly" searchable.  in this particular case the bug i referenced is specific to textMarker symbols that are their own graphic (with their own geometry).

i typically post bug tracking numbers here in the forum so that customers that are current on maintenance can call into support and request to be added to the list of customers affected if they are running into the same problem.  this has two benefits.

1.  it increases the visibility of bugs to our development teams
2.  afterwards the customer can track the progress of the bug using our "MySupport" portal.

i am also happy to provide status updates here in the forums, but i would only take the time to reply if i come across the relevant post again and the status of the bug has changed.
0 Kudos
by Anonymous User
Not applicable
Original User: mhoover12

In my experience, the color of the text is not honored, either.  It is always black.  Has anyone else seen that?
0 Kudos
aiminfan
Deactivated User
I have the same issue.
I am using JSAPI 3.4.
Neither font color and rotation respected by print widget.
0 Kudos
by Anonymous User
Not applicable
Original User: TSchrag

I'm still not sure exactly where the problem is, but I figured I would share this information in case it's helpful to anyone. When using the print service to export our map, text elements added using mark-up tools were honoring color, but not size. All of the text was showing up very very small (had to increase the dpi to 300 to even see it).

After fooling around with the JSON parameter being fed to the print service for a while, I discovered that by taking out the color definition all together, the text started showing up at the correct size on the print exports.

Unfortunately, I'm not aware of a way to remove the color flag from the JSON without doing some manual manipulation... but this seems to at least be a temporary workaround if you can get by with black font. Also very interesting that some people seem to be getting the correct size, but not the right color (reverse of our issue).

-Tyler
0 Kudos
AdrianMarsden
Honored Contributor
So, am I right in thinking that this bug is with ArcGIS Server, not the API?  In which case should we be shouting about it on the Server forums?

ACM
0 Kudos