Select to view content in your preferred language

Printing Issue - Text Not Displaying in Print Layout

1970
5
05-06-2014 07:08 AM
IanPeebles
Frequent Contributor
I have an application where a user can add graphics including text to the map.  I also have a geocoding tool where the user can locate an address and a marker symbol will display along with the address as a text label.  The issue is that the text will not print in my print layout that I have configured.  If the user adds in text to the map, they can change the color, size and angle.  However, when pringing out the map using the print widget, none these settings carry over to the print layout.  By default, the text shows up in black.

I am currently using the ArcGIS JavaScript 3.5 API.

Are there any solutions to these issues?

Please refer to the screenshots:

Text from Geocoding Tool

1. Application with Point (Address Point) and Text (Address Label):

[ATTACH=CONFIG]33620[/ATTACH]


2. Application Printed Out using Print Widget (notice missing Address Labels):

[ATTACH=CONFIG]33621[/ATTACH]


Adding Text

1. Added Text as University, Red, 20pt, Normal, Align Start, Text Angle 45 within the map

[ATTACH=CONFIG]33622[/ATTACH]

2. When generating a Print Out (notice the text is in black)

[ATTACH=CONFIG]33623[/ATTACH]
0 Kudos
5 Replies
Noah-Sager
Esri Regular Contributor
Hi Ian,

The issue is that the text will not print in my print layout that I have configured. If the user adds in text to the map, they can change the color, size and angle. However, when pringing out the map using the print widget, none these settings carry over to the print layout. By default, the text shows up in black.


I think the issue you are facing here is a known software limitation. It is necessary to supply all of the font properties when creating a new Font object.

[#NIM099497 The printing service only honors the font properties of textSymbols if all or none of the new Font object parameters are defined.]

Try something like this in your code, and see if the customization appears in the printout (please note that this is in AMD style):
var font = new Font("40pt", Font.STYLE_ITALIC, Font.VARIANT_NORMAL, Font.WEIGHT_BOLD, "Courier New"); 


Hope this helps!

-Noah
by Anonymous User
Not applicable
Original User: ipeebles

Hi Ian,



I think the issue you are facing here is a known software limitation. It is necessary to supply all of the font properties when creating a new Font object.

[#NIM099497 The printing service only honors the font properties of textSymbols if all or none of the new Font object parameters are defined.]

Try something like this in your code, and see if the customization appears in the printout (please note that this is in AMD style):
var font = new Font("40pt", Font.STYLE_ITALIC, Font.VARIANT_NORMAL, Font.WEIGHT_BOLD, "Courier New"); 


Hope this helps!

-Noah



Noah,

The text properties are defined in the code, but only the marker symbol shows up.  Here is my code for the symbol/text output for the geocoding results.  This is shown in screenshots 1 and 2 on my first post.

With the text properties defined, the text still does not display on the print out.

Refer to the line where I have the text properties defined and the color:

//add a text symbol to the map listing the location of the matched address.
var displayText = candidate.address;

var font = new esri.symbol.Font("12pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");
           
var textSymbol = new esri.symbol.TextSymbol(displayText,font,new dojo.Color("#FF0000"));
textSymbol.setOffset(0,12);

map.graphics.add(new esri.Graphic(geom, textSymbol));
return false; //break out of loop after one candidate with score greater  than 80 is found.
0 Kudos
Noah-Sager
Esri Regular Contributor
Hi Ian,

I tested with your font code, and it prints just fine for me. I only used the one line of code though.

var font = new esri.symbol.Font("12pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");


There may be two other issues going on:

1) are you using a proxy in your application? I highly recommend our new resource proxy
the length of the print request may be getting truncated, and the proxy will help with this

2) for the colors, try using RGB values (e.g. 255, 0, 0) instead of hexadecimal (e.g. #FF0000), and see if that helps

-Noah
0 Kudos
by Anonymous User
Not applicable
Original User: ipeebles

Hi Ian,

I tested with your font code, and it prints just fine for me. I only used the one line of code though.

var font = new esri.symbol.Font("12pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");


There may be two other issues going on:

1) are you using a proxy in your application? I highly recommend our new resource proxy
the length of the print request may be getting truncated, and the proxy will help with this

2) for the colors, try using RGB values (e.g. 255, 0, 0) instead of hexadecimal (e.g. #FF0000), and see if that helps

-Noah


Noah, thanks for the reply.  I am using a proxy and here is how it is specified within the application (index.htm):

I host the proxy page configuration on our internal server.

// PROXY PAGE CONFIGURATION
esri.config.defaults.io.proxyUrl = "http://arcgis02/Proxy/proxy.ashx";

I am using the 3.5 version of the JS API.  Can I download that proxy and host that on the server?  Would that work with my existing applications that are written in JS 3.5?  Any compatibility issues?



I changed, the colors of the text to RGB.  Here is the updated code:

var textSymbol = new esri.symbol.TextSymbol(displayText,font,new dojo.Color([255,0,0,0.75]));


Still having the same issue.  The text does not show up.

Ian
0 Kudos
Noah-Sager
Esri Regular Contributor
Yes, the new proxy should work fine with the 3.5 version of the JS API. There are some different configurations with the new proxy, so please read the documentation thoroughly.

I'm not sure what the issue is at this point. I recommend creating a jsfiddle, to share your code with us here, or contacting Esri Support and logging an Incident.

-Noah
0 Kudos