Select to view content in your preferred language

API 3.0 print tool only printing graphicslayer in Black on White

1179
6
Jump to solution
07-27-2012 11:05 AM
JaredWhite
Regular Contributor
Hi,
I pretty much copied and pasted the print example, with a couple drawing options w/a graphicslayer. However, when I go to print, it only shows up in black and white. Is there something I'm missing or is this just the way it is with the print tool for now?
0 Kudos
1 Solution

Accepted Solutions
PreetiMaske
Esri Regular Contributor
Hi,

Can you please elaborate on "when I go to print, it only shows up in black and white". Does the entire map shows black/white , including the basemap? or only Graphics are printed in black and white.Can you provide your XAML?

Side note,
The export web map task  cannot print not any custom symbols. If there are any custom symbols for e.g. symbols using storyboards/gradients etc are downgraded to black point circle/line/polygon based on geometry type.

--Preeti

View solution in original post

0 Kudos
6 Replies
PreetiMaske
Esri Regular Contributor
Hi,

Can you please elaborate on "when I go to print, it only shows up in black and white". Does the entire map shows black/white , including the basemap? or only Graphics are printed in black and white.Can you provide your XAML?

Side note,
The export web map task  cannot print not any custom symbols. If there are any custom symbols for e.g. symbols using storyboards/gradients etc are downgraded to black point circle/line/polygon based on geometry type.

--Preeti
0 Kudos
JaredWhite
Regular Contributor
Problem was coming from from complicated graphics. I simplified everything to soliccolors and no storyboard and it worked.
0 Kudos
JenniferNery
Esri Regular Contributor
In addition to Preeti's post, PrintTask in v3.0 can only support symbols and renderers the REST API support: symbols and renderers.

If you don't want the symbols to be downgraded to black, you can create a symbol class that implements INotifyPropertyChanged. For example, if you are using StrobeMarkerSymbol from this SDK sample: custom symbols, you can reference this MarkerSymbol instead, it would still be SimpleMarkerSymbol but you can atleast update Color, Size, Style to make it look similar to your animated/custom symbol.

 public class MarkerSymbol : ESRI.ArcGIS.Client.Symbols.MarkerSymbol, IJsonSerializable
 {
  private SimpleMarkerSymbol sms;
  public MarkerSymbol()
  {
   sms = new SimpleMarkerSymbol() { Color = new SolidColorBrush(Colors.Red) };
  }

  public string ToJson()
  {
   return sms.ToJson();
  }
 }
0 Kudos
NathalieNeagle
Regular Contributor
Hello Jennifer and Petetim,


I understand what you are saying but I'm having a hard time doing what is necessary.  My endusers have come to love the selection and hoover of the symbols.  My Point selection symbol is printing red, which works but my lines and polys are black.  Can you take a look at my xaml and let me know what the best work around is.  I really didn't follow what Jennifer was saying and I want to keep my current selection symbols (if possible)

Thanks
Nat


 <esri:SimpleMarkerSymbol x:Key="ResultsMarkerSymbol"  >
                <esri:SimpleMarkerSymbol.ControlTemplate>
                    <ControlTemplate>

                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                        
                                                 Storyboard.TargetProperty= "(Fill).(Color)"
                                                To="#FFF5FF45" Duration="0:0:0.1" />
                                        </Storyboard>

                                    </VisualState>

                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>

                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>

                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>

                            <Ellipse x:Name= "Element"             
                                               Stroke="Blue" Fill="#8800FFFF"
                                StrokeStartLineCap="Round" StrokeThickness="2" 
                                StrokeLineJoin="Round" StrokeEndLineCap="Round"    
                                     Width="16"                 
                                     Height="16"                    
                                                    
                                      />
                        </Grid>

                    </ControlTemplate>
                </esri:SimpleMarkerSymbol.ControlTemplate>
            </esri:SimpleMarkerSymbol> 







<esri:FillSymbol x:Key="ResultsFillSymbol">
                <esri:FillSymbol.ControlTemplate>
                    <ControlTemplate x:Name="CustomPolygonTemplate">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#FFF5FF45" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Path x:Name="Element" Stroke="Blue" Fill="#880000FF"
                                StrokeStartLineCap="Round" StrokeThickness="2" 
                                StrokeLineJoin="Round" StrokeEndLineCap="Round" />
                        </Grid>
                    </ControlTemplate>
                </esri:FillSymbol.ControlTemplate>
            </esri:FillSymbol>











 <esri:LineSymbol x:Key="CustomGrowLineSymbol">
                <esri:LineSymbol.ControlTemplate>
                    <ControlTemplate xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">
                        <Grid>

                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="0" Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" To="6" Duration="00:00:01" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="0" Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" To="3" Duration="00:00:01" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="0" Storyboard.TargetName="Element" Storyboard.TargetProperty="(Shape.StrokeThickness)" To="6" Duration="00:00:01" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Path x:Name="Element" Stroke="BLUE" StrokeThickness="3" />
                        </Grid>
                    </ControlTemplate>
                </esri:LineSymbol.ControlTemplate>
            </esri:LineSymbol>

0 Kudos
NathalieNeagle
Regular Contributor
I was able to get the line to work by adding this little bite of code (Highlighted in Red)...this makes the visual state function for selection, normal, and mouseover and still allows a red line for printing:

  <esri:SimpleLineSymbol x:Key="ResultsLineSymbol" Color="RED" Width="4">
                <esri:SimpleLineSymbol.ControlTemplate>
                    <ControlTemplate x:Name="ResultsLineSymbolTemplate">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Stroke).(Color)"
                                                To="Aqua" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Stroke).(Color)"
                                                To="Chartreuse" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Stroke).(Color)"
                                                To="Yellow" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Path x:Name="Element" Stroke="Red" Fill="{x:Null}"
                                StrokeStartLineCap="Round" StrokeThickness="4" 
                                StrokeLineJoin="Round" StrokeEndLineCap="Round" />
                        </Grid>
                    </ControlTemplate>
                </esri:SimpleLineSymbol.ControlTemplate>
            </esri:SimpleLineSymbol>





BUT I CAN"T GET THE FILL TO WORK AT ALL:

If I try a basic fill like::

<esri:FillSymbol x:Key="DefaultFillSymbol" >
                <esri:FillSymbol.ControlTemplate>
                    <ControlTemplate>
                        <Path x:Name="Element" IsHitTestVisible="False"  
                            Stroke="Red" StrokeThickness="1"/>
                    </ControlTemplate>
                </esri:FillSymbol.ControlTemplate>
            </esri:FillSymbol>



It doesn't work:


I want to do something similar like the line something like

 <esri:FillSymbol x:Key="ResultsFillSymbol" BorderBrush="RED" BorderThickness="3" >
                <esri:FillSymbol.ControlTemplate>
                    <ControlTemplate x:Name="CustomPolygonTemplate">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#55FFFFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Path x:Name="Element" Stroke="Red" Fill="#880000FF"
                                StrokeStartLineCap="Round" StrokeThickness="2" 
                                StrokeLineJoin="Round" StrokeEndLineCap="Round" />
                        </Grid>
                    </ControlTemplate>
                </esri:FillSymbol.ControlTemplate>
            </esri:FillSymbol>





Any suggestions??
0 Kudos
NathalieNeagle
Regular Contributor
Got it. Everything works great like the line and point...now the poly.  All the visual state cool custom states works (ex. Normal, MouseOver, Selected) but when it print it just uses this line of code and prints with SimpleFillSymbol:

<esri:SimpleFillSymbol x:Key="ResultsFillSymbol" BorderBrush="RED" BorderThickness="3" >

All I did was

changed to FIllSymbol to SimpleFillSymbol

Like this

<esri:SimpleFillSymbol x:Key="ResultsFillSymbol" BorderBrush="RED" BorderThickness="3" >
                <esri:FillSymbol.ControlTemplate>
                    <ControlTemplate x:Name="CustomPolygonTemplate">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#55FFFFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ColorAnimation Storyboard.TargetName="Element"
                                                Storyboard.TargetProperty="(Fill).(Color)"
                                                To="#8800FFFF" Duration="0:0:0.1" />
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Path x:Name="Element" Stroke="Red" Fill="#880000FF"
                                StrokeStartLineCap="Round" StrokeThickness="2" 
                                StrokeLineJoin="Round" StrokeEndLineCap="Round" />
                        </Grid>
                    </ControlTemplate>
                </esri:FillSymbol.ControlTemplate>
            </esri:SimpleFillSymbol>
0 Kudos